Skip to content
Closed
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
4d835b9
8315884: New Object to ObjectMonitor mapping
xmas92 Apr 15, 2024
2814350
More graceful JVMCI VM option interaction
xmas92 Jul 8, 2024
c824d2f
Revert "More graceful JVMCI VM option interaction"
xmas92 Jul 8, 2024
173b75b
Add JVMCI symbol exports
xmas92 Jul 8, 2024
ccaaef1
Update JavaThread::om_clear_monitor_cache
xmas92 Jul 9, 2024
700188c
Update LightweightSynchronizer::get_or_insert_monitor assert
xmas92 Jul 9, 2024
0b5088b
Update LightweightSynchronizer::exit assert
xmas92 Jul 9, 2024
d4a96a3
Fix BasicLock::object_monitor_cache() for other platforms
xmas92 Jul 10, 2024
d12aa5f
Add comment LightweightSynchronizer::inflate_locked_or_imse
xmas92 Jul 10, 2024
b0eef6e
Add missing inline qualifiers
xmas92 Jul 10, 2024
31503f5
Remove unused variable
xmas92 Jul 10, 2024
4fe8d4f
Fix typos
xmas92 Jul 10, 2024
a207544
Add extra comments in LightweightSynchronizer::inflate_fast_locked_ob…
xmas92 Jul 10, 2024
15997bc
Update arguments.cpp
xmas92 Jul 12, 2024
e1eb8c9
Cleanup c2 cache lookup
xmas92 Jul 12, 2024
cccffed
Avoid uniform initialization
xmas92 Jul 12, 2024
f92989f
Fix javaThread include
xmas92 Jul 14, 2024
e4786be
Remove strange comment
xmas92 Jul 14, 2024
00eef5c
Remove logStream include
xmas92 Jul 14, 2024
f43d547
Remove outdated comment LightweightSynchronizer::exit
xmas92 Jul 15, 2024
97e0c21
Fix indentation
xmas92 Jul 15, 2024
32884a5
Update assert message OMCache::set_monitor
xmas92 Jul 15, 2024
8cb27f1
Remove unused include
xmas92 Jul 15, 2024
076febb
Remove superfluous access specifier
xmas92 Jul 15, 2024
33447f9
Add explicit to single parameter constructors
xmas92 Jul 15, 2024
ebf1154
Remove try_read
xmas92 Jul 15, 2024
5ea4496
Merge tag 'jdk-24+10' into JDK-8315884
xmas92 Aug 12, 2024
a9d66a6
Revert instanceKlass.cpp comment change
xmas92 Aug 12, 2024
3515ecc
Rename _table_count to _items_count
xmas92 Aug 12, 2024
1c56bf8
Remove unnecessary assert
xmas92 Aug 12, 2024
517c300
Use [inc/dec]_no_safepoint_count directly instead of a conditionally …
xmas92 Aug 12, 2024
a8cf38a
Remove const for InflateCause parameters in lightweightSynchronizer
xmas92 Aug 12, 2024
1557468
Update comment basicLock.hpp
xmas92 Aug 12, 2024
a83e728
Rename ObjectMonitorWorld to ObjectMonitorTable
xmas92 Aug 12, 2024
937f531
Inline _table
xmas92 Aug 12, 2024
92a8836
Remove extra whitespace in UseObjectMonitorTableTest.java
xmas92 Aug 12, 2024
d020bc9
Missing DEBUG_ONLY
xmas92 Aug 12, 2024
38402a5
Remove top comment
xmas92 Aug 13, 2024
b96b916
Merge remote-tracking branch 'upstream_jdk/master' into JDK-8315884
xmas92 Aug 13, 2024
53f833b
Remove object_is_cleared
xmas92 Aug 13, 2024
1423871
Revert "Inline _table"
xmas92 Aug 13, 2024
651d64c
Make ObjectMonitorTable AllStatic
xmas92 Aug 13, 2024
123a268
Remove _omworld
xmas92 Aug 13, 2024
41fc859
Rename omworldtable_work to object_monitor_table_work
xmas92 Aug 13, 2024
7946d14
Remove the last OMWorld references
xmas92 Aug 13, 2024
68681c8
Whitespace and nits
xmas92 Aug 13, 2024
41ac7d3
Fix items count
xmas92 Aug 14, 2024
7afd245
Cleanup bytecodeInterpreter.cpp comments
xmas92 Aug 14, 2024
e5e47f4
Remove unnecessary assert
xmas92 Aug 14, 2024
690f72a
Update basicLock.inline.hpp comment
xmas92 Aug 14, 2024
c1649c7
Update globals.hpp flag description
xmas92 Aug 14, 2024
5678569
Change parameter order LightweightSynchronizer::remove_monitor
xmas92 Aug 14, 2024
bc74495
Fix lightweightSynchronize.hpp access modifier indentation
xmas92 Aug 14, 2024
e0928e5
Make lightweightSynchronizer::inflate* parameter order consistent
xmas92 Aug 14, 2024
c2a6d13
Fix lightweightSynchronizer.cpp include order
xmas92 Aug 14, 2024
15457aa
Remove extra include lightweightSynchronizer.cpp
xmas92 Aug 14, 2024
28ede7a
Fix lightweightSynchronizer.cpp access modifier indentation
xmas92 Aug 14, 2024
528e33b
lightweightSynchronizer.cpp add space between operator and operands
xmas92 Aug 14, 2024
9708828
Put `new ConcurrentTable` arguments on same line
xmas92 Aug 14, 2024
38a03e7
Update verify_monitor_get_result assert text
xmas92 Aug 14, 2024
24e78d1
Update ObjectMonitorTable::should_shrink comment
xmas92 Aug 14, 2024
7aa0919
Update logging and printing format
xmas92 Aug 14, 2024
354a651
lightweightSynchronizer.cpp add space between operator and operands
xmas92 Aug 14, 2024
f3fde37
Fix comment lightweightSynchronizer.cpp
xmas92 Aug 14, 2024
bed7676
lightweightSynchronizer.cpp fix whitespace
xmas92 Aug 14, 2024
f0e1154
Fix lockStack.hpp access modifier indentation
xmas92 Aug 14, 2024
b5114ff
Fix objectMonitor.hpp access modifier indentation
xmas92 Aug 14, 2024
488a658
Fix merge else if scopes ObjectMonitor::deflate_monitor
xmas92 Aug 14, 2024
1ecd964
Update `ObjectMonitor::install_displaced_markword_in_object` assert text
xmas92 Aug 14, 2024
09bda30
Fix serviceThread.cpp include order
xmas92 Aug 14, 2024
40fc395
Fix quick_enter parameter order
xmas92 Aug 14, 2024
0bf63df
Update `ObjectSynchronizer::FastHashCode` comment
xmas92 Aug 14, 2024
48d247d
Fix whitespace synchronizer.{inline.hpp,cpp}
xmas92 Aug 14, 2024
580e809
Revert monitors_used_above_threshold changes
xmas92 Aug 14, 2024
362f564
Fix test_objectMonitor.cpp indent
xmas92 Aug 14, 2024
b86dfd1
Align comment LockUnlock.java
xmas92 Aug 14, 2024
3f29e6d
Add and print random seed UseObjectMonitorTableTest.java
xmas92 Aug 14, 2024
4d67422
Use jdk.test.lib.Utils.getRandomInstance()
xmas92 Aug 14, 2024
e287445
Remove newline
xmas92 Aug 15, 2024
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
6 changes: 3 additions & 3 deletions src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ void BytecodeInterpreter::run(interpreterState istate) {

bool success = false;
if (LockingMode == LM_LEGACY) {
// Traditional lightweight locking.
// Traditional fast locking.
markWord displaced = rcvr->mark().set_unlocked();
mon->lock()->set_displaced_header(displaced);
success = true;
Expand Down Expand Up @@ -733,7 +733,7 @@ void BytecodeInterpreter::run(interpreterState istate) {

bool success = false;
if (LockingMode == LM_LEGACY) {
// traditional lightweight locking
// Traditional fast locking.
markWord displaced = lockee->mark().set_unlocked();
entry->lock()->set_displaced_header(displaced);
success = true;
Expand Down Expand Up @@ -1668,7 +1668,7 @@ void BytecodeInterpreter::run(interpreterState istate) {

bool success = false;
if (LockingMode == LM_LEGACY) {
// traditional lightweight locking
// Traditional fast locking.
markWord displaced = lockee->mark().set_unlocked();
entry->lock()->set_displaced_header(displaced);
success = true;
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/prims/jvmtiEnvBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,6 @@ JvmtiEnvBase::get_object_monitor_usage(JavaThread* calling_thread, jobject objec
: nullptr;

if (mon != nullptr) {
assert(mon != nullptr, "must have monitor");
// this object has a heavyweight monitor
nWant = mon->contentions(); // # of threads contending for monitor entry, but not re-entry
nWait = mon->waiters(); // # of threads waiting for notification,
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/basicLock.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ inline ObjectMonitor* BasicLock::object_monitor_cache() const {
#if defined(X86) || defined(AARCH64)
return reinterpret_cast<ObjectMonitor*>(get_metadata());
#else
// Other platforms does not make use of the cache yet,
// Other platforms do not make use of the cache yet,
// and are not as careful with maintaining the invariant
// that the metadata either is nullptr or ObjectMonitor*.
return nullptr;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/runtime/deoptimization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1660,8 +1660,8 @@ bool Deoptimization::relock_objects(JavaThread* thread, GrowableArray<MonitorInf
// was fast_locked to restore the valid lock stack.
ObjectSynchronizer::enter_for(obj, lock, deoptee_thread);
if (deoptee_thread->lock_stack().contains(obj())) {
LightweightSynchronizer::inflate_fast_locked_object(obj(), deoptee_thread, thread,
ObjectSynchronizer::InflateCause::inflate_cause_vm_internal);
LightweightSynchronizer::inflate_fast_locked_object(obj(), ObjectSynchronizer::InflateCause::inflate_cause_vm_internal,
deoptee_thread, thread);
}
assert(mon_info->owner()->is_locked(), "object must be locked now");
assert(obj->mark().has_monitor(), "must be");
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,7 @@ const int ObjectAlignmentInBytes = 8;
"monitors rather than the first word of the object.") \
\
product(int, LightweightFastLockingSpins, 13, DIAGNOSTIC, \
"Specifies the number of time lightweight fast locking will " \
"Specifies the number of times lightweight fast locking will " \
"attempt to CAS the markWord before inflating. Between each " \
"CAS it will spin for exponentially more time, resulting in " \
"a total number of spins on the order of O(2^value)") \
Expand Down
93 changes: 45 additions & 48 deletions src/hotspot/share/runtime/lightweightSynchronizer.cpp

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/hotspot/share/runtime/lightweightSynchronizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
class ObjectMonitorTable;

class LightweightSynchronizer : AllStatic {
private:
private:
static ObjectMonitor* get_or_insert_monitor_from_table(oop object, JavaThread* current, bool* inserted);
static ObjectMonitor* get_or_insert_monitor(oop object, JavaThread* current, ObjectSynchronizer::InflateCause cause);

static ObjectMonitor* add_monitor(JavaThread* current, ObjectMonitor* monitor, oop obj);
static bool remove_monitor(Thread* current, oop obj, ObjectMonitor* monitor);
static bool remove_monitor(Thread* current, ObjectMonitor* monitor, oop obj);

static void deflate_mark_word(oop object);

Expand All @@ -54,27 +54,27 @@ class LightweightSynchronizer : AllStatic {
static bool needs_resize();
static bool resize_table(JavaThread* current);

private:
private:
static inline bool fast_lock_try_enter(oop obj, LockStack& lock_stack, JavaThread* current);
static bool fast_lock_spin_enter(oop obj, LockStack& lock_stack, JavaThread* current, bool observed_deflation);

public:
public:
static void enter_for(Handle obj, BasicLock* lock, JavaThread* locking_thread);
static void enter(Handle obj, BasicLock* lock, JavaThread* current);
static void exit(oop object, JavaThread* current);

static ObjectMonitor* inflate_into_object_header(Thread* current, JavaThread* inflating_thread, oop object, ObjectSynchronizer::InflateCause cause);
static ObjectMonitor* inflate_into_object_header(oop object, ObjectSynchronizer::InflateCause cause, JavaThread* inflating_thread, Thread* current);
static ObjectMonitor* inflate_locked_or_imse(oop object, ObjectSynchronizer::InflateCause cause, TRAPS);
static ObjectMonitor* inflate_fast_locked_object(oop object, JavaThread* locking_thread, JavaThread* current, ObjectSynchronizer::InflateCause cause);
static ObjectMonitor* inflate_and_enter(oop object, JavaThread* locking_thread, JavaThread* current, ObjectSynchronizer::InflateCause cause);
static ObjectMonitor* inflate_fast_locked_object(oop object, ObjectSynchronizer::InflateCause cause, JavaThread* locking_thread, JavaThread* current);
static ObjectMonitor* inflate_and_enter(oop object, ObjectSynchronizer::InflateCause cause, JavaThread* locking_thread, JavaThread* current);

static void deflate_monitor(Thread* current, oop obj, ObjectMonitor* monitor);

static ObjectMonitor* get_monitor_from_table(Thread* current, oop obj);

static bool contains_monitor(Thread* current, ObjectMonitor* monitor);

static bool quick_enter(oop obj, JavaThread* current, BasicLock* Lock);
static bool quick_enter(oop obj, BasicLock* Lock, JavaThread* current);
};

#endif // SHARE_RUNTIME_LIGHTWEIGHTSYNCHRONIZER_HPP
12 changes: 6 additions & 6 deletions src/hotspot/share/runtime/lockStack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class LockStack {
friend class LockStackTest;
friend class VMStructs;
JVMCI_ONLY(friend class JVMCIVMStructs;)
public:
public:
static const int CAPACITY = 8;
private:
private:

// TODO: It would be very useful if JavaThread::lock_stack_offset() and friends were constexpr,
// but this is currently not the case because we're using offset_of() which is non-constexpr,
Expand Down Expand Up @@ -75,7 +75,7 @@ class LockStack {
// Given an offset (in bytes) calculate the index into the lock-stack.
static inline int to_index(uint32_t offset);

public:
public:
static ByteSize top_offset() { return byte_offset_of(LockStack, _top); }
static ByteSize base_offset() { return byte_offset_of(LockStack, _base); }

Expand Down Expand Up @@ -127,17 +127,17 @@ class LockStack {

class OMCache {
friend class VMStructs;
public:
public:
static constexpr int CAPACITY = 8;

private:
private:
struct OMCacheEntry {
oop _oop = nullptr;
ObjectMonitor* _monitor = nullptr;
} _entries[CAPACITY];
const oop _null_sentinel = nullptr;

public:
public:
static ByteSize entries_offset() { return byte_offset_of(OMCache, _entries); }
static constexpr ByteSize oop_to_oop_difference() { return in_ByteSize(sizeof(OMCacheEntry)); }
static constexpr ByteSize oop_to_monitor_difference() { return in_ByteSize(sizeof(oop)); }
Expand Down
10 changes: 4 additions & 6 deletions src/hotspot/share/runtime/objectMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,9 @@ bool ObjectMonitor::deflate_monitor(Thread* current) {

if (UseObjectMonitorTable) {
LightweightSynchronizer::deflate_monitor(current, obj, this);
} else {
if (obj != nullptr) {
// Install the old mark word if nobody else has already done it.
install_displaced_markword_in_object(obj);
}
} else if (obj != nullptr) {
// Install the old mark word if nobody else has already done it.
install_displaced_markword_in_object(obj);
}

// We leave owner == DEFLATER_MARKER and contentions < 0
Expand All @@ -679,7 +677,7 @@ bool ObjectMonitor::deflate_monitor(Thread* current) {
// monitor and by other threads that have detected a race with the
// deflation process.
void ObjectMonitor::install_displaced_markword_in_object(const oop obj) {
assert(!UseObjectMonitorTable, "Lightweight has no dmw");
assert(!UseObjectMonitorTable, "ObjectMonitorTable has no dmw");
// This function must only be called when (owner == DEFLATER_MARKER
// && contentions <= 0), but we can't guarantee that here because
// those values could change when the ObjectMonitor gets moved from
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/runtime/objectMonitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ class ObjectMonitor : public CHeapObj<mtObjectMonitor> {
// DEFLATER_MARKER must *not* have that bit set.
static const uintptr_t DEFLATER_MARKER_VALUE = 2;
#define DEFLATER_MARKER reinterpret_cast<void*>(DEFLATER_MARKER_VALUE)
public:
public:
// NOTE: Typed as uintptr_t so that we can pick it up in SA, via vmStructs.
static const uintptr_t ANONYMOUS_OWNER = 1;

private:
private:
static void* anon_owner_ptr() { return reinterpret_cast<void*>(ANONYMOUS_OWNER); }

void* volatile _owner; // pointer to owning thread OR BasicLock
Expand Down Expand Up @@ -385,7 +385,7 @@ class ObjectMonitor : public CHeapObj<mtObjectMonitor> {

// Deflation support
bool deflate_monitor(Thread* current);
private:
private:
void install_displaced_markword_in_object(const oop obj);
};

Expand All @@ -398,7 +398,7 @@ class ObjectMonitorContentionMark : StackObj {

NONCOPYABLE(ObjectMonitorContentionMark);

public:
public:
explicit ObjectMonitorContentionMark(ObjectMonitor* monitor);
~ObjectMonitorContentionMark();
};
Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/share/runtime/serviceThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@
#include "classfile/vmClasses.hpp"
#include "gc/shared/oopStorage.hpp"
#include "gc/shared/oopStorageSet.hpp"
#include "memory/universe.hpp"
#include "interpreter/oopMapCache.hpp"
#include "memory/universe.hpp"
#include "oops/oopHandle.inline.hpp"
#include "prims/jvmtiImpl.hpp"
#include "prims/jvmtiTagMap.hpp"
#include "prims/resolvedMethodTable.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/jniHandles.hpp"
#include "runtime/serviceThread.hpp"
#include "runtime/lightweightSynchronizer.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/os.hpp"
#include "prims/jvmtiImpl.hpp"
#include "prims/jvmtiTagMap.hpp"
#include "prims/resolvedMethodTable.hpp"
#include "runtime/serviceThread.hpp"
#include "services/diagnosticArgument.hpp"
#include "services/diagnosticFramework.hpp"
#include "services/finalizerService.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/sharedRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,7 @@ void SharedRuntime::monitor_enter_helper(oopDesc* obj, BasicLock* lock, JavaThre
if (!SafepointSynchronize::is_synchronizing()) {
// Only try quick_enter() if we're not trying to reach a safepoint
// so that the calling thread reaches the safepoint more quickly.
if (ObjectSynchronizer::quick_enter(obj, current, lock)) {
if (ObjectSynchronizer::quick_enter(obj, lock, current)) {
return;
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/hotspot/share/runtime/synchronizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,16 +400,15 @@ static bool useHeavyMonitors() {
// Note that we can't safely call AsyncPrintJavaStack() from within
// quick_enter() as our thread state remains _in_Java.

bool ObjectSynchronizer::quick_enter_legacy(oop obj, JavaThread* current,
BasicLock * lock) {
bool ObjectSynchronizer::quick_enter_legacy(oop obj, BasicLock* lock, JavaThread* current) {
assert(current->thread_state() == _thread_in_Java, "invariant");

if (useHeavyMonitors()) {
return false; // Slow path
}

if (LockingMode == LM_LIGHTWEIGHT) {
return LightweightSynchronizer::quick_enter(obj, current, lock);
return LightweightSynchronizer::quick_enter(obj, lock, current);
}

assert(LockingMode == LM_LEGACY, "legacy mode below");
Expand Down Expand Up @@ -680,7 +679,7 @@ void ObjectSynchronizer::jni_enter(Handle obj, JavaThread* current) {
ObjectMonitor* monitor;
bool entered;
if (LockingMode == LM_LIGHTWEIGHT) {
entered = LightweightSynchronizer::inflate_and_enter(obj(), current, current, inflate_cause_jni_enter) != nullptr;
entered = LightweightSynchronizer::inflate_and_enter(obj(), inflate_cause_jni_enter, current, current) != nullptr;
} else {
monitor = inflate(current, obj(), inflate_cause_jni_enter);
entered = monitor->enter(current);
Expand Down Expand Up @@ -974,7 +973,7 @@ static intptr_t install_hash_code(Thread* current, oop obj) {
assert(UseObjectMonitorTable && LockingMode == LM_LIGHTWEIGHT, "must be");

markWord mark = obj->mark_acquire();
for(;;) {
for (;;) {
intptr_t hash = mark.hash();
if (hash != 0) {
return hash;
Expand All @@ -992,8 +991,9 @@ static intptr_t install_hash_code(Thread* current, oop obj) {
}

intptr_t ObjectSynchronizer::FastHashCode(Thread* current, oop obj) {
// Since the monitor isn't in the object header, it can simply be installed.
if (UseObjectMonitorTable) {
// Since the monitor isn't in the object header, the hash can simply be
// installed in the object header.
return install_hash_code(current, obj);
}

Expand Down Expand Up @@ -1268,7 +1268,7 @@ static bool monitors_used_above_threshold(MonitorList* list) {
if (NoAsyncDeflationProgressMax != 0 &&
_no_progress_cnt >= NoAsyncDeflationProgressMax) {
double remainder = (100.0 - MonitorUsedDeflationThreshold) / 100.0;
size_t new_ceiling = ceiling / remainder + 1;
size_t new_ceiling = ceiling + (size_t)((double)ceiling * remainder) + 1;
ObjectSynchronizer::set_in_use_list_ceiling(new_ceiling);
log_info(monitorinflation)("Too many deflations without progress; "
"bumping in_use_list_ceiling from " SIZE_FORMAT
Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/share/runtime/synchronizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class ObjectSynchronizer : AllStatic {
// inflated monitor enter.
static bool enter_fast_impl(Handle obj, BasicLock* lock, JavaThread* locking_thread);

static bool quick_enter_legacy(oop obj, JavaThread* current, BasicLock* Lock);
static bool quick_enter_legacy(oop obj, BasicLock* Lock, JavaThread* current);
static void enter_legacy(Handle obj, BasicLock* Lock, JavaThread* current);
static void exit_legacy(oop obj, BasicLock* lock, JavaThread* current);
public:
Expand All @@ -123,7 +123,8 @@ class ObjectSynchronizer : AllStatic {
static void notifyall(Handle obj, TRAPS);

static bool quick_notify(oopDesc* obj, JavaThread* current, bool All);
static inline bool quick_enter(oop obj, JavaThread* current, BasicLock* Lock);

static inline bool quick_enter(oop obj, BasicLock* Lock, JavaThread* current);

// Special internal-use-only method for use by JVM infrastructure
// that needs to wait() on a java-level object but that can't risk
Expand Down
8 changes: 3 additions & 5 deletions src/hotspot/share/runtime/synchronizer.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ inline void ObjectSynchronizer::enter(Handle obj, BasicLock* lock, JavaThread* c
}
}

inline bool ObjectSynchronizer::quick_enter(oop obj, JavaThread* current,
BasicLock * lock) {
inline bool ObjectSynchronizer::quick_enter(oop obj, BasicLock* lock, JavaThread* current) {
assert(current->thread_state() == _thread_in_Java, "invariant");
NoSafepointVerifier nsv;
if (obj == nullptr) return false; // Need to throw NPE
Expand All @@ -63,9 +62,9 @@ inline bool ObjectSynchronizer::quick_enter(oop obj, JavaThread* current,
}

if (LockingMode == LM_LIGHTWEIGHT) {
return LightweightSynchronizer::quick_enter(obj, current, lock);
return LightweightSynchronizer::quick_enter(obj, lock, current);
} else {
return quick_enter_legacy(obj, current, lock);
return quick_enter_legacy(obj, lock, current);
}
}

Expand All @@ -79,5 +78,4 @@ inline void ObjectSynchronizer::exit(oop object, BasicLock* lock, JavaThread* cu
}
}


#endif // SHARE_RUNTIME_SYNCHRONIZER_INLINE_HPP
12 changes: 6 additions & 6 deletions test/hotspot/gtest/runtime/test_objectMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ TEST_VM(ObjectMonitor, sanity) {
if (cache_line_size != 0) {

EXPECT_EQ(in_bytes(ObjectMonitor::metadata_offset()), 0)
<< "_metadata at a non 0 offset. metadata_offset = "
<< in_bytes(ObjectMonitor::metadata_offset());
<< "_metadata at a non 0 offset. metadata_offset = "
<< in_bytes(ObjectMonitor::metadata_offset());

EXPECT_GE((size_t) in_bytes(ObjectMonitor::owner_offset()), cache_line_size)
<< "the _metadata and _owner fields are closer "
<< "than a cache line which permits false sharing.";
<< "the _metadata and _owner fields are closer "
<< "than a cache line which permits false sharing.";

EXPECT_GE((size_t) in_bytes(ObjectMonitor::recursions_offset() - ObjectMonitor::owner_offset()), cache_line_size)
<< "the _owner and _recursions fields are closer "
<< "than a cache line which permits false sharing.";
<< "the _owner and _recursions fields are closer "
<< "than a cache line which permits false sharing.";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ void syncPoint() {
}
}
public void run() {
System.out.println("RandomDepthTest started.");
final long seed = random.nextLong();
random.setSeed(seed);
System.out.println("RandomDepthTest started. Random seed: " + seed);
for (int t = 0; t < THREADS; t++) {
TF.newThread(() -> {
syncPoint();
Expand Down
2 changes: 1 addition & 1 deletion test/micro/org/openjdk/bench/vm/lang/LockUnlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void testInflatedSerialLockUnlockLocal() {
}
}

/** Perform two synchronized after each other on the same object. */
/** Perform two synchronized after each other on the same object. */
@Benchmark
public void testInflatedSerialLockUnlock() {
for (int i = 0; i < innerCount; i++) {
Expand Down