< prev index next > src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp
Print this page
}
{ // Handle inflated monitor.
bind(inflated);
- // mark contains the tagged ObjectMonitor*.
- const Register tmp1_tagged_monitor = tmp1_mark;
- const uintptr_t monitor_tag = markWord::monitor_value;
- const Register tmp2_owner_addr = tmp2;
- const Register tmp3_owner = tmp3;
-
- // Compute owner address.
- la(tmp2_owner_addr, Address(tmp1_tagged_monitor, (in_bytes(ObjectMonitor::owner_offset()) - monitor_tag)));
-
- // CAS owner (null => current thread).
- cmpxchg(/*addr*/ tmp2_owner_addr, /*expected*/ zr, /*new*/ xthread, Assembler::int64,
- /*acquire*/ Assembler::aq, /*release*/ Assembler::relaxed, /*result*/ tmp3_owner);
- beqz(tmp3_owner, locked);
-
- // Check if recursive.
- bne(tmp3_owner, xthread, slow_path);
-
- // Recursive.
- increment(Address(tmp1_tagged_monitor, in_bytes(ObjectMonitor::recursions_offset()) - monitor_tag), 1, tmp2, tmp3);
+ if (!UseObjectMonitorTable) {
+ // mark contains the tagged ObjectMonitor*.
+ const Register tmp1_tagged_monitor = tmp1_mark;
+ const uintptr_t monitor_tag = markWord::monitor_value;
+ const Register tmp2_owner_addr = tmp2;
+ const Register tmp3_owner = tmp3;
+
+ // Compute owner address.
+ la(tmp2_owner_addr, Address(tmp1_tagged_monitor, (in_bytes(ObjectMonitor::owner_offset()) - monitor_tag)));
+
+ // CAS owner (null => current thread).
+ cmpxchg(/*addr*/ tmp2_owner_addr, /*expected*/ zr, /*new*/ xthread, Assembler::int64,
+ /*acquire*/ Assembler::aq, /*release*/ Assembler::relaxed, /*result*/ tmp3_owner);
+ beqz(tmp3_owner, locked);
+
+ // Check if recursive.
+ bne(tmp3_owner, xthread, slow_path);
+
+ // Recursive.
+ increment(Address(tmp1_tagged_monitor, in_bytes(ObjectMonitor::recursions_offset()) - monitor_tag), 1, tmp2, tmp3);
+ } else {
+ // OMCache lookup not supported yet. Take the slowpath.
+ j(slow_path);
+ }
}
bind(locked);
mv(flag, zr);
increment(Address(xthread, JavaThread::held_monitor_count_offset()), 1, tmp2, tmp3);
bne(obj, tmp3_t, inflated);
stop("Fast Unlock lock on stack");
bind(check_done);
#endif
- // mark contains the tagged ObjectMonitor*.
- const Register tmp1_monitor = tmp1_mark;
- const uintptr_t monitor_tag = markWord::monitor_value;
-
- // Untag the monitor.
- sub(tmp1_monitor, tmp1_mark, monitor_tag);
-
- const Register tmp2_recursions = tmp2;
- Label not_recursive;
-
- // Check if recursive.
- ld(tmp2_recursions, Address(tmp1_monitor, ObjectMonitor::recursions_offset()));
- beqz(tmp2_recursions, not_recursive);
-
- // Recursive unlock.
- addi(tmp2_recursions, tmp2_recursions, -1);
- sd(tmp2_recursions, Address(tmp1_monitor, ObjectMonitor::recursions_offset()));
- j(unlocked);
-
- bind(not_recursive);
-
- Label release;
- const Register tmp2_owner_addr = tmp2;
-
- // Compute owner address.
- la(tmp2_owner_addr, Address(tmp1_monitor, ObjectMonitor::owner_offset()));
-
- // Check if the entry lists are empty.
- ld(t0, Address(tmp1_monitor, ObjectMonitor::EntryList_offset()));
- ld(tmp3_t, Address(tmp1_monitor, ObjectMonitor::cxq_offset()));
- orr(t0, t0, tmp3_t);
- beqz(t0, release);
-
- // The owner may be anonymous and we removed the last obj entry in
- // the lock-stack. This loses the information about the owner.
- // Write the thread to the owner field so the runtime knows the owner.
- sd(xthread, Address(tmp2_owner_addr));
- j(slow_path);
-
- bind(release);
- // Set owner to null.
- membar(MacroAssembler::LoadStore | MacroAssembler::StoreStore);
- sd(zr, Address(tmp2_owner_addr));
+ if (!UseObjectMonitorTable) {
+ // mark contains the tagged ObjectMonitor*.
+ const Register tmp1_monitor = tmp1_mark;
+ const uintptr_t monitor_tag = markWord::monitor_value;
+
+ // Untag the monitor.
+ sub(tmp1_monitor, tmp1_mark, monitor_tag);
+
+ const Register tmp2_recursions = tmp2;
+ Label not_recursive;
+
+ // Check if recursive.
+ ld(tmp2_recursions, Address(tmp1_monitor, ObjectMonitor::recursions_offset()));
+ beqz(tmp2_recursions, not_recursive);
+
+ // Recursive unlock.
+ addi(tmp2_recursions, tmp2_recursions, -1);
+ sd(tmp2_recursions, Address(tmp1_monitor, ObjectMonitor::recursions_offset()));
+ j(unlocked);
+
+ bind(not_recursive);
+
+ Label release;
+ const Register tmp2_owner_addr = tmp2;
+
+ // Compute owner address.
+ la(tmp2_owner_addr, Address(tmp1_monitor, ObjectMonitor::owner_offset()));
+
+ // Check if the entry lists are empty.
+ ld(t0, Address(tmp1_monitor, ObjectMonitor::EntryList_offset()));
+ ld(tmp3_t, Address(tmp1_monitor, ObjectMonitor::cxq_offset()));
+ orr(t0, t0, tmp3_t);
+ beqz(t0, release);
+
+ // The owner may be anonymous and we removed the last obj entry in
+ // the lock-stack. This loses the information about the owner.
+ // Write the thread to the owner field so the runtime knows the owner.
+ sd(xthread, Address(tmp2_owner_addr));
+ j(slow_path);
+
+ bind(release);
+ // Set owner to null.
+ membar(MacroAssembler::LoadStore | MacroAssembler::StoreStore);
+ sd(zr, Address(tmp2_owner_addr));
+ } else {
+ // OMCache lookup not supported yet. Take the slowpath.
+ j(slow_path);
+ }
}
bind(unlocked);
mv(flag, zr);
decrement(Address(xthread, JavaThread::held_monitor_count_offset()), 1, tmp2, tmp3);
< prev index next >