equal
deleted
inserted
replaced
61 #include "services/runtimeService.hpp" |
61 #include "services/runtimeService.hpp" |
62 #include "trace/tracing.hpp" |
62 #include "trace/tracing.hpp" |
63 #include "trace/traceMacros.hpp" |
63 #include "trace/traceMacros.hpp" |
64 #include "utilities/events.hpp" |
64 #include "utilities/events.hpp" |
65 #include "utilities/macros.hpp" |
65 #include "utilities/macros.hpp" |
66 #if INCLUDE_ALL_GCS |
|
67 #include "gc/cms/concurrentMarkSweepThread.hpp" |
|
68 #include "gc/g1/suspendibleThreadSet.hpp" |
|
69 #endif // INCLUDE_ALL_GCS |
|
70 #ifdef COMPILER1 |
66 #ifdef COMPILER1 |
71 #include "c1/c1_globals.hpp" |
67 #include "c1/c1_globals.hpp" |
72 #endif |
68 #endif |
73 |
69 |
74 // -------------------------------------------------------------------------------------------------- |
70 // -------------------------------------------------------------------------------------------------- |
92 if (PrintSafepointStatistics || PrintSafepointStatisticsTimeout > 0) { |
88 if (PrintSafepointStatistics || PrintSafepointStatisticsTimeout > 0) { |
93 _safepoint_begin_time = os::javaTimeNanos(); |
89 _safepoint_begin_time = os::javaTimeNanos(); |
94 _ts_of_current_safepoint = tty->time_stamp().seconds(); |
90 _ts_of_current_safepoint = tty->time_stamp().seconds(); |
95 } |
91 } |
96 |
92 |
97 #if INCLUDE_ALL_GCS |
93 Universe::heap()->safepoint_synchronize_begin(); |
98 if (UseConcMarkSweepGC) { |
|
99 // In the future we should investigate whether CMS can use the |
|
100 // more-general mechanism below. DLD (01/05). |
|
101 ConcurrentMarkSweepThread::synchronize(false); |
|
102 } else if (UseG1GC) { |
|
103 SuspendibleThreadSet::synchronize(); |
|
104 } |
|
105 #endif // INCLUDE_ALL_GCS |
|
106 |
94 |
107 // By getting the Threads_lock, we assure that no threads are about to start or |
95 // By getting the Threads_lock, we assure that no threads are about to start or |
108 // exit. It is released again in SafepointSynchronize::end(). |
96 // exit. It is released again in SafepointSynchronize::end(). |
109 Threads_lock->lock(); |
97 Threads_lock->lock(); |
110 |
98 |
510 // Release threads lock, so threads can be created/destroyed again. It will also starts all threads |
498 // Release threads lock, so threads can be created/destroyed again. It will also starts all threads |
511 // blocked in signal_thread_blocked |
499 // blocked in signal_thread_blocked |
512 Threads_lock->unlock(); |
500 Threads_lock->unlock(); |
513 |
501 |
514 } |
502 } |
515 #if INCLUDE_ALL_GCS |
503 Universe::heap()->safepoint_synchronize_end(); |
516 // If there are any concurrent GC threads resume them. |
|
517 if (UseConcMarkSweepGC) { |
|
518 ConcurrentMarkSweepThread::desynchronize(false); |
|
519 } else if (UseG1GC) { |
|
520 SuspendibleThreadSet::desynchronize(); |
|
521 } |
|
522 #endif // INCLUDE_ALL_GCS |
|
523 // record this time so VMThread can keep track how much time has elapsed |
504 // record this time so VMThread can keep track how much time has elapsed |
524 // since last safepoint. |
505 // since last safepoint. |
525 _end_of_last_safepoint = os::javaTimeMillis(); |
506 _end_of_last_safepoint = os::javaTimeMillis(); |
526 |
507 |
527 if (event.should_commit()) { |
508 if (event.should_commit()) { |