Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8307532: Implement LM_LIGHTWEIGHT for Zero #21220

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/hotspot/cpu/zero/vm_version_zero.cpp
Original file line number Diff line number Diff line change
@@ -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) || \
34 changes: 19 additions & 15 deletions src/hotspot/cpu/zero/zeroInterpreter_zero.cpp
Original file line number Diff line number Diff line change
@@ -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();
11 changes: 0 additions & 11 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/basicLock.inline.hpp
Original file line number Diff line number Diff line change
@@ -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,