src/share/vm/prims/unsafe.cpp
Print this page
rev 13113 : 8182651: Add TRACE_ONLY conditional macro to support more fine-grained INCLUDE_TRACE programming
Reviewed-by:
*** 37,54 ****
#include "runtime/interfaceSupport.hpp"
#include "runtime/orderAccess.inline.hpp"
#include "runtime/reflection.hpp"
#include "runtime/vm_version.hpp"
#include "services/threadService.hpp"
- #include "trace/tracing.hpp"
#include "utilities/copy.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
#include "gc/g1/g1SATBCardTableModRefBS.hpp"
#endif // INCLUDE_ALL_GCS
!
/**
* Implementation of the jdk.internal.misc.Unsafe class
*/
--- 37,55 ----
#include "runtime/interfaceSupport.hpp"
#include "runtime/orderAccess.inline.hpp"
#include "runtime/reflection.hpp"
#include "runtime/vm_version.hpp"
#include "services/threadService.hpp"
#include "utilities/copy.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
#include "gc/g1/g1SATBCardTableModRefBS.hpp"
#endif // INCLUDE_ALL_GCS
! #if INCLUDE_TRACE
! #include "trace/tracing.hpp"
! #endif
/**
* Implementation of the jdk.internal.misc.Unsafe class
*/
*** 1055,1080 ****
return true;
}
#endif
} UNSAFE_END
UNSAFE_ENTRY(void, Unsafe_Park(JNIEnv *env, jobject unsafe, jboolean isAbsolute, jlong time)) {
- EventThreadPark event;
HOTSPOT_THREAD_PARK_BEGIN((uintptr_t) thread->parker(), (int) isAbsolute, time);
!
JavaThreadParkedState jtps(thread, time != 0);
thread->parker()->park(isAbsolute != 0, time);
-
HOTSPOT_THREAD_PARK_END((uintptr_t) thread->parker());
- if (event.should_commit()) {
- oop obj = thread->current_park_blocker();
- event.set_parkedClass((obj != NULL) ? obj->klass() : NULL);
- event.set_timeout(time);
- event.set_address((obj != NULL) ? (TYPE_ADDRESS) cast_from_oop<uintptr_t>(obj) : 0);
- event.commit();
- }
} UNSAFE_END
UNSAFE_ENTRY(void, Unsafe_Unpark(JNIEnv *env, jobject unsafe, jobject jthread)) {
Parker* p = NULL;
--- 1056,1086 ----
return true;
}
#endif
} UNSAFE_END
+ #if INCLUDE_TRACE
+ static void post_thread_park_event(EventThreadPark* event, const oop obj, jlong timeout) {
+ assert(event != NULL, "invariant");
+ if (event->should_commit()) {
+ event->set_parkedClass((obj != NULL) ? obj->klass() : NULL);
+ event->set_timeout(timeout);
+ event->set_address((obj != NULL) ? (TYPE_ADDRESS) cast_from_oop<uintptr_t>(obj) : 0);
+ event->commit();
+ }
+ }
+ #endif
+
UNSAFE_ENTRY(void, Unsafe_Park(JNIEnv *env, jobject unsafe, jboolean isAbsolute, jlong time)) {
HOTSPOT_THREAD_PARK_BEGIN((uintptr_t) thread->parker(), (int) isAbsolute, time);
! TRACE_ONLY(EventThreadPark event;)
JavaThreadParkedState jtps(thread, time != 0);
thread->parker()->park(isAbsolute != 0, time);
HOTSPOT_THREAD_PARK_END((uintptr_t) thread->parker());
+ TRACE_ONLY(post_thread_park_event(&event, thread->current_park_blocker(), time);)
+
} UNSAFE_END
UNSAFE_ENTRY(void, Unsafe_Unpark(JNIEnv *env, jobject unsafe, jobject jthread)) {
Parker* p = NULL;