50 #include "gc/shenandoah/shenandoahMemoryPool.hpp" |
50 #include "gc/shenandoah/shenandoahMemoryPool.hpp" |
51 #include "gc/shenandoah/shenandoahMetrics.hpp" |
51 #include "gc/shenandoah/shenandoahMetrics.hpp" |
52 #include "gc/shenandoah/shenandoahMonitoringSupport.hpp" |
52 #include "gc/shenandoah/shenandoahMonitoringSupport.hpp" |
53 #include "gc/shenandoah/shenandoahOopClosures.inline.hpp" |
53 #include "gc/shenandoah/shenandoahOopClosures.inline.hpp" |
54 #include "gc/shenandoah/shenandoahPacer.inline.hpp" |
54 #include "gc/shenandoah/shenandoahPacer.inline.hpp" |
55 #include "gc/shenandoah/shenandoahRootProcessor.hpp" |
55 #include "gc/shenandoah/shenandoahRootProcessor.inline.hpp" |
56 #include "gc/shenandoah/shenandoahStringDedup.hpp" |
56 #include "gc/shenandoah/shenandoahStringDedup.hpp" |
57 #include "gc/shenandoah/shenandoahTaskqueue.hpp" |
57 #include "gc/shenandoah/shenandoahTaskqueue.hpp" |
58 #include "gc/shenandoah/shenandoahUtils.hpp" |
58 #include "gc/shenandoah/shenandoahUtils.hpp" |
59 #include "gc/shenandoah/shenandoahVerifier.hpp" |
59 #include "gc/shenandoah/shenandoahVerifier.hpp" |
60 #include "gc/shenandoah/shenandoahCodeRoots.hpp" |
60 #include "gc/shenandoah/shenandoahCodeRoots.hpp" |
1109 void work(uint worker_id) { |
1109 void work(uint worker_id) { |
1110 ShenandoahParallelWorkerSession worker_session(worker_id); |
1110 ShenandoahParallelWorkerSession worker_session(worker_id); |
1111 ShenandoahEvacOOMScope oom_evac_scope; |
1111 ShenandoahEvacOOMScope oom_evac_scope; |
1112 ShenandoahEvacuateUpdateRootsClosure cl; |
1112 ShenandoahEvacuateUpdateRootsClosure cl; |
1113 MarkingCodeBlobClosure blobsCl(&cl, CodeBlobToOopClosure::FixRelocations); |
1113 MarkingCodeBlobClosure blobsCl(&cl, CodeBlobToOopClosure::FixRelocations); |
1114 _rp->process_evacuate_roots(&cl, &blobsCl, worker_id); |
1114 _rp->roots_do(worker_id, &cl); |
1115 } |
1115 } |
1116 }; |
1116 }; |
1117 |
1117 |
1118 void ShenandoahHeap::evacuate_and_update_roots() { |
1118 void ShenandoahHeap::evacuate_and_update_roots() { |
1119 #if defined(COMPILER2) || INCLUDE_JVMCI |
1119 #if defined(COMPILER2) || INCLUDE_JVMCI |
1120 DerivedPointerTable::clear(); |
1120 DerivedPointerTable::clear(); |
1121 #endif |
1121 #endif |
1122 assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Only iterate roots while world is stopped"); |
1122 assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Only iterate roots while world is stopped"); |
1123 |
1123 |
1124 { |
1124 { |
1125 ShenandoahRootEvacuator rp(this, workers()->active_workers(), ShenandoahPhaseTimings::init_evac); |
1125 ShenandoahRootEvacuator rp(workers()->active_workers(), ShenandoahPhaseTimings::init_evac); |
1126 ShenandoahEvacuateUpdateRootsTask roots_task(&rp); |
1126 ShenandoahEvacuateUpdateRootsTask roots_task(&rp); |
1127 workers()->run_task(&roots_task); |
1127 workers()->run_task(&roots_task); |
1128 } |
1128 } |
1129 |
1129 |
1130 #if defined(COMPILER2) || INCLUDE_JVMCI |
1130 #if defined(COMPILER2) || INCLUDE_JVMCI |
1324 _aux_bit_map.clear(); |
1324 _aux_bit_map.clear(); |
1325 |
1325 |
1326 Stack<oop,mtGC> oop_stack; |
1326 Stack<oop,mtGC> oop_stack; |
1327 |
1327 |
1328 // First, we process all GC roots. This populates the work stack with initial objects. |
1328 // First, we process all GC roots. This populates the work stack with initial objects. |
1329 ShenandoahRootProcessor rp(this, 1, ShenandoahPhaseTimings::_num_phases); |
1329 ShenandoahRootScanner rp(1, ShenandoahPhaseTimings::_num_phases); |
1330 ObjectIterateScanRootClosure oops(&_aux_bit_map, &oop_stack); |
1330 ObjectIterateScanRootClosure oops(&_aux_bit_map, &oop_stack); |
1331 CLDToOopClosure clds(&oops, ClassLoaderData::_claim_none); |
1331 rp.roots_do(0, &oops); |
1332 CodeBlobToOopClosure blobs(&oops, false); |
|
1333 rp.process_all_roots(&oops, &clds, &blobs, NULL, 0); |
|
1334 |
1332 |
1335 // Work through the oop stack to traverse heap. |
1333 // Work through the oop stack to traverse heap. |
1336 while (! oop_stack.is_empty()) { |
1334 while (! oop_stack.is_empty()) { |
1337 oop obj = oop_stack.pop(); |
1335 oop obj = oop_stack.pop(); |
1338 assert(oopDesc::is_oop(obj), "must be a valid oop"); |
1336 assert(oopDesc::is_oop(obj), "must be a valid oop"); |