8307532: Implement LM_LIGHTWEIGHT for Zero
Reviewed-by: aboldtch, jwaters
This commit is contained in:
parent
855c8a7def
commit
5e9800721a
@ -116,11 +116,6 @@ void VM_Version::initialize() {
|
||||
FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false);
|
||||
}
|
||||
|
||||
if ((LockingMode != LM_LEGACY) && (LockingMode != LM_MONITOR)) {
|
||||
warning("Unsupported locking mode for this CPU.");
|
||||
FLAG_SET_DEFAULT(LockingMode, LM_LEGACY);
|
||||
}
|
||||
|
||||
// Enable error context decoding on known platforms
|
||||
#if defined(IA32) || defined(AMD64) || defined(ARM) || \
|
||||
defined(AARCH64) || defined(PPC) || defined(RISCV) || \
|
||||
|
@ -485,26 +485,30 @@ int ZeroInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
|
||||
|
||||
// Unlock if necessary
|
||||
if (monitor) {
|
||||
BasicLock *lock = monitor->lock();
|
||||
markWord header = lock->displaced_header();
|
||||
oop rcvr = monitor->obj();
|
||||
monitor->set_obj(nullptr);
|
||||
|
||||
bool dec_monitor_count = true;
|
||||
if (header.to_pointer() != nullptr) {
|
||||
markWord old_header = markWord::encode(lock);
|
||||
if (rcvr->cas_set_mark(header, old_header) != old_header) {
|
||||
monitor->set_obj(rcvr);
|
||||
dec_monitor_count = false;
|
||||
InterpreterRuntime::monitorexit(monitor);
|
||||
bool success = false;
|
||||
if (LockingMode == LM_LEGACY) {
|
||||
BasicLock* lock = monitor->lock();
|
||||
oop rcvr = monitor->obj();
|
||||
monitor->set_obj(nullptr);
|
||||
success = true;
|
||||
markWord header = lock->displaced_header();
|
||||
if (header.to_pointer() != nullptr) { // Check for recursive lock
|
||||
markWord old_header = markWord::encode(lock);
|
||||
if (rcvr->cas_set_mark(header, old_header) != old_header) {
|
||||
monitor->set_obj(rcvr);
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
if (success) {
|
||||
THREAD->dec_held_monitor_count();
|
||||
}
|
||||
}
|
||||
if (dec_monitor_count) {
|
||||
THREAD->dec_held_monitor_count();
|
||||
if (!success) {
|
||||
InterpreterRuntime::monitorexit(monitor);
|
||||
}
|
||||
}
|
||||
|
||||
unwind_and_return:
|
||||
unwind_and_return:
|
||||
|
||||
// Unwind the current activation
|
||||
thread->pop_zero_frame();
|
||||
|
@ -1817,17 +1817,6 @@ bool Arguments::check_vm_args_consistency() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(X86) && !defined(AARCH64) && !defined(RISCV64) && !defined(ARM) && !defined(PPC64) && !defined(S390)
|
||||
if (LockingMode == LM_LIGHTWEIGHT) {
|
||||
FLAG_SET_CMDLINE(LockingMode, LM_LEGACY);
|
||||
warning("New lightweight locking not supported on this platform");
|
||||
}
|
||||
if (UseObjectMonitorTable) {
|
||||
FLAG_SET_CMDLINE(UseObjectMonitorTable, false);
|
||||
warning("UseObjectMonitorTable not supported on this platform");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (UseObjectMonitorTable && LockingMode != LM_LIGHTWEIGHT) {
|
||||
// ObjectMonitorTable requires lightweight locking.
|
||||
FLAG_SET_CMDLINE(UseObjectMonitorTable, false);
|
||||
|
@ -39,7 +39,7 @@ inline void BasicLock::set_displaced_header(markWord header) {
|
||||
|
||||
inline ObjectMonitor* BasicLock::object_monitor_cache() const {
|
||||
assert(UseObjectMonitorTable, "must be");
|
||||
#if defined(X86) || defined(AARCH64) || defined(RISCV64) || defined(PPC64) || defined(S390)
|
||||
#if !defined(ZERO) && (defined(X86) || defined(AARCH64) || defined(RISCV64) || defined(PPC64) || defined(S390))
|
||||
return reinterpret_cast<ObjectMonitor*>(get_metadata());
|
||||
#else
|
||||
// Other platforms do not make use of the cache yet,
|
||||
|
Loading…
Reference in New Issue
Block a user