Mercurial > hg > jdk9-shenandoah > hotspot
changeset 9623:261ef52a9f2f
Several smaller fixes to mark-compact: Fix derived pointers, more efficient next-compaction-region, initialize freed humongous regions correctly.
author | rkennke |
---|---|
date | Fri, 18 Sep 2015 15:44:29 +0200 |
parents | 263be3296c38 |
children | 790069ea3727 |
files | src/share/vm/gc/shenandoah/shenandoahHeap.cpp src/share/vm/gc/shenandoah/shenandoahHeap.hpp src/share/vm/gc/shenandoah/shenandoahHeapRegion.cpp src/share/vm/gc/shenandoah/shenandoahHeapRegion.hpp src/share/vm/gc/shenandoah/shenandoahMarkCompact.cpp |
diffstat | 5 files changed, 27 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/gc/shenandoah/shenandoahHeap.cpp Wed Sep 16 17:22:25 2015 +0200 +++ b/src/share/vm/gc/shenandoah/shenandoahHeap.cpp Fri Sep 18 15:44:29 2015 +0200 @@ -2849,11 +2849,13 @@ } ShenandoahHeapRegion* ShenandoahHeap::next_compaction_region(const ShenandoahHeapRegion* r) { - HeapWord* next_addr = r->bottom() + ShenandoahHeapRegion::RegionSizeBytes / HeapWordSize; - ShenandoahHeapRegion* next = heap_region_containing(next_addr); - if (next->is_humongous()) { - return next_compaction_region(next); - } else { - return next; + int region_idx = r->region_number() + 1; + ShenandoahHeapRegion* next = _ordered_regions[region_idx]; + guarantee(next->region_number() == region_idx, "region number must match"); + while (next->is_humongous()) { + region_idx = next->region_number() + 1; + next = _ordered_regions[region_idx]; + guarantee(next->region_number() == region_idx, "region number must match"); } + return next; }
--- a/src/share/vm/gc/shenandoah/shenandoahHeap.hpp Wed Sep 16 17:22:25 2015 +0200 +++ b/src/share/vm/gc/shenandoah/shenandoahHeap.hpp Fri Sep 18 15:44:29 2015 +0200 @@ -315,8 +315,6 @@ static ByteSize ordered_regions_offset() { return byte_offset_of(ShenandoahHeap, _ordered_regions); } static ByteSize first_region_bottom_offset() { return byte_offset_of(ShenandoahHeap, _first_region_bottom); } - // Where the first object may be placed. - HeapWord* start_of_heap() { return _first_region_bottom + 1;} void cleanup_after_cancelconcgc(); void increase_used(size_t bytes); void decrease_used(size_t bytes);
--- a/src/share/vm/gc/shenandoah/shenandoahHeapRegion.cpp Wed Sep 16 17:22:25 2015 +0200 +++ b/src/share/vm/gc/shenandoah/shenandoahHeapRegion.cpp Fri Sep 18 15:44:29 2015 +0200 @@ -29,7 +29,7 @@ return JNI_OK; } -int ShenandoahHeapRegion::region_number() { +int ShenandoahHeapRegion::region_number() const { return _region_number; }
--- a/src/share/vm/gc/shenandoah/shenandoahHeapRegion.hpp Wed Sep 16 17:22:25 2015 +0200 +++ b/src/share/vm/gc/shenandoah/shenandoahHeapRegion.hpp Fri Sep 18 15:44:29 2015 +0200 @@ -70,7 +70,7 @@ jint initialize_heap_region(HeapWord* start, size_t regionSize, int index); - int region_number(); + int region_number() const; // Roll back the previous allocation of an object with specified size. // Returns TRUE when successful, FALSE if not successful or not supported.
--- a/src/share/vm/gc/shenandoah/shenandoahMarkCompact.cpp Wed Sep 16 17:22:25 2015 +0200 +++ b/src/share/vm/gc/shenandoah/shenandoahMarkCompact.cpp Fri Sep 18 15:44:29 2015 +0200 @@ -28,6 +28,9 @@ } void ShenandoahMarkCompact::do_mark_compact() { + + COMPILER2_PRESENT(DerivedPointerTable::clear()); + ShenandoahHeap* _heap = ShenandoahHeap::heap(); assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); @@ -137,6 +140,8 @@ _heap->set_need_update_refs(false); + COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); + _heap->shenandoahPolicy()->record_phase_end(ShenandoahCollectorPolicy::full_gc); } @@ -187,6 +192,10 @@ UpdateRefsClosure uprefs; CLDToOopClosure cld_uprefs(&uprefs); ClassLoaderDataGraph::roots_cld_do(NULL, &cld_uprefs); + + // Same for weak JNI handles. + ShenandoahAlwaysTrueClosure always_true; + JNIHandles::weak_oops_do(&always_true, &uprefs); } _heap->shenandoahPolicy()->record_phase_start(ShenandoahCollectorPolicy::weakrefs); @@ -259,7 +268,7 @@ if (!r->is_humongous()) { if (_cp.space == NULL) { _cp.space = r; - _cp.threshold = _heap->start_of_heap(); + _cp.threshold = r->initialize_threshold(); } _dead_humongous = false; r->prepare_for_compaction(&_cp); @@ -272,15 +281,21 @@ } else { if (_cp.space == NULL) { _cp.space = r; - _cp.threshold = _heap->start_of_heap(); + _cp.threshold = r->initialize_threshold(); } _dead_humongous = true; + guarantee(r->region_number() > ((ShenandoahHeapRegion*)_cp.space)->region_number(), + "only reset regions that are not yet used for compaction"); r->reset(); + r->prepare_for_compaction(&_cp); } } else { assert(r->is_humongous_continuation(), "expect humongous continuation"); if (_dead_humongous) { + guarantee(r->region_number() > ((ShenandoahHeapRegion*)_cp.space)->region_number(), + "only reset regions that are not yet used for compaction"); r->reset(); + r->prepare_for_compaction(&_cp); } } }