< prev index next >
src/share/vm/prims/jvm.cpp
Print this page
@@ -35,11 +35,13 @@
#include "classfile/systemDictionaryShared.hpp"
#endif
#include "classfile/vmSymbols.hpp"
#include "gc_interface/collectedHeap.inline.hpp"
#include "interpreter/bytecode.hpp"
+#if INCLUDE_JFR
#include "jfr/jfrEvents.hpp"
+#endif
#include "memory/oopFactory.hpp"
#include "memory/referenceType.hpp"
#include "memory/universe.inline.hpp"
#include "oops/fieldStreams.hpp"
#include "oops/instanceKlass.hpp"
@@ -443,15 +445,17 @@
JVM_END
JVM_ENTRY_NO_ENV(void, JVM_BeforeHalt())
JVMWrapper("JVM_BeforeHalt");
+#if INCLUDE_JFR
EventShutdown event;
if (event.should_commit()) {
event.set_reason("Shutdown requested from Java");
event.commit();
}
+#endif
JVM_END
JVM_ENTRY_NO_ENV(void, JVM_Halt(jint code))
before_exit(thread);
@@ -3284,16 +3288,18 @@
} else {
os::yield();
}
JVM_END
+#if INCLUDE_JFR
static void post_thread_sleep_event(EventThreadSleep* event, jlong millis) {
assert(event != NULL, "invariant");
assert(event->should_commit(), "invariant");
event->set_time(millis);
event->commit();
}
+#endif
JVM_ENTRY(void, JVM_Sleep(JNIEnv* env, jclass threadClass, jlong millis))
JVMWrapper("JVM_Sleep");
if (millis < 0) {
@@ -3313,11 +3319,13 @@
#else /* USDT2 */
HOTSPOT_THREAD_SLEEP_BEGIN(
millis);
#endif /* USDT2 */
+#if INCLUDE_JFR
EventThreadSleep event;
+#endif
if (millis == 0) {
// When ConvertSleepToYield is on, this matches the classic VM implementation of
// JVM_Sleep. Critical for similar threading behaviour (Win32)
// It appears that in certain GUI contexts, it may be beneficial to do a short sleep
@@ -3335,13 +3343,15 @@
thread->osthread()->set_state(SLEEPING);
if (os::sleep(thread, millis, true) == OS_INTRPT) {
// An asynchronous exception (e.g., ThreadDeathException) could have been thrown on
// us while we were sleeping. We do not overwrite those.
if (!HAS_PENDING_EXCEPTION) {
+#if INCLUDE_JFR
if (event.should_commit()) {
post_thread_sleep_event(&event, millis);
}
+#endif
#ifndef USDT2
HS_DTRACE_PROBE1(hotspot, thread__sleep__end,1);
#else /* USDT2 */
HOTSPOT_THREAD_SLEEP_END(
1);
@@ -3351,13 +3361,15 @@
THROW_MSG(vmSymbols::java_lang_InterruptedException(), "sleep interrupted");
}
}
thread->osthread()->set_state(old_state);
}
+#if INCLUDE_JFR
if (event.should_commit()) {
post_thread_sleep_event(&event, millis);
}
+#endif
#ifndef USDT2
HS_DTRACE_PROBE1(hotspot, thread__sleep__end,0);
#else /* USDT2 */
HOTSPOT_THREAD_SLEEP_END(
0);
< prev index next >