--- old/src/share/vm/prims/unsafe.cpp 2019-02-15 19:02:39.474761824 +0300 +++ new/src/share/vm/prims/unsafe.cpp 2019-02-15 19:02:39.378765178 +0300 @@ -28,6 +28,7 @@ #if INCLUDE_ALL_GCS #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" #endif // INCLUDE_ALL_GCS +#include "jfr/jfrEvents.hpp" #include "memory/allocation.inline.hpp" #include "prims/jni.h" #include "prims/jvm.h" @@ -38,7 +39,6 @@ #include "runtime/reflection.hpp" #include "runtime/synchronizer.hpp" #include "services/threadService.hpp" -#include "trace/tracing.hpp" #include "utilities/copy.hpp" #include "utilities/dtrace.hpp" @@ -1236,6 +1236,15 @@ #endif UNSAFE_END +static void post_thread_park_event(EventThreadPark* event, const oop obj, jlong timeout) { + assert(event != NULL, "invariant"); + assert(event->should_commit(), "invariant"); + event->set_parkedClass((obj != NULL) ? obj->klass() : NULL); + event->set_timeout(timeout); + event->set_address((obj != NULL) ? (u8)cast_from_oop(obj) : 0); + event->commit(); +} + UNSAFE_ENTRY(void, Unsafe_Park(JNIEnv *env, jobject unsafe, jboolean isAbsolute, jlong time)) UnsafeWrapper("Unsafe_Park"); EventThreadPark event; @@ -1254,11 +1263,7 @@ (uintptr_t) thread->parker()); #endif /* USDT2 */ if (event.should_commit()) { - oop obj = thread->current_park_blocker(); - event.set_klass((obj != NULL) ? obj->klass() : NULL); - event.set_timeout(time); - event.set_address((obj != NULL) ? (TYPE_ADDRESS) cast_from_oop(obj) : 0); - event.commit(); + post_thread_park_event(&event, thread->current_park_blocker(), time); } UNSAFE_END