--- old/src/share/vm/runtime/objectMonitor.cpp 2020-01-16 16:56:33.539367568 +0300 +++ new/src/share/vm/runtime/objectMonitor.cpp 2020-01-16 16:56:33.491369117 +0300 @@ -24,8 +24,10 @@ #include "precompiled.hpp" #include "classfile/vmSymbols.hpp" +#if INCLUDE_JFR #include "jfr/jfrEvents.hpp" #include "jfr/support/jfrThreadId.hpp" +#endif #include "memory/resourceArea.hpp" #include "oops/markOop.hpp" #include "oops/oop.inline.hpp" @@ -380,11 +382,13 @@ Atomic::inc_ptr(&_count); JFR_ONLY(JfrConditionalFlushWithStacktrace flush(jt);) +#if INCLUDE_JFR EventJavaMonitorEnter event; if (event.should_commit()) { event.set_monitorClass(((oop)this->object())->klass()); event.set_address((uintptr_t)(this->object_addr())); } +#endif { // Change java thread status to indicate blocked on monitor enter. JavaThreadBlockedOnMonitorEnterState jtbmes(jt, this); @@ -472,10 +476,12 @@ // just exited the monitor. } +#if INCLUDE_JFR if (event.should_commit()) { event.set_previousOwner((uintptr_t)_previous_owner_tid); event.commit(); } +#endif if (ObjectMonitor::_sync_ContendedLockAttempts != NULL) { ObjectMonitor::_sync_ContendedLockAttempts->inc() ; @@ -1448,6 +1454,7 @@ return v ; } +#if INCLUDE_JFR // helper method for posting a monitor wait event static void post_monitor_wait_event(EventJavaMonitorWait* event, ObjectMonitor* monitor, @@ -1462,6 +1469,7 @@ event->set_timedOut(timedout); event->commit(); } +#endif // ----------------------------------------------------------------------------- // Wait/Notify/NotifyAll @@ -1478,7 +1486,9 @@ // Throw IMSX or IEX. CHECK_OWNER(); +#if INCLUDE_JFR EventJavaMonitorWait event; +#endif // check for a pending interrupt if (interruptible && Thread::is_interrupted(Self, true) && !HAS_PENDING_EXCEPTION) { @@ -1496,9 +1506,11 @@ // consume an unpark() meant for the ParkEvent associated with // this ObjectMonitor. } +#if INCLUDE_JFR if (event.should_commit()) { post_monitor_wait_event(&event, this, 0, millis, false); } +#endif TEVENT (Wait - Throw IEX) ; THROW(vmSymbols::java_lang_InterruptedException()); return ; @@ -1640,9 +1652,11 @@ } } +#if INCLUDE_JFR if (event.should_commit()) { post_monitor_wait_event(&event, this, node._notifier_tid, millis, ret == OS_TIMEOUT); } +#endif OrderAccess::fence() ; @@ -1724,7 +1738,9 @@ } iterator->_notified = 1 ; Thread * Self = THREAD; +#if INCLUDE_JFR iterator->_notifier_tid = JFR_THREAD_ID(Self); +#endif ObjectWaiter * List = _EntryList ; if (List != NULL) { @@ -1850,7 +1866,9 @@ guarantee (iterator->_notified == 0, "invariant") ; iterator->_notified = 1 ; Thread * Self = THREAD; +#if INCLUDE_JFR iterator->_notifier_tid = JFR_THREAD_ID(Self); +#endif if (Policy != 4) { iterator->TState = ObjectWaiter::TS_ENTER ; }