8077392: Stream fork/join tasks occasionally fail to complete

8131715: backout the fix for JDK-8079359 when JDK-8077392 is fixed

Add missing BasicLock::_displaced_header init to ObjectSynchronizer::quick_enter() and re-enable Contended Locked "fast enter" bucket.

Reviewed-by: gthornbr, dholmes, kvn, cvarming, acorn
This commit is contained in:
Daniel D. Daugherty 2016-04-04 14:41:00 -07:00
parent 5cef85023b
commit 66570c722b
2 changed files with 15 additions and 3 deletions

View file

@ -1969,8 +1969,8 @@ JRT_END
// Handles the uncommon case in locking, i.e., contention or an inflated lock. // Handles the uncommon case in locking, i.e., contention or an inflated lock.
JRT_BLOCK_ENTRY(void, SharedRuntime::complete_monitor_locking_C(oopDesc* _obj, BasicLock* lock, JavaThread* thread)) JRT_BLOCK_ENTRY(void, SharedRuntime::complete_monitor_locking_C(oopDesc* _obj, BasicLock* lock, JavaThread* thread))
// Disable ObjectSynchronizer::quick_enter() in default config // Disable ObjectSynchronizer::quick_enter() in default config
// until JDK-8077392 is resolved. // on AARCH64 until JDK-8153107 is resolved.
if ((SyncFlags & 256) != 0 && !SafepointSynchronize::is_synchronizing()) { if (AARCH64_ONLY((SyncFlags & 256) != 0 &&) !SafepointSynchronize::is_synchronizing()) {
// Only try quick_enter() if we're not trying to reach a safepoint // Only try quick_enter() if we're not trying to reach a safepoint
// so that the calling thread reaches the safepoint more quickly. // so that the calling thread reaches the safepoint more quickly.
if (ObjectSynchronizer::quick_enter(_obj, thread, lock)) return; if (ObjectSynchronizer::quick_enter(_obj, thread, lock)) return;

View file

@ -204,7 +204,7 @@ bool ObjectSynchronizer::quick_notify(oopDesc * obj, Thread * self, bool all) {
// quick_enter() as our thread state remains _in_Java. // quick_enter() as our thread state remains _in_Java.
bool ObjectSynchronizer::quick_enter(oop obj, Thread * Self, bool ObjectSynchronizer::quick_enter(oop obj, Thread * Self,
BasicLock * Lock) { BasicLock * lock) {
assert(!SafepointSynchronize::is_at_safepoint(), "invariant"); assert(!SafepointSynchronize::is_at_safepoint(), "invariant");
assert(Self->is_Java_thread(), "invariant"); assert(Self->is_Java_thread(), "invariant");
assert(((JavaThread *) Self)->thread_state() == _thread_in_Java, "invariant"); assert(((JavaThread *) Self)->thread_state() == _thread_in_Java, "invariant");
@ -227,6 +227,18 @@ bool ObjectSynchronizer::quick_enter(oop obj, Thread * Self,
return true; return true;
} }
// This Java Monitor is inflated so obj's header will never be
// displaced to this thread's BasicLock. Make the displaced header
// non-NULL so this BasicLock is not seen as recursive nor as
// being locked. We do this unconditionally so that this thread's
// BasicLock cannot be mis-interpreted by any stack walkers. For
// performance reasons, stack walkers generally first check for
// Biased Locking in the object's header, the second check is for
// stack-locking in the object's header, the third check is for
// recursive stack-locking in the displaced header in the BasicLock,
// and last are the inflated Java Monitor (ObjectMonitor) checks.
lock->set_displaced_header(markOopDesc::unused_mark());
if (owner == NULL && if (owner == NULL &&
Atomic::cmpxchg_ptr(Self, &(m->_owner), NULL) == NULL) { Atomic::cmpxchg_ptr(Self, &(m->_owner), NULL) == NULL) {
assert(m->_recursions == 0, "invariant"); assert(m->_recursions == 0, "invariant");