35 #include "classfile/systemDictionaryShared.hpp" |
35 #include "classfile/systemDictionaryShared.hpp" |
36 #endif |
36 #endif |
37 #include "classfile/vmSymbols.hpp" |
37 #include "classfile/vmSymbols.hpp" |
38 #include "gc_interface/collectedHeap.inline.hpp" |
38 #include "gc_interface/collectedHeap.inline.hpp" |
39 #include "interpreter/bytecode.hpp" |
39 #include "interpreter/bytecode.hpp" |
|
40 #include "jfr/jfrEvents.hpp" |
40 #include "memory/oopFactory.hpp" |
41 #include "memory/oopFactory.hpp" |
41 #include "memory/referenceType.hpp" |
42 #include "memory/referenceType.hpp" |
42 #include "memory/universe.inline.hpp" |
43 #include "memory/universe.inline.hpp" |
43 #include "oops/fieldStreams.hpp" |
44 #include "oops/fieldStreams.hpp" |
44 #include "oops/instanceKlass.hpp" |
45 #include "oops/instanceKlass.hpp" |
65 #include "runtime/vframe.hpp" |
66 #include "runtime/vframe.hpp" |
66 #include "runtime/vm_operations.hpp" |
67 #include "runtime/vm_operations.hpp" |
67 #include "services/attachListener.hpp" |
68 #include "services/attachListener.hpp" |
68 #include "services/management.hpp" |
69 #include "services/management.hpp" |
69 #include "services/threadService.hpp" |
70 #include "services/threadService.hpp" |
70 #include "trace/tracing.hpp" |
|
71 #include "utilities/copy.hpp" |
71 #include "utilities/copy.hpp" |
72 #include "utilities/defaultStream.hpp" |
72 #include "utilities/defaultStream.hpp" |
73 #include "utilities/dtrace.hpp" |
73 #include "utilities/dtrace.hpp" |
74 #include "utilities/events.hpp" |
74 #include "utilities/events.hpp" |
75 #include "utilities/histogram.hpp" |
75 #include "utilities/histogram.hpp" |
3274 } else { |
3274 } else { |
3275 os::yield(); |
3275 os::yield(); |
3276 } |
3276 } |
3277 JVM_END |
3277 JVM_END |
3278 |
3278 |
|
3279 static void post_thread_sleep_event(EventThreadSleep* event, jlong millis) { |
|
3280 assert(event != NULL, "invariant"); |
|
3281 assert(event->should_commit(), "invariant"); |
|
3282 event->set_time(millis); |
|
3283 event->commit(); |
|
3284 } |
3279 |
3285 |
3280 JVM_ENTRY(void, JVM_Sleep(JNIEnv* env, jclass threadClass, jlong millis)) |
3286 JVM_ENTRY(void, JVM_Sleep(JNIEnv* env, jclass threadClass, jlong millis)) |
3281 JVMWrapper("JVM_Sleep"); |
3287 JVMWrapper("JVM_Sleep"); |
3282 |
3288 |
3283 if (millis < 0) { |
3289 if (millis < 0) { |
3320 if (os::sleep(thread, millis, true) == OS_INTRPT) { |
3326 if (os::sleep(thread, millis, true) == OS_INTRPT) { |
3321 // An asynchronous exception (e.g., ThreadDeathException) could have been thrown on |
3327 // An asynchronous exception (e.g., ThreadDeathException) could have been thrown on |
3322 // us while we were sleeping. We do not overwrite those. |
3328 // us while we were sleeping. We do not overwrite those. |
3323 if (!HAS_PENDING_EXCEPTION) { |
3329 if (!HAS_PENDING_EXCEPTION) { |
3324 if (event.should_commit()) { |
3330 if (event.should_commit()) { |
3325 event.set_time(millis); |
3331 post_thread_sleep_event(&event, millis); |
3326 event.commit(); |
|
3327 } |
3332 } |
3328 #ifndef USDT2 |
3333 #ifndef USDT2 |
3329 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,1); |
3334 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,1); |
3330 #else /* USDT2 */ |
3335 #else /* USDT2 */ |
3331 HOTSPOT_THREAD_SLEEP_END( |
3336 HOTSPOT_THREAD_SLEEP_END( |
3337 } |
3342 } |
3338 } |
3343 } |
3339 thread->osthread()->set_state(old_state); |
3344 thread->osthread()->set_state(old_state); |
3340 } |
3345 } |
3341 if (event.should_commit()) { |
3346 if (event.should_commit()) { |
3342 event.set_time(millis); |
3347 post_thread_sleep_event(&event, millis); |
3343 event.commit(); |
|
3344 } |
3348 } |
3345 #ifndef USDT2 |
3349 #ifndef USDT2 |
3346 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,0); |
3350 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,0); |
3347 #else /* USDT2 */ |
3351 #else /* USDT2 */ |
3348 HOTSPOT_THREAD_SLEEP_END( |
3352 HOTSPOT_THREAD_SLEEP_END( |