< prev index next >

src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp

Print this page




 251     // wait until started is set.
 252     sleep_before_next_cycle();
 253     if (should_terminate()) {
 254       break;
 255     }
 256 
 257     cpmanager.set_phase(G1ConcurrentPhase::CONCURRENT_CYCLE, false /* force */);
 258 
 259     GCIdMark gc_id_mark;
 260 
 261     _cm->concurrent_cycle_start();
 262 
 263     GCTraceConcTime(Info, gc) tt("Concurrent Cycle");
 264     {
 265       ResourceMark rm;
 266       HandleMark   hm;
 267       double cycle_start = os::elapsedVTime();
 268 
 269       {
 270         G1ConcPhase p(G1ConcurrentPhase::CLEAR_CLAIMED_MARKS, this);

 271         ClassLoaderDataGraph::clear_claimed_marks();
 272       }
 273 
 274       // We have to ensure that we finish scanning the root regions
 275       // before the next GC takes place. To ensure this we have to
 276       // make sure that we do not join the STS until the root regions
 277       // have been scanned. If we did then it's possible that a
 278       // subsequent GC could block us from joining the STS and proceed
 279       // without the root regions have been scanned which would be a
 280       // correctness issue.
 281 
 282       {
 283         G1ConcPhase p(G1ConcurrentPhase::SCAN_ROOT_REGIONS, this);
 284         _cm->scan_root_regions();
 285       }
 286 
 287       // It would be nice to use the G1ConcPhase class here but
 288       // the "end" logging is inside the loop and not at the end of
 289       // a scope. Also, the timer doesn't support nesting.
 290       // Mimicking the same log output instead.




 251     // wait until started is set.
 252     sleep_before_next_cycle();
 253     if (should_terminate()) {
 254       break;
 255     }
 256 
 257     cpmanager.set_phase(G1ConcurrentPhase::CONCURRENT_CYCLE, false /* force */);
 258 
 259     GCIdMark gc_id_mark;
 260 
 261     _cm->concurrent_cycle_start();
 262 
 263     GCTraceConcTime(Info, gc) tt("Concurrent Cycle");
 264     {
 265       ResourceMark rm;
 266       HandleMark   hm;
 267       double cycle_start = os::elapsedVTime();
 268 
 269       {
 270         G1ConcPhase p(G1ConcurrentPhase::CLEAR_CLAIMED_MARKS, this);
 271         MutexLocker ml(ClassLoaderDataGraph_lock);
 272         ClassLoaderDataGraph::clear_claimed_marks();
 273       }
 274 
 275       // We have to ensure that we finish scanning the root regions
 276       // before the next GC takes place. To ensure this we have to
 277       // make sure that we do not join the STS until the root regions
 278       // have been scanned. If we did then it's possible that a
 279       // subsequent GC could block us from joining the STS and proceed
 280       // without the root regions have been scanned which would be a
 281       // correctness issue.
 282 
 283       {
 284         G1ConcPhase p(G1ConcurrentPhase::SCAN_ROOT_REGIONS, this);
 285         _cm->scan_root_regions();
 286       }
 287 
 288       // It would be nice to use the G1ConcPhase class here but
 289       // the "end" logging is inside the loop and not at the end of
 290       // a scope. Also, the timer doesn't support nesting.
 291       // Mimicking the same log output instead.


< prev index next >