--- old/src/hotspot/share/prims/jvmtiRawMonitor.cpp 2018-09-07 14:09:09.575013459 -0700 +++ new/src/hotspot/share/prims/jvmtiRawMonitor.cpp 2018-09-07 14:09:09.315013468 -0700 @@ -264,7 +264,6 @@ // Any JavaThread will enter here with state _thread_blocked int JvmtiRawMonitor::raw_enter(TRAPS) { - TEVENT (raw_enter) ; void * Contended ; // don't enter raw monitor if thread is being externally suspended, it will @@ -341,7 +340,6 @@ // Used mainly for JVMTI raw monitor implementation // Also used for JvmtiRawMonitor::wait(). int JvmtiRawMonitor::raw_exit(TRAPS) { - TEVENT (raw_exit) ; if (THREAD != _owner) { return OM_ILLEGAL_MONITOR_STATE; } @@ -360,7 +358,6 @@ // All JavaThreads will enter here with state _thread_blocked int JvmtiRawMonitor::raw_wait(jlong millis, bool interruptible, TRAPS) { - TEVENT (raw_wait) ; if (THREAD != _owner) { return OM_ILLEGAL_MONITOR_STATE; } @@ -406,7 +403,6 @@ } int JvmtiRawMonitor::raw_notify(TRAPS) { - TEVENT (raw_notify) ; if (THREAD != _owner) { return OM_ILLEGAL_MONITOR_STATE; } @@ -415,7 +411,6 @@ } int JvmtiRawMonitor::raw_notifyAll(TRAPS) { - TEVENT (raw_notifyAll) ; if (THREAD != _owner) { return OM_ILLEGAL_MONITOR_STATE; } --- old/src/hotspot/share/runtime/arguments.cpp 2018-09-07 14:09:10.519013426 -0700 +++ new/src/hotspot/share/runtime/arguments.cpp 2018-09-07 14:09:10.259013435 -0700 @@ -575,6 +575,7 @@ { "TransmitErrorReport", JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) }, { "ErrorReportServer", JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) }, { "EmitSync", JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) }, + { "SyncVerbose", JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) }, #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS { "dep > obs", JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() }, --- old/src/hotspot/share/runtime/globals.hpp 2018-09-07 14:09:11.475013392 -0700 +++ new/src/hotspot/share/runtime/globals.hpp 2018-09-07 14:09:11.219013401 -0700 @@ -844,8 +844,6 @@ experimental(intx, SyncFlags, 0, "(Unsafe, Unstable) " \ "Experimental Sync flags") \ \ - experimental(intx, SyncVerbose, 0, "(Unstable)") \ - \ experimental(intx, hashCode, 5, \ "(Unstable) select hashCode generation algorithm") \ \ --- old/src/hotspot/share/runtime/objectMonitor.cpp 2018-09-07 14:09:12.399013360 -0700 +++ new/src/hotspot/share/runtime/objectMonitor.cpp 2018-09-07 14:09:12.143013369 -0700 @@ -546,7 +546,6 @@ // to defer the state transitions until absolutely necessary, // and in doing so avoid some transitions ... - TEVENT(Inflated enter - Contention); int nWakeups = 0; int recheckInterval = 1; @@ -561,7 +560,6 @@ // park self if (_Responsible == Self || (SyncFlags & 1)) { - TEVENT(Inflated enter - park TIMED); Self->_ParkEvent->park((jlong) recheckInterval); // Increase the recheckInterval, but clamp the value. recheckInterval *= 8; @@ -569,7 +567,6 @@ recheckInterval = MAX_RECHECK_INTERVAL; } } else { - TEVENT(Inflated enter - park UNTIMED); Self->_ParkEvent->park(); } @@ -580,7 +577,7 @@ // Note that the counter is not protected by a lock or updated by atomics. // That is by design - we trade "lossy" counters which are exposed to // races during updates for a lower probe effect. - TEVENT(Inflated enter - Futile wakeup); + // This PerfData object can be used in parallel with a safepoint. // See the work around in PerfDataManager::destroy(). OM_PERFDATA_OP(FutileWakeups, inc()); @@ -707,8 +704,6 @@ if (TryLock(Self) > 0) break; if (TrySpin(Self) > 0) break; - TEVENT(Wait Reentry - parking); - // State transition wrappers around park() ... // ReenterI() wisely defers state transitions until // it's clear we must park the thread. @@ -744,7 +739,6 @@ // Note that the counter is not protected by a lock or updated by atomics. // That is by design - we trade "lossy" counters which are exposed to // races during updates for a lower probe effect. - TEVENT(Wait Reentry - futile wakeup); ++nWakeups; // Assuming this is not a spurious wakeup we'll normally @@ -795,7 +789,6 @@ if (SelfNode == _EntryList) _EntryList = nxt; assert(nxt == NULL || nxt->TState == ObjectWaiter::TS_ENTER, "invariant"); assert(prv == NULL || prv->TState == ObjectWaiter::TS_ENTER, "invariant"); - TEVENT(Unlink from EntryList); } else { assert(SelfNode->TState == ObjectWaiter::TS_CXQ, "invariant"); // Inopportune interleaving -- Self is still on the cxq. @@ -834,7 +827,6 @@ assert(q->_next == p, "invariant"); q->_next = p->_next; } - TEVENT(Unlink from cxq); } #ifdef ASSERT @@ -923,7 +915,6 @@ // way we should encounter this situation is in the presence of // unbalanced JNI locking. TODO: CheckJNICalls. // See also: CR4414101 - TEVENT(Exit - Throw IMSX); assert(false, "Non-balanced monitor enter/exit! Likely JNI locking"); return; } @@ -931,7 +922,6 @@ if (_recursions != 0) { _recursions--; // this is simple recursive enter - TEVENT(Inflated exit - recursive); return; } @@ -968,10 +958,8 @@ OrderAccess::release_store(&_owner, (void*)NULL); // drop the lock OrderAccess::storeload(); // See if we need to wake a successor if ((intptr_t(_EntryList)|intptr_t(_cxq)) == 0 || _succ != NULL) { - TEVENT(Inflated exit - simple egress); return; } - TEVENT(Inflated exit - complex egress); // Other threads are blocked trying to acquire the lock. // Normally the exiting thread is responsible for ensuring succession, @@ -1013,14 +1001,12 @@ if (!Atomic::replace_if_null(THREAD, &_owner)) { return; } - TEVENT(Exit - Reacquired); } else { if ((intptr_t(_EntryList)|intptr_t(_cxq)) == 0 || _succ != NULL) { OrderAccess::release_store(&_owner, (void*)NULL); // drop the lock OrderAccess::storeload(); // Ratify the previously observed values. if (_cxq == NULL || _succ != NULL) { - TEVENT(Inflated exit - simple egress); return; } @@ -1036,12 +1022,8 @@ // we could simply unpark() the lead thread and return // without having set _succ. if (!Atomic::replace_if_null(THREAD, &_owner)) { - TEVENT(Inflated exit - reacquired succeeded); return; } - TEVENT(Inflated exit - reacquired failed); - } else { - TEVENT(Inflated exit - complex egress); } } @@ -1168,7 +1150,6 @@ if (u == w) break; w = u; } - TEVENT(Inflated exit - drain cxq into EntryList); assert(w != NULL, "invariant"); assert(_EntryList == NULL, "invariant"); @@ -1272,7 +1253,6 @@ if (2 == Mode) OrderAccess::storeload(); if (!jSelf->is_external_suspend()) return false; // We raced a suspension -- fall thru into the slow path - TEVENT(ExitSuspendEquivalent - raced); jSelf->set_suspend_equivalent(); } return jSelf->handle_special_suspend_equivalent_condition(); @@ -1300,10 +1280,6 @@ OrderAccess::release_store(&_owner, (void*)NULL); OrderAccess::fence(); // ST _owner vs LD in unpark() - if (SafepointMechanism::poll(Self)) { - TEVENT(unpark before SAFEPOINT); - } - DTRACE_MONITOR_PROBE(contended__exit, this, object(), Self); Trigger->unpark(); @@ -1372,7 +1348,6 @@ _owner = THREAD; /* Convert from basiclock addr to Thread addr */ \ _recursions = 0; \ } else { \ - TEVENT(Throw IMSX); \ THROW(vmSymbols::java_lang_IllegalMonitorStateException()); \ } \ } \ @@ -1382,7 +1357,6 @@ // TODO-FIXME: remove check_slow() -- it's likely dead. void ObjectMonitor::check_slow(TRAPS) { - TEVENT(check_slow - throw IMSX); assert(THREAD != _owner && !THREAD->is_lock_owned((address) _owner), "must not be owner"); THROW_MSG(vmSymbols::java_lang_IllegalMonitorStateException(), "current thread not owner"); } @@ -1444,13 +1418,10 @@ if (event.should_commit()) { post_monitor_wait_event(&event, this, 0, millis, false); } - TEVENT(Wait - Throw IEX); THROW(vmSymbols::java_lang_InterruptedException()); return; } - TEVENT(Wait); - assert(Self->_Stalled == 0, "invariant"); Self->_Stalled = intptr_t(this); jt->set_current_waiting_monitor(this); @@ -1631,7 +1602,6 @@ // no, it could be timeout or Thread.interrupt() or both // check for interrupt event, otherwise it is timeout if (interruptible && Thread::is_interrupted(Self, true) && !HAS_PENDING_EXCEPTION) { - TEVENT(Wait - throw IEX from epilog); THROW(vmSymbols::java_lang_InterruptedException()); } } @@ -1652,7 +1622,6 @@ Thread::SpinAcquire(&_WaitSetLock, "WaitSet - notify"); ObjectWaiter * iterator = DequeueWaiter(); if (iterator != NULL) { - TEVENT(Notify1 - Transfer); guarantee(iterator->TState == ObjectWaiter::TS_WAIT, "invariant"); guarantee(iterator->_notified == 0, "invariant"); // Disposition - what might we do with iterator ? @@ -1766,7 +1735,6 @@ void ObjectMonitor::notify(TRAPS) { CHECK_OWNER(); if (_WaitSet == NULL) { - TEVENT(Empty-Notify); return; } DTRACE_MONITOR_PROBE(notify, this, object(), THREAD); @@ -1785,7 +1753,6 @@ void ObjectMonitor::notifyAll(TRAPS) { CHECK_OWNER(); if (_WaitSet == NULL) { - TEVENT(Empty-NotifyAll); return; } @@ -1912,14 +1879,12 @@ if (Knob_SuccRestrict && _succ != NULL) return 0; if (Knob_OState && NotRunnable (Self, (Thread *) _owner)) { - TEVENT(Spin abort - notrunnable [TOP]); return 0; } int MaxSpin = Knob_MaxSpinners; if (MaxSpin >= 0) { if (_Spinner > MaxSpin) { - TEVENT(Spin abort -- too many spinners); return 0; } // Slightly racy, but benign ... @@ -1956,7 +1921,6 @@ // We periodically check to see if there's a safepoint pending. if ((ctr & 0xFF) == 0) { if (SafepointMechanism::poll(Self)) { - TEVENT(Spin: safepoint); goto Abort; // abrupt spin egress } if (Knob_UsePause & 1) SpinPause(); @@ -2029,7 +1993,6 @@ // * exit spin without prejudice. // * Since CAS is high-latency, retry again immediately. prv = ox; - TEVENT(Spin: cas failed); if (caspty == -2) break; if (caspty == -1) goto Abort; ctr -= caspty; @@ -2038,7 +2001,6 @@ // Did lock ownership change hands ? if (ox != prv && prv != NULL) { - TEVENT(spin: Owner changed) if (oxpty == -2) break; if (oxpty == -1) goto Abort; ctr -= oxpty; @@ -2050,7 +2012,6 @@ // Spinning while the owner is OFFPROC is idiocy. // Consider: ctr -= RunnablePenalty ; if (Knob_OState && NotRunnable (Self, ox)) { - TEVENT(Spin abort - notrunnable); goto Abort; } if (sss && _succ == NULL) _succ = Self; @@ -2059,7 +2020,6 @@ // Spin failed with prejudice -- reduce _SpinDuration. // TODO: Use an AIMD-like policy to adjust _SpinDuration. // AIMD is globally stable. - TEVENT(Spin failure); { int x = _SpinDuration; if (x > 0) { --- old/src/hotspot/share/runtime/objectMonitor.hpp 2018-09-07 14:09:13.299013329 -0700 +++ new/src/hotspot/share/runtime/objectMonitor.hpp 2018-09-07 14:09:13.047013338 -0700 @@ -321,21 +321,4 @@ bool ExitSuspendEquivalent(JavaThread * Self); }; -#undef TEVENT -#define TEVENT(nom) { if (SyncVerbose) FEVENT(nom); } - -#define FEVENT(nom) \ - { \ - static volatile int ctr = 0; \ - int v = ++ctr; \ - if ((v & (v - 1)) == 0) { \ - tty->print_cr("INFO: " #nom " : %d", v); \ - tty->flush(); \ - } \ - } - -#undef TEVENT -#define TEVENT(nom) {;} - - #endif // SHARE_VM_RUNTIME_OBJECTMONITOR_HPP --- old/src/hotspot/share/runtime/synchronizer.cpp 2018-09-07 14:09:14.015013304 -0700 +++ new/src/hotspot/share/runtime/synchronizer.cpp 2018-09-07 14:09:13.815013311 -0700 @@ -320,7 +320,6 @@ // swing the displaced header from the BasicLock back to the mark. assert(dhw->is_neutral(), "invariant"); if (object->cas_set_mark(dhw, mark) == mark) { - TEVENT(fast_exit: release stack-lock); return; } } @@ -345,7 +344,6 @@ // be visible <= the ST performed by the CAS. lock->set_displaced_header(mark); if (mark == obj()->cas_set_mark((markOop) lock, mark)) { - TEVENT(slow_enter: release stacklock); return; } // Fall through to inflate() ... @@ -388,7 +386,6 @@ // 5) lock lock2 // NOTE: must use heavy weight monitor to handle complete_exit/reenter() intptr_t ObjectSynchronizer::complete_exit(Handle obj, TRAPS) { - TEVENT(complete_exit); if (UseBiasedLocking) { BiasedLocking::revoke_and_rebias(obj, false, THREAD); assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); @@ -403,7 +400,6 @@ // NOTE: must use heavy weight monitor to handle complete_exit/reenter() void ObjectSynchronizer::reenter(Handle obj, intptr_t recursion, TRAPS) { - TEVENT(reenter); if (UseBiasedLocking) { BiasedLocking::revoke_and_rebias(obj, false, THREAD); assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); @@ -420,7 +416,6 @@ // NOTE: must use heavy weight monitor to handle jni monitor enter void ObjectSynchronizer::jni_enter(Handle obj, TRAPS) { // the current locking is from JNI instead of Java code - TEVENT(jni_enter); if (UseBiasedLocking) { BiasedLocking::revoke_and_rebias(obj, false, THREAD); assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); @@ -432,7 +427,6 @@ // NOTE: must use heavy weight monitor to handle jni monitor exit void ObjectSynchronizer::jni_exit(oop obj, Thread* THREAD) { - TEVENT(jni_exit); if (UseBiasedLocking) { Handle h_obj(THREAD, obj); BiasedLocking::revoke_and_rebias(h_obj, false, THREAD); @@ -460,8 +454,6 @@ _obj = obj; if (_dolock) { - TEVENT(ObjectLocker); - ObjectSynchronizer::fast_enter(_obj, &_lock, false, _thread); } } @@ -482,7 +474,6 @@ assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); } if (millis < 0) { - TEVENT(wait - throw IAX); THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative"); } ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, @@ -505,7 +496,6 @@ assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); } if (millis < 0) { - TEVENT(wait - throw IAX); THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative"); } ObjectSynchronizer::inflate(THREAD, @@ -608,7 +598,6 @@ if (its > 10000 || !os::is_MP()) { if (its & 1) { os::naked_yield(); - TEVENT(Inflate: INFLATING - yield); } else { // Note that the following code attenuates the livelock problem but is not // a complete remedy. A more complete solution would require that the inflating @@ -641,7 +630,6 @@ } } Thread::muxRelease(gInflationLocks + ix); - TEVENT(Inflate: INFLATING - yield/park); } } else { SpinPause(); // SMP-polite spinning @@ -703,7 +691,6 @@ value &= markOopDesc::hash_mask; if (value == 0) value = 0xBAD; assert(value != markOopDesc::no_hash, "invariant"); - TEVENT(hashCode: GENERATE); return value; } @@ -1154,7 +1141,6 @@ Thread::muxRelease(&gListLock); Self->omFreeProvision += 1 + (Self->omFreeProvision/2); if (Self->omFreeProvision > MAXPRIVATE) Self->omFreeProvision = MAXPRIVATE; - TEVENT(omFirst - reprovision); const int mx = MonitorBound; if (mx > 0 && (gMonitorPopulation-gMonitorFreeCount) > mx) { @@ -1232,7 +1218,6 @@ temp[_BLOCKSIZE - 1].FreeNext = gFreeList; gFreeList = temp + 1; Thread::muxRelease(&gListLock); - TEVENT(Allocate block of monitors); } } @@ -1317,7 +1302,6 @@ guarantee(s->object() == NULL, "invariant"); guarantee(!s->is_busy(), "invariant"); s->set_owner(NULL); // redundant but good hygiene - TEVENT(omFlush - Move one); } guarantee(tail != NULL && list != NULL, "invariant"); } @@ -1357,7 +1341,6 @@ } Thread::muxRelease(&gListLock); - TEVENT(omFlush); } static void post_monitor_inflate_event(EventJavaMonitorInflate* event, @@ -1422,7 +1405,6 @@ // Currently, we spin/yield/park and poll the markword, waiting for inflation to finish. // We could always eliminate polling by parking the thread on some auxiliary list. if (mark == markOopDesc::INFLATING()) { - TEVENT(Inflate: spin while INFLATING); ReadStableMark(object); continue; } @@ -1515,7 +1497,6 @@ // Hopefully the performance counters are allocated on distinct cache lines // to avoid false sharing on MP systems ... OM_PERFDATA_OP(Inflations, inc()); - TEVENT(Inflate: overwrite stacklock); if (log_is_enabled(Debug, monitorinflation)) { if (object->is_instance()) { ResourceMark rm; @@ -1566,7 +1547,6 @@ // Hopefully the performance counters are allocated on distinct // cache lines to avoid false sharing on MP systems ... OM_PERFDATA_OP(Inflations, inc()); - TEVENT(Inflate: overwrite neutral); if (log_is_enabled(Debug, monitorinflation)) { if (object->is_instance()) { ResourceMark rm; @@ -1633,7 +1613,6 @@ // Deflate the monitor if it is no longer being used // It's idle - scavenge and return to the global free list // plain old deflation ... - TEVENT(deflate_idle_monitors - scavenge1); if (log_is_enabled(Debug, monitorinflation)) { if (obj->is_instance()) { ResourceMark rm; @@ -1719,7 +1698,6 @@ ObjectMonitor * freeHeadp = NULL; // Local SLL of scavenged monitors ObjectMonitor * freeTailp = NULL; - TEVENT(deflate_idle_monitors); // Prevent omFlush from changing mids in Thread dtor's during deflation // And in case the vm thread is acquiring a lock during a safepoint // See e.g. 6320749 --- old/src/hotspot/share/runtime/thread.cpp 2018-09-07 14:09:14.763013278 -0700 +++ new/src/hotspot/share/runtime/thread.cpp 2018-09-07 14:09:14.563013285 -0700 @@ -4736,7 +4736,6 @@ } // Slow-path : We've encountered contention -- Spin/Yield/Block strategy. - TEVENT(SpinAcquire - ctx); int ctr = 0; int Yields = 0; for (;;) { @@ -4831,7 +4830,6 @@ return; } - TEVENT(muxAcquire - Contention); ParkEvent * const Self = Thread::current()->_MuxEvent; assert((intptr_t(Self) & LOCKBIT) == 0, "invariant"); for (;;) { @@ -4877,7 +4875,6 @@ return; } - TEVENT(muxAcquire - Contention); ParkEvent * ReleaseAfter = NULL; if (ev == NULL) { ev = ReleaseAfter = ParkEvent::Allocate(NULL);