36 #include "memory/universe.inline.hpp"
37 #include "oops/oop.inline.hpp"
38 #include "oops/symbol.hpp"
39 #include "runtime/compilationPolicy.hpp"
40 #include "runtime/deoptimization.hpp"
41 #include "runtime/frame.inline.hpp"
42 #include "runtime/interfaceSupport.hpp"
43 #include "runtime/mutexLocker.hpp"
44 #include "runtime/orderAccess.inline.hpp"
45 #include "runtime/osThread.hpp"
46 #include "runtime/safepoint.hpp"
47 #include "runtime/signature.hpp"
48 #include "runtime/stubCodeGenerator.hpp"
49 #include "runtime/stubRoutines.hpp"
50 #include "runtime/sweeper.hpp"
51 #include "runtime/synchronizer.hpp"
52 #include "runtime/thread.inline.hpp"
53 #include "services/runtimeService.hpp"
54 #include "utilities/events.hpp"
55 #include "utilities/macros.hpp"
56 #ifdef TARGET_ARCH_x86
57 # include "nativeInst_x86.hpp"
58 # include "vmreg_x86.inline.hpp"
59 #endif
60 #ifdef TARGET_ARCH_sparc
61 # include "nativeInst_sparc.hpp"
62 # include "vmreg_sparc.inline.hpp"
63 #endif
64 #ifdef TARGET_ARCH_zero
65 # include "nativeInst_zero.hpp"
66 # include "vmreg_zero.inline.hpp"
67 #endif
68 #ifdef TARGET_ARCH_arm
69 # include "nativeInst_arm.hpp"
70 # include "vmreg_arm.inline.hpp"
71 #endif
72 #ifdef TARGET_ARCH_ppc
73 # include "nativeInst_ppc.hpp"
74 # include "vmreg_ppc.inline.hpp"
75 #endif
392 RuntimeService::record_safepoint_synchronized();
393 if (PrintSafepointStatistics) {
394 update_statistics_on_sync_end(os::javaTimeNanos());
395 }
396
397 // Call stuff that needs to be run when a safepoint is just about to be completed
398 do_cleanup_tasks();
399
400 if (PrintSafepointStatistics) {
401 // Record how much time spend on the above cleanup tasks
402 update_statistics_on_cleanup_end(os::javaTimeNanos());
403 }
404 }
405
406 // Wake up all threads, so they are ready to resume execution after the safepoint
407 // operation has been carried out
408 void SafepointSynchronize::end() {
409
410 assert(Threads_lock->owned_by_self(), "must hold Threads_lock");
411 assert((_safepoint_counter & 0x1) == 1, "must be odd");
412 _safepoint_counter ++;
413 // memory fence isn't required here since an odd _safepoint_counter
414 // value can do no harm and a fence is issued below anyway.
415
416 DEBUG_ONLY(Thread* myThread = Thread::current();)
417 assert(myThread->is_VM_thread(), "Only VM thread can execute a safepoint");
418
419 if (PrintSafepointStatistics) {
420 end_statistics(os::javaTimeNanos());
421 }
422
423 #ifdef ASSERT
424 // A pending_exception cannot be installed during a safepoint. The threads
425 // may install an async exception after they come back from a safepoint into
426 // pending_exception after they unblock. But that should happen later.
427 for(JavaThread *cur = Threads::first(); cur; cur = cur->next()) {
428 assert (!(cur->has_pending_exception() &&
429 cur->safepoint_state()->is_at_poll_safepoint()),
430 "safepoint installed a pending exception");
431 }
|
36 #include "memory/universe.inline.hpp"
37 #include "oops/oop.inline.hpp"
38 #include "oops/symbol.hpp"
39 #include "runtime/compilationPolicy.hpp"
40 #include "runtime/deoptimization.hpp"
41 #include "runtime/frame.inline.hpp"
42 #include "runtime/interfaceSupport.hpp"
43 #include "runtime/mutexLocker.hpp"
44 #include "runtime/orderAccess.inline.hpp"
45 #include "runtime/osThread.hpp"
46 #include "runtime/safepoint.hpp"
47 #include "runtime/signature.hpp"
48 #include "runtime/stubCodeGenerator.hpp"
49 #include "runtime/stubRoutines.hpp"
50 #include "runtime/sweeper.hpp"
51 #include "runtime/synchronizer.hpp"
52 #include "runtime/thread.inline.hpp"
53 #include "services/runtimeService.hpp"
54 #include "utilities/events.hpp"
55 #include "utilities/macros.hpp"
56 #include "evtrace/traceManager.hpp"
57 #ifdef TARGET_ARCH_x86
58 # include "nativeInst_x86.hpp"
59 # include "vmreg_x86.inline.hpp"
60 #endif
61 #ifdef TARGET_ARCH_sparc
62 # include "nativeInst_sparc.hpp"
63 # include "vmreg_sparc.inline.hpp"
64 #endif
65 #ifdef TARGET_ARCH_zero
66 # include "nativeInst_zero.hpp"
67 # include "vmreg_zero.inline.hpp"
68 #endif
69 #ifdef TARGET_ARCH_arm
70 # include "nativeInst_arm.hpp"
71 # include "vmreg_arm.inline.hpp"
72 #endif
73 #ifdef TARGET_ARCH_ppc
74 # include "nativeInst_ppc.hpp"
75 # include "vmreg_ppc.inline.hpp"
76 #endif
393 RuntimeService::record_safepoint_synchronized();
394 if (PrintSafepointStatistics) {
395 update_statistics_on_sync_end(os::javaTimeNanos());
396 }
397
398 // Call stuff that needs to be run when a safepoint is just about to be completed
399 do_cleanup_tasks();
400
401 if (PrintSafepointStatistics) {
402 // Record how much time spend on the above cleanup tasks
403 update_statistics_on_cleanup_end(os::javaTimeNanos());
404 }
405 }
406
407 // Wake up all threads, so they are ready to resume execution after the safepoint
408 // operation has been carried out
409 void SafepointSynchronize::end() {
410
411 assert(Threads_lock->owned_by_self(), "must hold Threads_lock");
412 assert((_safepoint_counter & 0x1) == 1, "must be odd");
413
414 if (EnableEventTracing) {
415 TraceManager::do_work_before_safepoint_end();
416 }
417
418 _safepoint_counter ++;
419 // memory fence isn't required here since an odd _safepoint_counter
420 // value can do no harm and a fence is issued below anyway.
421
422 DEBUG_ONLY(Thread* myThread = Thread::current();)
423 assert(myThread->is_VM_thread(), "Only VM thread can execute a safepoint");
424
425 if (PrintSafepointStatistics) {
426 end_statistics(os::javaTimeNanos());
427 }
428
429 #ifdef ASSERT
430 // A pending_exception cannot be installed during a safepoint. The threads
431 // may install an async exception after they come back from a safepoint into
432 // pending_exception after they unblock. But that should happen later.
433 for(JavaThread *cur = Threads::first(); cur; cur = cur->next()) {
434 assert (!(cur->has_pending_exception() &&
435 cur->safepoint_state()->is_at_poll_safepoint()),
436 "safepoint installed a pending exception");
437 }
|