< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp

Print this page
rev 57734 : 8236880: Shenandoah: Move string dedup cleanup into concurrent phase


 133 }
 134 
 135 ShenandoahStringDedupRoots::ShenandoahStringDedupRoots() {
 136   if (ShenandoahStringDedup::is_enabled()) {
 137     StringDedup::gc_prologue(false);
 138   }
 139 }
 140 
 141 ShenandoahStringDedupRoots::~ShenandoahStringDedupRoots() {
 142   if (ShenandoahStringDedup::is_enabled()) {
 143     StringDedup::gc_epilogue();
 144   }
 145 }
 146 
 147 void ShenandoahStringDedupRoots::oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id) {
 148   if (ShenandoahStringDedup::is_enabled()) {
 149     ShenandoahStringDedup::parallel_oops_do(is_alive, keep_alive, worker_id);
 150   }
 151 }
 152 



























 153 ShenandoahRootProcessor::ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase) :
 154   _heap(ShenandoahHeap::heap()),
 155   _phase(phase) {
 156   assert(SafepointSynchronize::is_at_safepoint(), "Must at safepoint");
 157   _heap->phase_timings()->record_workers_start(_phase);
 158 }
 159 
 160 ShenandoahRootProcessor::~ShenandoahRootProcessor() {
 161   assert(SafepointSynchronize::is_at_safepoint(), "Must at safepoint");
 162   _heap->phase_timings()->record_workers_end(_phase);
 163 }
 164 
 165 ShenandoahRootEvacuator::ShenandoahRootEvacuator(uint n_workers,
 166                                                  ShenandoahPhaseTimings::Phase phase,
 167                                                  bool include_concurrent_roots,
 168                                                  bool include_concurrent_code_roots) :
 169   ShenandoahRootProcessor(phase),
 170   _thread_roots(n_workers > 1),
 171   _include_concurrent_roots(include_concurrent_roots),
 172   _include_concurrent_code_roots(include_concurrent_code_roots) {
 173 }
 174 
 175 void ShenandoahRootEvacuator::roots_do(uint worker_id, OopClosure* oops) {
 176   MarkingCodeBlobClosure blobsCl(oops, CodeBlobToOopClosure::FixRelocations);
 177   ShenandoahCodeBlobAndDisarmClosure blobs_and_disarm_Cl(oops);
 178   CodeBlobToOopClosure* codes_cl = ShenandoahConcurrentRoots::can_do_concurrent_class_unloading() ?
 179                                    static_cast<CodeBlobToOopClosure*>(&blobs_and_disarm_Cl) :
 180                                    static_cast<CodeBlobToOopClosure*>(&blobsCl);
 181   AlwaysTrueClosure always_true;
 182 
 183   _serial_roots.oops_do(oops, worker_id);
 184   _serial_weak_roots.weak_oops_do(oops, worker_id);
 185   if (_include_concurrent_roots) {
 186     CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong);
 187     _vm_roots.oops_do<OopClosure>(oops, worker_id);
 188     _cld_roots.cld_do(&clds, worker_id);
 189     _weak_roots.oops_do<OopClosure>(oops, worker_id);

 190   }
 191 
 192   if (_include_concurrent_code_roots) {
 193     _code_roots.code_blobs_do(codes_cl, worker_id);
 194     _thread_roots.oops_do(oops, NULL, worker_id);
 195   } else {
 196     _thread_roots.oops_do(oops, codes_cl, worker_id);
 197   }
 198 
 199   _dedup_roots.oops_do(&always_true, oops, worker_id);
 200 }
 201 
 202 ShenandoahRootUpdater::ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase) :
 203   ShenandoahRootProcessor(phase),
 204   _thread_roots(n_workers > 1) {
 205 }
 206 
 207 ShenandoahRootAdjuster::ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase) :
 208   ShenandoahRootProcessor(phase),
 209   _thread_roots(n_workers > 1) {
 210   assert(ShenandoahHeap::heap()->is_full_gc_in_progress(), "Full GC only");
 211 }
 212 
 213 void ShenandoahRootAdjuster::roots_do(uint worker_id, OopClosure* oops) {
 214   CodeBlobToOopClosure code_blob_cl(oops, CodeBlobToOopClosure::FixRelocations);
 215   ShenandoahCodeBlobAndDisarmClosure blobs_and_disarm_Cl(oops);
 216   CodeBlobToOopClosure* adjust_code_closure = ShenandoahConcurrentRoots::can_do_concurrent_class_unloading() ?
 217                                               static_cast<CodeBlobToOopClosure*>(&blobs_and_disarm_Cl) :
 218                                               static_cast<CodeBlobToOopClosure*>(&code_blob_cl);
 219   CLDToOopClosure adjust_cld_closure(oops, ClassLoaderData::_claim_strong);




 133 }
 134 
 135 ShenandoahStringDedupRoots::ShenandoahStringDedupRoots() {
 136   if (ShenandoahStringDedup::is_enabled()) {
 137     StringDedup::gc_prologue(false);
 138   }
 139 }
 140 
 141 ShenandoahStringDedupRoots::~ShenandoahStringDedupRoots() {
 142   if (ShenandoahStringDedup::is_enabled()) {
 143     StringDedup::gc_epilogue();
 144   }
 145 }
 146 
 147 void ShenandoahStringDedupRoots::oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id) {
 148   if (ShenandoahStringDedup::is_enabled()) {
 149     ShenandoahStringDedup::parallel_oops_do(is_alive, keep_alive, worker_id);
 150   }
 151 }
 152 
 153 ShenandoahConcurrentStringDedupRoots::ShenandoahConcurrentStringDedupRoots() {
 154   if (ShenandoahStringDedup::is_enabled()) {
 155     StringDedup::gc_prologue(true);
 156     StringDedupTable_lock->lock_without_safepoint_check();
 157     StringDedupQueue_lock->lock_without_safepoint_check();
 158   }
 159 }
 160 
 161 ShenandoahConcurrentStringDedupRoots::~ShenandoahConcurrentStringDedupRoots() {
 162   if (ShenandoahStringDedup::is_enabled()) {
 163     StringDedup::gc_epilogue();
 164     StringDedupQueue_lock->unlock();
 165     StringDedupTable_lock->unlock();
 166   }
 167 }
 168 
 169 void ShenandoahConcurrentStringDedupRoots::oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id) {
 170   if (ShenandoahStringDedup::is_enabled()) {
 171     assert_locked_or_safepoint_weak(StringDedupQueue_lock);
 172     assert_locked_or_safepoint_weak(StringDedupTable_lock);
 173 
 174     StringDedupUnlinkOrOopsDoClosure sd_cl(is_alive, keep_alive);
 175     StringDedupQueue::unlink_or_oops_do(&sd_cl);
 176     StringDedupTable::unlink_or_oops_do(&sd_cl, worker_id);
 177   }
 178 }
 179 
 180 ShenandoahRootProcessor::ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase) :
 181   _heap(ShenandoahHeap::heap()),
 182   _phase(phase) {
 183   assert(SafepointSynchronize::is_at_safepoint(), "Must at safepoint");
 184   _heap->phase_timings()->record_workers_start(_phase);
 185 }
 186 
 187 ShenandoahRootProcessor::~ShenandoahRootProcessor() {
 188   assert(SafepointSynchronize::is_at_safepoint(), "Must at safepoint");
 189   _heap->phase_timings()->record_workers_end(_phase);
 190 }
 191 
 192 ShenandoahRootEvacuator::ShenandoahRootEvacuator(uint n_workers,
 193                                                  ShenandoahPhaseTimings::Phase phase,
 194                                                  bool include_concurrent_roots,
 195                                                  bool include_concurrent_code_roots) :
 196   ShenandoahRootProcessor(phase),
 197   _thread_roots(n_workers > 1),
 198   _include_concurrent_roots(include_concurrent_roots),
 199   _include_concurrent_code_roots(include_concurrent_code_roots) {
 200 }
 201 
 202 void ShenandoahRootEvacuator::roots_do(uint worker_id, OopClosure* oops) {
 203   MarkingCodeBlobClosure blobsCl(oops, CodeBlobToOopClosure::FixRelocations);
 204   ShenandoahCodeBlobAndDisarmClosure blobs_and_disarm_Cl(oops);
 205   CodeBlobToOopClosure* codes_cl = ShenandoahConcurrentRoots::can_do_concurrent_class_unloading() ?
 206                                    static_cast<CodeBlobToOopClosure*>(&blobs_and_disarm_Cl) :
 207                                    static_cast<CodeBlobToOopClosure*>(&blobsCl);
 208   AlwaysTrueClosure always_true;
 209 
 210   _serial_roots.oops_do(oops, worker_id);
 211   _serial_weak_roots.weak_oops_do(oops, worker_id);
 212   if (_include_concurrent_roots) {
 213     CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong);
 214     _vm_roots.oops_do<OopClosure>(oops, worker_id);
 215     _cld_roots.cld_do(&clds, worker_id);
 216     _weak_roots.oops_do<OopClosure>(oops, worker_id);
 217     _dedup_roots.oops_do(&always_true, oops, worker_id);
 218   }
 219 
 220   if (_include_concurrent_code_roots) {
 221     _code_roots.code_blobs_do(codes_cl, worker_id);
 222     _thread_roots.oops_do(oops, NULL, worker_id);
 223   } else {
 224     _thread_roots.oops_do(oops, codes_cl, worker_id);
 225   }


 226 }
 227 
 228 ShenandoahRootUpdater::ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase) :
 229   ShenandoahRootProcessor(phase),
 230   _thread_roots(n_workers > 1) {
 231 }
 232 
 233 ShenandoahRootAdjuster::ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase) :
 234   ShenandoahRootProcessor(phase),
 235   _thread_roots(n_workers > 1) {
 236   assert(ShenandoahHeap::heap()->is_full_gc_in_progress(), "Full GC only");
 237 }
 238 
 239 void ShenandoahRootAdjuster::roots_do(uint worker_id, OopClosure* oops) {
 240   CodeBlobToOopClosure code_blob_cl(oops, CodeBlobToOopClosure::FixRelocations);
 241   ShenandoahCodeBlobAndDisarmClosure blobs_and_disarm_Cl(oops);
 242   CodeBlobToOopClosure* adjust_code_closure = ShenandoahConcurrentRoots::can_do_concurrent_class_unloading() ?
 243                                               static_cast<CodeBlobToOopClosure*>(&blobs_and_disarm_Cl) :
 244                                               static_cast<CodeBlobToOopClosure*>(&code_blob_cl);
 245   CLDToOopClosure adjust_cld_closure(oops, ClassLoaderData::_claim_strong);


< prev index next >