Skip to content

Commit

Permalink
8229844: Remove attempt_rebias parameter from revoke_and_rebias()
Browse files Browse the repository at this point in the history
Removed attempt_rebias parameter and merged fast_enter() and slow_enter() into enter()

Reviewed-by: dholmes, rehn, coleenp, dcubed
  • Loading branch information
pchilano committed Aug 27, 2019
1 parent 7021999 commit 85dbabe
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 250 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/aarch64.ad
Original file line number Diff line number Diff line change
Expand Up @@ -3569,7 +3569,7 @@ encode %{
// Store a non-null value into the box to avoid looking like a re-entrant
// lock. The fast-path monitor unlock code checks for
// markWord::monitor_value so use markWord::unused_mark which has the
// relevant bit set, and also matches ObjectSynchronizer::slow_enter.
// relevant bit set, and also matches ObjectSynchronizer::enter.
__ mov(tmp, (address)markWord::unused_mark().value());
__ str(tmp, Address(box, BasicLock::displaced_header_offset_in_bytes()));

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/sparc/macroAssembler_sparc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2607,8 +2607,8 @@ void MacroAssembler::biased_locking_exit (Address mark_addr, Register temp_reg,
// - Successful Stack-lock: box->dhw == mark.
// box->dhw must contain the displaced mark word value
// - Failure -- icc.ZFlag == 0 and box->dhw is undefined.
// The slow-path fast_enter() and slow_enter() operators
// are responsible for setting box->dhw = NonZero (typically markWord::unused_mark()).
// The slow-path enter() is responsible for setting
// box->dhw = NonZero (typically markWord::unused_mark()).
// - Biased: box->dhw is undefined
//
// SPARC refworkload performance - specifically jetstream and scimark - are
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/x86/macroAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1620,8 +1620,8 @@ void MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Regi
// See also: cmpFastLock and cmpFastUnlock.
//
// What follows is a specialized inline transliteration of the code
// in slow_enter() and slow_exit(). If we're concerned about I$ bloat
// another option would be to emit TrySlowEnter and TrySlowExit methods
// in enter() and exit(). If we're concerned about I$ bloat another
// option would be to emit TrySlowEnter and TrySlowExit methods
// at startup-time. These methods would accept arguments as
// (rax,=Obj, rbx=Self, rcx=box, rdx=Scratch) and return success-failure
// indications in the icc.ZFlag. Fast_Lock and Fast_Unlock would simply
Expand Down
23 changes: 5 additions & 18 deletions src/hotspot/share/c1/c1_Runtime1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,19 +705,11 @@ JRT_ENTRY_NO_ASYNC(void, Runtime1::monitorenter(JavaThread* thread, oopDesc* obj
Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
}
Handle h_obj(thread, obj);
if (UseBiasedLocking) {
// Retry fast entry if bias is revoked to avoid unnecessary inflation
ObjectSynchronizer::fast_enter(h_obj, lock->lock(), true, CHECK);
} else {
if (UseFastLocking) {
// When using fast locking, the compiled code has already tried the fast case
assert(obj == lock->obj(), "must match");
ObjectSynchronizer::slow_enter(h_obj, lock->lock(), THREAD);
} else {
lock->set_obj(obj);
ObjectSynchronizer::fast_enter(h_obj, lock->lock(), false, THREAD);
}
if (!UseFastLocking) {
lock->set_obj(obj);
}
assert(obj == lock->obj(), "must match");
ObjectSynchronizer::enter(h_obj, lock->lock(), THREAD);
JRT_END


Expand All @@ -730,12 +722,7 @@ JRT_LEAF(void, Runtime1::monitorexit(JavaThread* thread, BasicObjectLock* lock))

oop obj = lock->obj();
assert(oopDesc::is_oop(obj), "must be NULL or an object");
if (UseFastLocking) {
// When using fast locking, the compiled code has already tried the fast case
ObjectSynchronizer::slow_exit(obj, lock->lock(), THREAD);
} else {
ObjectSynchronizer::fast_exit(obj, lock->lock(), THREAD);
}
ObjectSynchronizer::exit(obj, lock->lock(), THREAD);
JRT_END

// Cf. OptoRuntime::deoptimize_caller_frame
Expand Down
9 changes: 2 additions & 7 deletions src/hotspot/share/interpreter/interpreterRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,12 +771,7 @@ JRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorenter(JavaThread* thread, Ba
Handle h_obj(thread, elem->obj());
assert(Universe::heap()->is_in_reserved_or_null(h_obj()),
"must be NULL or an object");
if (UseBiasedLocking) {
// Retry fast entry if bias is revoked to avoid unnecessary inflation
ObjectSynchronizer::fast_enter(h_obj, elem->lock(), true, CHECK);
} else {
ObjectSynchronizer::slow_enter(h_obj, elem->lock(), CHECK);
}
ObjectSynchronizer::enter(h_obj, elem->lock(), CHECK);
assert(Universe::heap()->is_in_reserved_or_null(elem->obj()),
"must be NULL or an object");
#ifdef ASSERT
Expand All @@ -796,7 +791,7 @@ JRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorexit(JavaThread* thread, Bas
if (elem == NULL || h_obj()->is_unlocked()) {
THROW(vmSymbols::java_lang_IllegalMonitorStateException());
}
ObjectSynchronizer::slow_exit(h_obj(), elem->lock(), thread);
ObjectSynchronizer::exit(h_obj(), elem->lock(), thread);
// Free entry. This must be done here, since a pending exception might be installed on
// exit. If it is not cleared, the exception handling code will try to unlock the monitor again.
elem->set_obj(NULL);
Expand Down
19 changes: 2 additions & 17 deletions src/hotspot/share/jvmci/jvmciRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,17 +394,7 @@ JRT_ENTRY_NO_ASYNC(void, JVMCIRuntime::monitorenter(JavaThread* thread, oopDesc*
}
Handle h_obj(thread, obj);
assert(oopDesc::is_oop(h_obj()), "must be NULL or an object");
if (UseBiasedLocking) {
// Retry fast entry if bias is revoked to avoid unnecessary inflation
ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK);
} else {
if (JVMCIUseFastLocking) {
// When using fast locking, the compiled code has already tried the fast case
ObjectSynchronizer::slow_enter(h_obj, lock, THREAD);
} else {
ObjectSynchronizer::fast_enter(h_obj, lock, false, THREAD);
}
}
ObjectSynchronizer::enter(h_obj, lock, THREAD);
TRACE_jvmci_3("%s: exiting locking slow with obj=" INTPTR_FORMAT, thread->name(), p2i(obj));
JRT_END

Expand All @@ -426,12 +416,7 @@ JRT_LEAF(void, JVMCIRuntime::monitorexit(JavaThread* thread, oopDesc* obj, Basic
}
#endif

if (JVMCIUseFastLocking) {
// When using fast locking, the compiled code has already tried the fast case
ObjectSynchronizer::slow_exit(obj, lock, THREAD);
} else {
ObjectSynchronizer::fast_exit(obj, lock, THREAD);
}
ObjectSynchronizer::exit(obj, lock, THREAD);
IF_TRACE_jvmci_3 {
char type[O_BUFLEN];
obj->klass()->name()->as_C_string(type, O_BUFLEN);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/prims/jvmtiEnvBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ JvmtiEnvBase::get_object_monitor_usage(JavaThread* calling_thread, jobject objec
if (at_safepoint) {
BiasedLocking::revoke_at_safepoint(hobj);
} else {
BiasedLocking::revoke_and_rebias(hobj, false, calling_thread);
BiasedLocking::revoke(hobj, calling_thread);
}

address owner = NULL;
Expand Down
Loading

0 comments on commit 85dbabe

Please sign in to comment.