Mercurial > hg > jdk9-shenandoah > hotspot
changeset 9620:818dd82363ec
Update references in weak roots too, in mark-compact.
author | rkennke |
---|---|
date | Wed, 16 Sep 2015 17:21:25 +0200 |
parents | 40d499730aad |
children | b00a25e45cd9 |
files | src/share/vm/gc/shenandoah/shenandoahMarkCompact.cpp |
diffstat | 1 files changed, 37 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/gc/shenandoah/shenandoahMarkCompact.cpp Wed Sep 16 17:21:00 2015 +0200 +++ b/src/share/vm/gc/shenandoah/shenandoahMarkCompact.cpp Wed Sep 16 17:21:25 2015 +0200 @@ -139,25 +139,56 @@ _heap->shenandoahPolicy()->record_phase_end(ShenandoahCollectorPolicy::full_gc); } - + +class UpdateRefsClosure: public ExtendedOopClosure { +public: + virtual void do_oop(oop* p) { + oop obj = oopDesc::load_heap_oop(p); + if (! oopDesc::is_null(obj)) { + ShenandoahBarrierSet::resolve_and_update_oop_static(p, obj); + } + } + virtual void do_oop(narrowOop* p) { + Unimplemented(); + } +}; + void ShenandoahMarkCompact::phase1_mark_heap() { ShenandoahHeap* _heap = ShenandoahHeap::heap(); ReferenceProcessor* rp = _heap->ref_processor(); MarkSweep::_ref_processor = rp; - // Need cleared claim bits for the roots processing - ClassLoaderDataGraph::clear_claimed_marks(); - - MarkingCodeBlobClosure follow_code_closure(&MarkSweep::follow_root_closure, !CodeBlobToOopClosure::FixRelocations); + // First, update _all_ references in GC roots to point to to-space. { + // Need cleared claim bits for the roots processing + /* + ClassLoaderDataGraph::clear_claimed_marks(); + UpdateRefsClosure uprefs; + CLDToOopClosure cld_uprefs(&uprefs); + CodeBlobToOopClosure code_uprefs(&uprefs, CodeBlobToOopClosure::FixRelocations); + ShenandoahRootProcessor rp(_heap, 1); + rp.process_all_roots(&uprefs, + &cld_uprefs, + &code_uprefs); + */ + } + + { + MarkingCodeBlobClosure follow_code_closure(&MarkSweep::follow_root_closure, CodeBlobToOopClosure::FixRelocations); + // Need cleared claim bits for the roots processing + ClassLoaderDataGraph::clear_claimed_marks(); ShenandoahRootProcessor rp(_heap, 1); rp.process_strong_roots(&MarkSweep::follow_root_closure, &MarkSweep::follow_cld_closure, &follow_code_closure); + + // Also update (without marking) weak CLD refs, in case they're reachable. + UpdateRefsClosure uprefs; + CLDToOopClosure cld_uprefs(&uprefs); + ClassLoaderDataGraph::roots_cld_do(NULL, &cld_uprefs); } - _heap->shenandoahPolicy()->record_phase_start(ShenandoahCollectorPolicy::weakrefs); bool clear_soft_refs = false; //fixme rp->setup_policy(clear_soft_refs);