From c7a82c454027225783f978d563c22cd6bcd5f312 Mon Sep 17 00:00:00 2001 From: Patricio Chilano Mateo Date: Thu, 24 Oct 2024 16:22:12 -0400 Subject: [PATCH] Rename set/has_owner_anonymous to set/has_anonymous_owner --- .../share/runtime/lightweightSynchronizer.cpp | 14 +++++++------- src/hotspot/share/runtime/objectMonitor.hpp | 4 ++-- src/hotspot/share/runtime/objectMonitor.inline.hpp | 2 +- src/hotspot/share/runtime/synchronizer.cpp | 6 +++--- src/hotspot/share/runtime/threads.cpp | 2 +- src/hotspot/share/runtime/vmOperations.cpp | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/hotspot/share/runtime/lightweightSynchronizer.cpp b/src/hotspot/share/runtime/lightweightSynchronizer.cpp index 5509ef8226ef5..c21b8946ce741 100644 --- a/src/hotspot/share/runtime/lightweightSynchronizer.cpp +++ b/src/hotspot/share/runtime/lightweightSynchronizer.cpp @@ -344,7 +344,7 @@ ObjectMonitor* LightweightSynchronizer::get_or_insert_monitor_from_table(oop obj } ObjectMonitor* alloced_monitor = new ObjectMonitor(object); - alloced_monitor->set_owner_anonymous(); + alloced_monitor->set_anonymous_owner(); // Try insert monitor monitor = add_monitor(current, alloced_monitor, object); @@ -741,7 +741,7 @@ void LightweightSynchronizer::exit(oop object, JavaThread* current) { assert(mark.has_monitor(), "must be"); // The monitor exists ObjectMonitor* monitor = ObjectSynchronizer::read_monitor(current, object, mark); - if (monitor->has_owner_anonymous()) { + if (monitor->has_anonymous_owner()) { assert(current->lock_stack().contains(object), "current must have object on its lock stack"); monitor->set_owner_from_anonymous(current); monitor->set_recursions(current->lock_stack().remove(object) - 1); @@ -786,7 +786,7 @@ ObjectMonitor* LightweightSynchronizer::inflate_locked_or_imse(oop obj, ObjectSy assert(mark.has_monitor(), "must be"); ObjectMonitor* monitor = ObjectSynchronizer::read_monitor(current, obj, mark); if (monitor != nullptr) { - if (monitor->has_owner_anonymous()) { + if (monitor->has_anonymous_owner()) { LockStack& lock_stack = current->lock_stack(); if (lock_stack.contains(obj)) { // Current thread owns the lock but someone else inflated it. @@ -834,7 +834,7 @@ ObjectMonitor* LightweightSynchronizer::inflate_into_object_header(oop object, O ObjectMonitor* inf = mark.monitor(); markWord dmw = inf->header(); assert(dmw.is_neutral(), "invariant: header=" INTPTR_FORMAT, dmw.value()); - if (inf->has_owner_anonymous() && + if (inf->has_anonymous_owner() && inflating_thread != nullptr && inflating_thread->lock_stack().contains(object)) { inf->set_owner_from_anonymous(inflating_thread); size_t removed = inflating_thread->lock_stack().remove(object); @@ -862,7 +862,7 @@ ObjectMonitor* LightweightSynchronizer::inflate_into_object_header(oop object, O monitor->set_owner(inflating_thread); } else { // Owned by somebody else. - monitor->set_owner_anonymous(); + monitor->set_anonymous_owner(); } markWord monitor_mark = markWord::encode(monitor); markWord old_mark = object->cas_set_mark(monitor_mark, mark); @@ -952,7 +952,7 @@ ObjectMonitor* LightweightSynchronizer::inflate_fast_locked_object(oop object, O // ObjectMonitors are always inserted as anonymously owned, this thread is // the current holder of the monitor. So unless the entry is stale and // contains a deflating monitor it must be anonymously owned. - if (monitor->has_owner_anonymous()) { + if (monitor->has_anonymous_owner()) { // The monitor must be anonymously owned if it was added assert(monitor == get_monitor_from_table(current, object), "The monitor must be found"); // New fresh monitor @@ -1073,7 +1073,7 @@ ObjectMonitor* LightweightSynchronizer::inflate_and_enter(oop object, ObjectSync // CASE: inflated if (mark.has_monitor()) { LockStack& lock_stack = locking_thread->lock_stack(); - if (monitor->has_owner_anonymous() && lock_stack.contains(object)) { + if (monitor->has_anonymous_owner() && lock_stack.contains(object)) { // The lock is fast-locked by the locking thread, // convert it to a held monitor with a known owner. monitor->set_owner_from_anonymous(locking_thread); diff --git a/src/hotspot/share/runtime/objectMonitor.hpp b/src/hotspot/share/runtime/objectMonitor.hpp index 355756c87c7b7..1039a0b570750 100644 --- a/src/hotspot/share/runtime/objectMonitor.hpp +++ b/src/hotspot/share/runtime/objectMonitor.hpp @@ -320,8 +320,8 @@ class ObjectMonitor : public CHeapObj { return try_set_owner_from(NO_OWNER, thread) == NO_OWNER; } - bool has_owner_anonymous() const { return owner_raw() == ANONYMOUS_OWNER; } - void set_owner_anonymous() { + bool has_anonymous_owner() const { return owner_raw() == ANONYMOUS_OWNER; } + void set_anonymous_owner() { set_owner_from_raw(NO_OWNER, ANONYMOUS_OWNER); } void set_owner_from_anonymous(JavaThread* owner) { diff --git a/src/hotspot/share/runtime/objectMonitor.inline.hpp b/src/hotspot/share/runtime/objectMonitor.inline.hpp index 64bb15a4a63c0..2074535486a20 100644 --- a/src/hotspot/share/runtime/objectMonitor.inline.hpp +++ b/src/hotspot/share/runtime/objectMonitor.inline.hpp @@ -52,7 +52,7 @@ inline int64_t ObjectMonitor::owner_from(oop vthread) { } inline bool ObjectMonitor::is_entered(JavaThread* current) const { - if (has_owner_anonymous()) { + if (has_anonymous_owner()) { if (LockingMode == LM_LIGHTWEIGHT) { return current->lock_stack().contains(object()); } else { diff --git a/src/hotspot/share/runtime/synchronizer.cpp b/src/hotspot/share/runtime/synchronizer.cpp index e1fcd955be34e..82ea8904b65e5 100644 --- a/src/hotspot/share/runtime/synchronizer.cpp +++ b/src/hotspot/share/runtime/synchronizer.cpp @@ -657,7 +657,7 @@ void ObjectSynchronizer::exit_legacy(oop object, BasicLock* lock, JavaThread* cu // The ObjectMonitor* can't be async deflated until ownership is // dropped inside exit() and the ObjectMonitor* must be !is_busy(). ObjectMonitor* monitor = inflate(current, object, inflate_cause_vm_internal); - assert(!monitor->has_owner_anonymous(), "must not be"); + assert(!monitor->has_anonymous_owner(), "must not be"); monitor->exit(current); } @@ -1464,7 +1464,7 @@ ObjectMonitor* ObjectSynchronizer::inflate_impl(JavaThread* inflating_thread, oo ObjectMonitor* inf = mark.monitor(); markWord dmw = inf->header(); assert(dmw.is_neutral(), "invariant: header=" INTPTR_FORMAT, dmw.value()); - if (inf->has_owner_anonymous() && inflating_thread != nullptr) { + if (inf->has_anonymous_owner() && inflating_thread != nullptr) { assert(LockingMode == LM_LEGACY, "invariant"); if (inflating_thread->is_lock_owned((address)inf->stack_locker())) { inf->set_stack_locker(nullptr); @@ -1556,7 +1556,7 @@ ObjectMonitor* ObjectSynchronizer::inflate_impl(JavaThread* inflating_thread, oo // Use ANONYMOUS_OWNER to indicate that the owner is the BasicLock on the stack, // and set the stack locker field in the monitor. m->set_stack_locker(mark.locker()); - m->set_owner_anonymous(); // second + m->set_anonymous_owner(); // second } // TODO-FIXME: assert BasicLock->dhw != 0. diff --git a/src/hotspot/share/runtime/threads.cpp b/src/hotspot/share/runtime/threads.cpp index 83cc85bf4a44c..7d0685902c5eb 100644 --- a/src/hotspot/share/runtime/threads.cpp +++ b/src/hotspot/share/runtime/threads.cpp @@ -1265,7 +1265,7 @@ JavaThread* Threads::owning_thread_from_object(ThreadsList * t_list, oop obj) { } JavaThread* Threads::owning_thread_from_monitor(ThreadsList* t_list, ObjectMonitor* monitor) { - if (monitor->has_owner_anonymous()) { + if (monitor->has_anonymous_owner()) { if (LockingMode == LM_LIGHTWEIGHT) { return owning_thread_from_object(t_list, monitor->object()); } else { diff --git a/src/hotspot/share/runtime/vmOperations.cpp b/src/hotspot/share/runtime/vmOperations.cpp index 9c0833fe74d46..1f5d63a917e74 100644 --- a/src/hotspot/share/runtime/vmOperations.cpp +++ b/src/hotspot/share/runtime/vmOperations.cpp @@ -350,7 +350,7 @@ class ObjectMonitorsDump : public MonitorClosure, public ObjectMonitorsView { void do_monitor(ObjectMonitor* monitor) override { assert(monitor->has_owner(), "Expects only owned monitors"); - if (monitor->has_owner_anonymous()) { + if (monitor->has_anonymous_owner()) { // There's no need to collect anonymous owned monitors // because the caller of this code is only interested // in JNI owned monitors.