8307758: RISC-V: Improve bit test code introduced by JDK-8291555

Co-authored-by: Fei Yang <fyang@openjdk.org>
Reviewed-by: fyang
This commit is contained in:
Feilong Jiang 2023-05-11 01:32:29 +00:00 committed by Fei Yang
parent 3cb606ef5b
commit 39f4e4d3c3
4 changed files with 4 additions and 4 deletions

View File

@ -135,7 +135,7 @@ void C1_MacroAssembler::unlock_object(Register hdr, Register obj, Register disp_
if (LockingMode == LM_LIGHTWEIGHT) {
ld(hdr, Address(obj, oopDesc::mark_offset_in_bytes()));
andi(t0, hdr, markWord::monitor_value);
test_bit(t0, hdr, exact_log2(markWord::monitor_value));
bnez(t0, slow_case, /* is_far */ true);
fast_unlock(obj, hdr, t0, t1, slow_case);
} else if (LockingMode == LM_LEGACY) {

View File

@ -922,7 +922,7 @@ void InterpreterMacroAssembler::unlock_object(Register lock_reg)
bne(tmp1, obj_reg, slow_case);
ld(header_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
andi(t0, header_reg, markWord::monitor_value);
test_bit(t0, header_reg, exact_log2(markWord::monitor_value));
bnez(t0, slow_case);
fast_unlock(obj_reg, header_reg, swap_reg, t0, slow_case);
j(count);

View File

@ -2663,7 +2663,7 @@ encode %{
// If the owner is anonymous, we need to fix it -- in an outline stub.
Register tmp2 = disp_hdr;
__ ld(tmp2, Address(tmp, ObjectMonitor::owner_offset_in_bytes()));
__ andi(t0, tmp2, (int64_t)ObjectMonitor::ANONYMOUS_OWNER);
__ test_bit(t0, tmp2, exact_log2(ObjectMonitor::ANONYMOUS_OWNER));
C2HandleAnonOMOwnerStub* stub = new (Compile::current()->comp_arena()) C2HandleAnonOMOwnerStub(tmp, tmp2);
Compile::current()->output()->add_stub(stub);
__ bnez(t0, stub->entry(), /* is_far */ true);

View File

@ -1828,7 +1828,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
} else {
assert(LockingMode == LM_LIGHTWEIGHT, "");
__ ld(old_hdr, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
__ andi(t0, old_hdr, markWord::monitor_value);
__ test_bit(t0, old_hdr, exact_log2(markWord::monitor_value));
__ bnez(t0, slow_path_unlock);
__ fast_unlock(obj_reg, old_hdr, swap_reg, t0, slow_path_unlock);
__ decrement(Address(xthread, JavaThread::held_monitor_count_offset()));