Skip to content

Commit

Permalink
8319900: Recursive lightweight locking: riscv64 implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
zifeihan committed Jan 24, 2024
1 parent 5a74c2a commit 6f42bf9
Show file tree
Hide file tree
Showing 9 changed files with 427 additions and 145 deletions.
11 changes: 5 additions & 6 deletions src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,17 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr
lwu(hdr, Address(hdr, Klass::access_flags_offset()));
test_bit(temp, hdr, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
bnez(temp, slow_case, true /* is_far */);
} else if (LockingMode == LM_LIGHTWEIGHT) {
// null check obj. load_klass performs load if DiagnoseSyncOnValueBasedClasses != 0.
ld(hdr, Address(obj));
}

// Load object header
ld(hdr, Address(obj, hdr_offset));

if (LockingMode == LM_LIGHTWEIGHT) {
lightweight_lock(obj, hdr, temp, t1, slow_case);
} else if (LockingMode == LM_LEGACY) {
Label done;
// Load object header
ld(hdr, Address(obj, hdr_offset));
// and mark it as unlocked
ori(hdr, hdr, markWord::unlocked_value);
// save unlocked object header into the displaced header location on the stack
Expand Down Expand Up @@ -134,9 +136,6 @@ void C1_MacroAssembler::unlock_object(Register hdr, Register obj, Register disp_
verify_oop(obj);

if (LockingMode == LM_LIGHTWEIGHT) {
ld(hdr, Address(obj, oopDesc::mark_offset_in_bytes()));
test_bit(temp, hdr, exact_log2(markWord::monitor_value));
bnez(temp, slow_case, /* is_far */ true);
lightweight_unlock(obj, hdr, temp, t1, slow_case);
} else if (LockingMode == LM_LEGACY) {
// test if object header is pointing to the displaced header, and if so, restore
Expand Down
Loading

0 comments on commit 6f42bf9

Please sign in to comment.