src/share/vm/prims/unsafe.cpp

changeset 9858
b985cbb00e68
parent 9327
f96fcd9e1e1b
child 9865
5a83b7215107
equal deleted inserted replaced
9727:c7a3e57fdf4a 9858:b985cbb00e68
26 #include "classfile/vmSymbols.hpp" 26 #include "classfile/vmSymbols.hpp"
27 #include "utilities/macros.hpp" 27 #include "utilities/macros.hpp"
28 #if INCLUDE_ALL_GCS 28 #if INCLUDE_ALL_GCS
29 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" 29 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
30 #endif // INCLUDE_ALL_GCS 30 #endif // INCLUDE_ALL_GCS
31 #include "jfr/jfrEvents.hpp"
31 #include "memory/allocation.inline.hpp" 32 #include "memory/allocation.inline.hpp"
32 #include "prims/jni.h" 33 #include "prims/jni.h"
33 #include "prims/jvm.h" 34 #include "prims/jvm.h"
34 #include "runtime/globals.hpp" 35 #include "runtime/globals.hpp"
35 #include "runtime/interfaceSupport.hpp" 36 #include "runtime/interfaceSupport.hpp"
36 #include "runtime/prefetch.inline.hpp" 37 #include "runtime/prefetch.inline.hpp"
37 #include "runtime/orderAccess.inline.hpp" 38 #include "runtime/orderAccess.inline.hpp"
38 #include "runtime/reflection.hpp" 39 #include "runtime/reflection.hpp"
39 #include "runtime/synchronizer.hpp" 40 #include "runtime/synchronizer.hpp"
40 #include "services/threadService.hpp" 41 #include "services/threadService.hpp"
41 #include "trace/tracing.hpp"
42 #include "utilities/copy.hpp" 42 #include "utilities/copy.hpp"
43 #include "utilities/dtrace.hpp" 43 #include "utilities/dtrace.hpp"
44 44
45 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC 45 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
46 46
1234 return success; 1234 return success;
1235 } 1235 }
1236 #endif 1236 #endif
1237 UNSAFE_END 1237 UNSAFE_END
1238 1238
1239 static void post_thread_park_event(EventThreadPark* event, const oop obj, jlong timeout) {
1240 assert(event != NULL, "invariant");
1241 assert(event->should_commit(), "invariant");
1242 event->set_parkedClass((obj != NULL) ? obj->klass() : NULL);
1243 event->set_timeout(timeout);
1244 event->set_address((obj != NULL) ? (u8)cast_from_oop<uintptr_t>(obj) : 0);
1245 event->commit();
1246 }
1247
1239 UNSAFE_ENTRY(void, Unsafe_Park(JNIEnv *env, jobject unsafe, jboolean isAbsolute, jlong time)) 1248 UNSAFE_ENTRY(void, Unsafe_Park(JNIEnv *env, jobject unsafe, jboolean isAbsolute, jlong time))
1240 UnsafeWrapper("Unsafe_Park"); 1249 UnsafeWrapper("Unsafe_Park");
1241 EventThreadPark event; 1250 EventThreadPark event;
1242 #ifndef USDT2 1251 #ifndef USDT2
1243 HS_DTRACE_PROBE3(hotspot, thread__park__begin, thread->parker(), (int) isAbsolute, time); 1252 HS_DTRACE_PROBE3(hotspot, thread__park__begin, thread->parker(), (int) isAbsolute, time);
1252 #else /* USDT2 */ 1261 #else /* USDT2 */
1253 HOTSPOT_THREAD_PARK_END( 1262 HOTSPOT_THREAD_PARK_END(
1254 (uintptr_t) thread->parker()); 1263 (uintptr_t) thread->parker());
1255 #endif /* USDT2 */ 1264 #endif /* USDT2 */
1256 if (event.should_commit()) { 1265 if (event.should_commit()) {
1257 oop obj = thread->current_park_blocker(); 1266 post_thread_park_event(&event, thread->current_park_blocker(), time);
1258 event.set_klass((obj != NULL) ? obj->klass() : NULL);
1259 event.set_timeout(time);
1260 event.set_address((obj != NULL) ? (TYPE_ADDRESS) cast_from_oop<uintptr_t>(obj) : 0);
1261 event.commit();
1262 } 1267 }
1263 UNSAFE_END 1268 UNSAFE_END
1264 1269
1265 UNSAFE_ENTRY(void, Unsafe_Unpark(JNIEnv *env, jobject unsafe, jobject jthread)) 1270 UNSAFE_ENTRY(void, Unsafe_Unpark(JNIEnv *env, jobject unsafe, jobject jthread))
1266 UnsafeWrapper("Unsafe_Unpark"); 1271 UnsafeWrapper("Unsafe_Unpark");

mercurial