diff -r f5e6ef11d24b -r ac8da6513351 hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp --- a/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp Fri Nov 06 09:58:06 2015 -0800 +++ b/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp Mon Nov 09 09:19:39 2015 +0100 @@ -279,8 +279,8 @@ } else { assert(hr->is_empty(), "Should have been cleared in phase 2."); } - hr->reset_during_compaction(); } + hr->reset_during_compaction(); } else if (!hr->is_pinned()) { hr->compact(); } @@ -334,9 +334,6 @@ HeapWord* end = hr->end(); FreeRegionList dummy_free_list("Dummy Free List for G1MarkSweep"); - assert(hr->is_starts_humongous(), - "Only the start of a humongous region should be freed."); - hr->set_containing_set(NULL); _humongous_regions_removed.increment(1u, hr->capacity()); @@ -373,15 +370,12 @@ bool G1PrepareCompactClosure::doHeapRegion(HeapRegion* hr) { if (hr->is_humongous()) { - if (hr->is_starts_humongous()) { - oop obj = oop(hr->bottom()); - if (obj->is_gc_marked()) { - obj->forward_to(obj); - } else { - free_humongous_region(hr); - } - } else { - assert(hr->is_continues_humongous(), "Invalid humongous."); + oop obj = oop(hr->humongous_start_region()->bottom()); + if (hr->is_starts_humongous() && obj->is_gc_marked()) { + obj->forward_to(obj); + } + if (!obj->is_gc_marked()) { + free_humongous_region(hr); } } else if (!hr->is_pinned()) { prepare_for_compaction(hr, hr->end());