Skip to content

Commit

Permalink
remove slow_path_set_flag Label
Browse files Browse the repository at this point in the history
  • Loading branch information
zifeihan committed Feb 21, 2024
1 parent 21fc77f commit 32e5280
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register tmp1, Regis
// Finish fast lock successfully. MUST branch to with flag == 0
Label locked;
// Finish fast lock unsuccessfully. slow_path MUST branch to with flag != 0
Label slow_path, slow_path_set_flag;
Label slow_path;

if (DiagnoseSyncOnValueBasedClasses != 0) {
load_klass(flag, obj);
Expand Down Expand Up @@ -281,10 +281,10 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register tmp1, Regis
assert(oopDesc::mark_offset_in_bytes() == 0, "required to avoid a lea");

// Try to lock. Transition lock-bits 0b01 => 0b00
ori(tmp1_mark, tmp1_mark, markWord::unlocked_value);
xori(tmp3_t, tmp1_mark, markWord::unlocked_value);
cmpxchg(obj, tmp1_mark, tmp3_t, Assembler::int64, Assembler::aq, Assembler::relaxed, tmp3_t);
bne(tmp1_mark, tmp3_t, slow_path_set_flag);
ori(flag, tmp1_mark, markWord::unlocked_value);
xori(tmp3_t, flag, markWord::unlocked_value);
cmpxchg(obj, flag, tmp3_t, Assembler::int64, Assembler::aq, Assembler::relaxed, tmp3_t);
bne(flag, tmp3_t, slow_path);

bind(push);
// After successful lock, push object on lock-stack.
Expand Down Expand Up @@ -313,7 +313,7 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register tmp1, Regis
beqz(flag, locked);

// Check if recursive.
bne(flag, xthread, slow_path_set_flag);
bne(flag, xthread, slow_path);

// Recursive.
mv(flag, zr);
Expand All @@ -329,18 +329,13 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register tmp1, Regis
beqz(flag, flag_correct);
stop("Fast Lock Flag != 0");
#endif
Label end;
j(end);
bind(slow_path_set_flag);
mv(flag, 1);
bind(slow_path);
#ifdef ASSERT
// Check that slow_path label is reached with flags != 0.
bnez(flag, flag_correct);
stop("Fast Lock Flag == 0");
bind(flag_correct);
#endif
bind(end);
// C2 uses the value of flags (0 vs !0) to determine the continuation.
}

Expand Down

0 comments on commit 32e5280

Please sign in to comment.