Tue, 19 May 2015 15:49:27 +0200
8061715: gc/g1/TestShrinkAuxiliaryData15.java fails with java.lang.RuntimeException: heap decommit failed - after > before
Summary: added WhiteBox methods to count regions and exact aux data sizes
Reviewed-by: jwilhelm, brutisso
ysr@777 | 1 | /* |
pliden@6413 | 2 | * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
ysr@777 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ysr@777 | 4 | * |
ysr@777 | 5 | * This code is free software; you can redistribute it and/or modify it |
ysr@777 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ysr@777 | 7 | * published by the Free Software Foundation. |
ysr@777 | 8 | * |
ysr@777 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ysr@777 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ysr@777 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ysr@777 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
ysr@777 | 13 | * accompanied this code). |
ysr@777 | 14 | * |
ysr@777 | 15 | * You should have received a copy of the GNU General Public License version |
ysr@777 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
ysr@777 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ysr@777 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
ysr@777 | 22 | * |
ysr@777 | 23 | */ |
ysr@777 | 24 | |
stefank@2314 | 25 | #include "precompiled.hpp" |
stefank@2314 | 26 | #include "classfile/javaClasses.hpp" |
stefank@2314 | 27 | #include "classfile/symbolTable.hpp" |
stefank@2314 | 28 | #include "classfile/systemDictionary.hpp" |
stefank@2314 | 29 | #include "classfile/vmSymbols.hpp" |
stefank@2314 | 30 | #include "code/codeCache.hpp" |
stefank@2314 | 31 | #include "code/icBuffer.hpp" |
brutisso@3710 | 32 | #include "gc_implementation/g1/g1Log.hpp" |
stefank@2314 | 33 | #include "gc_implementation/g1/g1MarkSweep.hpp" |
mgerdin@7659 | 34 | #include "gc_implementation/g1/g1RootProcessor.hpp" |
pliden@6413 | 35 | #include "gc_implementation/g1/g1StringDedup.hpp" |
sla@5237 | 36 | #include "gc_implementation/shared/gcHeapSummary.hpp" |
sla@5237 | 37 | #include "gc_implementation/shared/gcTimer.hpp" |
sla@5237 | 38 | #include "gc_implementation/shared/gcTrace.hpp" |
sla@5237 | 39 | #include "gc_implementation/shared/gcTraceTime.hpp" |
stefank@2314 | 40 | #include "memory/gcLocker.hpp" |
stefank@2314 | 41 | #include "memory/genCollectedHeap.hpp" |
stefank@2314 | 42 | #include "memory/modRefBarrierSet.hpp" |
stefank@2314 | 43 | #include "memory/referencePolicy.hpp" |
stefank@2314 | 44 | #include "memory/space.hpp" |
stefank@2314 | 45 | #include "oops/instanceRefKlass.hpp" |
stefank@2314 | 46 | #include "oops/oop.inline.hpp" |
stefank@2314 | 47 | #include "prims/jvmtiExport.hpp" |
stefank@2314 | 48 | #include "runtime/biasedLocking.hpp" |
stefank@2314 | 49 | #include "runtime/fprofiler.hpp" |
stefank@2314 | 50 | #include "runtime/synchronizer.hpp" |
stefank@2314 | 51 | #include "runtime/thread.hpp" |
stefank@2314 | 52 | #include "runtime/vmThread.hpp" |
stefank@2314 | 53 | #include "utilities/copy.hpp" |
stefank@2314 | 54 | #include "utilities/events.hpp" |
ysr@777 | 55 | |
ysr@777 | 56 | class HeapRegion; |
ysr@777 | 57 | |
ysr@777 | 58 | void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, |
ysr@777 | 59 | bool clear_all_softrefs) { |
ysr@777 | 60 | assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); |
ysr@777 | 61 | |
jmasa@1822 | 62 | SharedHeap* sh = SharedHeap::heap(); |
jmasa@1822 | 63 | #ifdef ASSERT |
jmasa@1822 | 64 | if (sh->collector_policy()->should_clear_all_soft_refs()) { |
jmasa@1822 | 65 | assert(clear_all_softrefs, "Policy should have been checked earler"); |
jmasa@1822 | 66 | } |
jmasa@1822 | 67 | #endif |
ysr@777 | 68 | // hook up weak ref data so it can be used during Mark-Sweep |
ysr@777 | 69 | assert(GenMarkSweep::ref_processor() == NULL, "no stomping"); |
ysr@888 | 70 | assert(rp != NULL, "should be non-NULL"); |
johnc@3175 | 71 | assert(rp == G1CollectedHeap::heap()->ref_processor_stw(), "Precondition"); |
johnc@3175 | 72 | |
ysr@777 | 73 | GenMarkSweep::_ref_processor = rp; |
ysr@892 | 74 | rp->setup_policy(clear_all_softrefs); |
ysr@777 | 75 | |
coleenp@4037 | 76 | // When collecting the permanent generation Method*s may be moving, |
ysr@777 | 77 | // so we either have to flush all bcp data or convert it into bci. |
ysr@777 | 78 | CodeCache::gc_prologue(); |
ysr@777 | 79 | Threads::gc_prologue(); |
ysr@777 | 80 | |
ysr@777 | 81 | bool marked_for_unloading = false; |
ysr@777 | 82 | |
ysr@777 | 83 | allocate_stacks(); |
ysr@777 | 84 | |
iveresov@793 | 85 | // We should save the marks of the currently locked biased monitors. |
iveresov@793 | 86 | // The marking doesn't preserve the marks of biased objects. |
iveresov@793 | 87 | BiasedLocking::preserve_marks(); |
iveresov@793 | 88 | |
ysr@777 | 89 | mark_sweep_phase1(marked_for_unloading, clear_all_softrefs); |
ysr@777 | 90 | |
ysr@777 | 91 | mark_sweep_phase2(); |
ysr@777 | 92 | |
ysr@777 | 93 | // Don't add any more derived pointers during phase3 |
ysr@777 | 94 | COMPILER2_PRESENT(DerivedPointerTable::set_active(false)); |
ysr@777 | 95 | |
ysr@777 | 96 | mark_sweep_phase3(); |
ysr@777 | 97 | |
ysr@777 | 98 | mark_sweep_phase4(); |
ysr@777 | 99 | |
ysr@777 | 100 | GenMarkSweep::restore_marks(); |
iveresov@793 | 101 | BiasedLocking::restore_marks(); |
ysr@777 | 102 | GenMarkSweep::deallocate_stacks(); |
ysr@777 | 103 | |
ysr@777 | 104 | // "free at last gc" is calculated from these. |
ysr@777 | 105 | // CHF: cheating for now!!! |
ysr@777 | 106 | // Universe::set_heap_capacity_at_last_gc(Universe::heap()->capacity()); |
ysr@777 | 107 | // Universe::set_heap_used_at_last_gc(Universe::heap()->used()); |
ysr@777 | 108 | |
ysr@777 | 109 | Threads::gc_epilogue(); |
ysr@777 | 110 | CodeCache::gc_epilogue(); |
kamg@2467 | 111 | JvmtiExport::gc_epilogue(); |
ysr@777 | 112 | |
ysr@777 | 113 | // refs processing: clean slate |
ysr@777 | 114 | GenMarkSweep::_ref_processor = NULL; |
ysr@777 | 115 | } |
ysr@777 | 116 | |
ysr@777 | 117 | |
ysr@777 | 118 | void G1MarkSweep::allocate_stacks() { |
ysr@777 | 119 | GenMarkSweep::_preserved_count_max = 0; |
ysr@777 | 120 | GenMarkSweep::_preserved_marks = NULL; |
ysr@777 | 121 | GenMarkSweep::_preserved_count = 0; |
ysr@777 | 122 | } |
ysr@777 | 123 | |
ysr@777 | 124 | void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading, |
ysr@777 | 125 | bool clear_all_softrefs) { |
ysr@777 | 126 | // Recursively traverse all live objects and mark them |
brutisso@6904 | 127 | GCTraceTime tm("phase 1", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id()); |
ysr@777 | 128 | GenMarkSweep::trace(" 1"); |
ysr@777 | 129 | |
mgerdin@7659 | 130 | G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
ysr@777 | 131 | |
stefank@6992 | 132 | // Need cleared claim bits for the roots processing |
coleenp@4037 | 133 | ClassLoaderDataGraph::clear_claimed_marks(); |
coleenp@4037 | 134 | |
stefank@6992 | 135 | MarkingCodeBlobClosure follow_code_closure(&GenMarkSweep::follow_root_closure, !CodeBlobToOopClosure::FixRelocations); |
mgerdin@7659 | 136 | { |
mgerdin@7659 | 137 | G1RootProcessor root_processor(g1h); |
mgerdin@7659 | 138 | root_processor.process_strong_roots(&GenMarkSweep::follow_root_closure, |
mgerdin@7659 | 139 | &GenMarkSweep::follow_cld_closure, |
mgerdin@7659 | 140 | &follow_code_closure); |
mgerdin@7659 | 141 | } |
ysr@777 | 142 | |
ysr@777 | 143 | // Process reference objects found during marking |
ysr@888 | 144 | ReferenceProcessor* rp = GenMarkSweep::ref_processor(); |
mgerdin@7659 | 145 | assert(rp == g1h->ref_processor_stw(), "Sanity"); |
johnc@3175 | 146 | |
ysr@892 | 147 | rp->setup_policy(clear_all_softrefs); |
sla@5237 | 148 | const ReferenceProcessorStats& stats = |
sla@5237 | 149 | rp->process_discovered_references(&GenMarkSweep::is_alive, |
sla@5237 | 150 | &GenMarkSweep::keep_alive, |
sla@5237 | 151 | &GenMarkSweep::follow_stack_closure, |
sla@5237 | 152 | NULL, |
brutisso@6904 | 153 | gc_timer(), |
brutisso@6904 | 154 | gc_tracer()->gc_id()); |
sla@5237 | 155 | gc_tracer()->report_gc_reference_stats(stats); |
ysr@777 | 156 | |
stefank@5020 | 157 | |
stefank@5020 | 158 | // This is the point where the entire marking should have completed. |
stefank@5020 | 159 | assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed"); |
stefank@5020 | 160 | |
stefank@5020 | 161 | // Unload classes and purge the SystemDictionary. |
ysr@777 | 162 | bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive); |
ysr@777 | 163 | |
stefank@5020 | 164 | // Unload nmethods. |
brutisso@4098 | 165 | CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class); |
ysr@777 | 166 | |
stefank@5020 | 167 | // Prune dead klasses from subklass/sibling/implementor lists. |
coleenp@4037 | 168 | Klass::clean_weak_klass_links(&GenMarkSweep::is_alive); |
ysr@777 | 169 | |
tschatzl@6229 | 170 | // Delete entries for dead interned string and clean up unreferenced symbols in symbol table. |
tschatzl@6229 | 171 | G1CollectedHeap::heap()->unlink_string_and_symbol_table(&GenMarkSweep::is_alive); |
ysr@777 | 172 | |
johnc@2969 | 173 | if (VerifyDuringGC) { |
johnc@2969 | 174 | HandleMark hm; // handle scope |
johnc@2969 | 175 | COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact); |
johnc@2969 | 176 | Universe::heap()->prepare_for_verify(); |
johnc@2969 | 177 | // Note: we can verify only the heap here. When an object is |
johnc@2969 | 178 | // marked, the previous value of the mark word (including |
johnc@2969 | 179 | // identity hash values, ages, etc) is preserved, and the mark |
johnc@2969 | 180 | // word is set to markOop::marked_value - effectively removing |
johnc@2969 | 181 | // any hash values from the mark word. These hash values are |
johnc@2969 | 182 | // used when verifying the dictionaries and so removing them |
johnc@2969 | 183 | // from the mark word can make verification of the dictionaries |
johnc@2969 | 184 | // fail. At the end of the GC, the orginal mark word values |
johnc@2969 | 185 | // (including hash values) are restored to the appropriate |
johnc@2969 | 186 | // objects. |
stefank@5018 | 187 | if (!VerifySilently) { |
stefank@5018 | 188 | gclog_or_tty->print(" VerifyDuringGC:(full)[Verifying "); |
stefank@5018 | 189 | } |
stefank@5018 | 190 | Universe::heap()->verify(VerifySilently, VerifyOption_G1UseMarkWord); |
stefank@5018 | 191 | if (!VerifySilently) { |
stefank@5018 | 192 | gclog_or_tty->print_cr("]"); |
stefank@5018 | 193 | } |
johnc@2969 | 194 | } |
sla@5237 | 195 | |
sla@5237 | 196 | gc_tracer()->report_object_count_after_gc(&GenMarkSweep::is_alive); |
ysr@777 | 197 | } |
ysr@777 | 198 | |
apetrusenko@1112 | 199 | |
ysr@777 | 200 | void G1MarkSweep::mark_sweep_phase2() { |
ysr@777 | 201 | // Now all live objects are marked, compute the new object addresses. |
ysr@777 | 202 | |
ysr@777 | 203 | // It is not required that we traverse spaces in the same order in |
ysr@777 | 204 | // phase2, phase3 and phase4, but the ValidateMarkSweep live oops |
ysr@777 | 205 | // tracking expects us to do so. See comment under phase4. |
ysr@777 | 206 | |
brutisso@6904 | 207 | GCTraceTime tm("phase 2", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id()); |
ysr@777 | 208 | GenMarkSweep::trace("2"); |
ysr@777 | 209 | |
sjohanss@7131 | 210 | prepare_compaction(); |
ysr@777 | 211 | } |
ysr@777 | 212 | |
ysr@777 | 213 | class G1AdjustPointersClosure: public HeapRegionClosure { |
ysr@777 | 214 | public: |
ysr@777 | 215 | bool doHeapRegion(HeapRegion* r) { |
ysr@777 | 216 | if (r->isHumongous()) { |
ysr@777 | 217 | if (r->startsHumongous()) { |
ysr@777 | 218 | // We must adjust the pointers on the single H object. |
ysr@777 | 219 | oop obj = oop(r->bottom()); |
ysr@777 | 220 | // point all the oops to the new location |
ysr@777 | 221 | obj->adjust_pointers(); |
ysr@777 | 222 | } |
ysr@777 | 223 | } else { |
ysr@777 | 224 | // This really ought to be "as_CompactibleSpace"... |
ysr@777 | 225 | r->adjust_pointers(); |
ysr@777 | 226 | } |
ysr@777 | 227 | return false; |
ysr@777 | 228 | } |
ysr@777 | 229 | }; |
ysr@777 | 230 | |
mgerdin@7659 | 231 | class G1AlwaysTrueClosure: public BoolObjectClosure { |
mgerdin@7659 | 232 | public: |
mgerdin@7659 | 233 | bool do_object_b(oop p) { return true; } |
mgerdin@7659 | 234 | }; |
mgerdin@7659 | 235 | static G1AlwaysTrueClosure always_true; |
mgerdin@7659 | 236 | |
ysr@777 | 237 | void G1MarkSweep::mark_sweep_phase3() { |
ysr@777 | 238 | G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
ysr@777 | 239 | |
ysr@777 | 240 | // Adjust the pointers to reflect the new locations |
brutisso@6904 | 241 | GCTraceTime tm("phase 3", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id()); |
ysr@777 | 242 | GenMarkSweep::trace("3"); |
ysr@777 | 243 | |
stefank@6992 | 244 | // Need cleared claim bits for the roots processing |
coleenp@4037 | 245 | ClassLoaderDataGraph::clear_claimed_marks(); |
coleenp@4037 | 246 | |
stefank@6992 | 247 | CodeBlobToOopClosure adjust_code_closure(&GenMarkSweep::adjust_pointer_closure, CodeBlobToOopClosure::FixRelocations); |
mgerdin@7659 | 248 | { |
mgerdin@7659 | 249 | G1RootProcessor root_processor(g1h); |
mgerdin@7659 | 250 | root_processor.process_all_roots(&GenMarkSweep::adjust_pointer_closure, |
mgerdin@7659 | 251 | &GenMarkSweep::adjust_cld_closure, |
mgerdin@7659 | 252 | &adjust_code_closure); |
mgerdin@7659 | 253 | } |
ysr@777 | 254 | |
johnc@3175 | 255 | assert(GenMarkSweep::ref_processor() == g1h->ref_processor_stw(), "Sanity"); |
stefank@5011 | 256 | g1h->ref_processor_stw()->weak_oops_do(&GenMarkSweep::adjust_pointer_closure); |
ysr@777 | 257 | |
ysr@777 | 258 | // Now adjust pointers in remaining weak roots. (All of which should |
ysr@777 | 259 | // have been cleared if they pointed to non-surviving objects.) |
mgerdin@7659 | 260 | JNIHandles::weak_oops_do(&always_true, &GenMarkSweep::adjust_pointer_closure); |
ysr@777 | 261 | |
pliden@6413 | 262 | if (G1StringDedup::is_enabled()) { |
pliden@6413 | 263 | G1StringDedup::oops_do(&GenMarkSweep::adjust_pointer_closure); |
pliden@6413 | 264 | } |
pliden@6413 | 265 | |
ysr@777 | 266 | GenMarkSweep::adjust_marks(); |
ysr@777 | 267 | |
ysr@777 | 268 | G1AdjustPointersClosure blk; |
ysr@777 | 269 | g1h->heap_region_iterate(&blk); |
ysr@777 | 270 | } |
ysr@777 | 271 | |
ysr@777 | 272 | class G1SpaceCompactClosure: public HeapRegionClosure { |
ysr@777 | 273 | public: |
ysr@777 | 274 | G1SpaceCompactClosure() {} |
ysr@777 | 275 | |
ysr@777 | 276 | bool doHeapRegion(HeapRegion* hr) { |
ysr@777 | 277 | if (hr->isHumongous()) { |
ysr@777 | 278 | if (hr->startsHumongous()) { |
ysr@777 | 279 | oop obj = oop(hr->bottom()); |
ysr@777 | 280 | if (obj->is_gc_marked()) { |
ysr@777 | 281 | obj->init_mark(); |
ysr@777 | 282 | } else { |
ysr@777 | 283 | assert(hr->is_empty(), "Should have been cleared in phase 2."); |
ysr@777 | 284 | } |
ysr@777 | 285 | hr->reset_during_compaction(); |
ysr@777 | 286 | } |
ysr@777 | 287 | } else { |
ysr@777 | 288 | hr->compact(); |
ysr@777 | 289 | } |
ysr@777 | 290 | return false; |
ysr@777 | 291 | } |
ysr@777 | 292 | }; |
ysr@777 | 293 | |
ysr@777 | 294 | void G1MarkSweep::mark_sweep_phase4() { |
ysr@777 | 295 | // All pointers are now adjusted, move objects accordingly |
ysr@777 | 296 | |
ysr@777 | 297 | // The ValidateMarkSweep live oops tracking expects us to traverse spaces |
ysr@777 | 298 | // in the same order in phase2, phase3 and phase4. We don't quite do that |
coleenp@4037 | 299 | // here (code and comment not fixed for perm removal), so we tell the validate code |
ysr@777 | 300 | // to use a higher index (saved from phase2) when verifying perm_gen. |
ysr@777 | 301 | G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
ysr@777 | 302 | |
brutisso@6904 | 303 | GCTraceTime tm("phase 4", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id()); |
ysr@777 | 304 | GenMarkSweep::trace("4"); |
ysr@777 | 305 | |
ysr@777 | 306 | G1SpaceCompactClosure blk; |
ysr@777 | 307 | g1h->heap_region_iterate(&blk); |
ysr@777 | 308 | |
ysr@777 | 309 | } |
sjohanss@7131 | 310 | |
sjohanss@7131 | 311 | void G1MarkSweep::prepare_compaction_work(G1PrepareCompactClosure* blk) { |
sjohanss@7131 | 312 | G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
sjohanss@7131 | 313 | g1h->heap_region_iterate(blk); |
sjohanss@7131 | 314 | blk->update_sets(); |
sjohanss@7131 | 315 | } |
sjohanss@7131 | 316 | |
sjohanss@7131 | 317 | void G1PrepareCompactClosure::free_humongous_region(HeapRegion* hr) { |
sjohanss@7131 | 318 | HeapWord* end = hr->end(); |
sjohanss@7131 | 319 | FreeRegionList dummy_free_list("Dummy Free List for G1MarkSweep"); |
sjohanss@7131 | 320 | |
sjohanss@7131 | 321 | assert(hr->startsHumongous(), |
sjohanss@7131 | 322 | "Only the start of a humongous region should be freed."); |
sjohanss@7131 | 323 | |
sjohanss@7131 | 324 | hr->set_containing_set(NULL); |
sjohanss@7131 | 325 | _humongous_regions_removed.increment(1u, hr->capacity()); |
sjohanss@7131 | 326 | |
sjohanss@7131 | 327 | _g1h->free_humongous_region(hr, &dummy_free_list, false /* par */); |
sjohanss@7131 | 328 | prepare_for_compaction(hr, end); |
sjohanss@7131 | 329 | dummy_free_list.remove_all(); |
sjohanss@7131 | 330 | } |
sjohanss@7131 | 331 | |
sjohanss@7131 | 332 | void G1PrepareCompactClosure::prepare_for_compaction(HeapRegion* hr, HeapWord* end) { |
sjohanss@7131 | 333 | // If this is the first live region that we came across which we can compact, |
sjohanss@7131 | 334 | // initialize the CompactPoint. |
sjohanss@7131 | 335 | if (!is_cp_initialized()) { |
sjohanss@7131 | 336 | _cp.space = hr; |
sjohanss@7131 | 337 | _cp.threshold = hr->initialize_threshold(); |
sjohanss@7131 | 338 | } |
sjohanss@7131 | 339 | prepare_for_compaction_work(&_cp, hr, end); |
sjohanss@7131 | 340 | } |
sjohanss@7131 | 341 | |
sjohanss@7131 | 342 | void G1PrepareCompactClosure::prepare_for_compaction_work(CompactPoint* cp, |
sjohanss@7131 | 343 | HeapRegion* hr, |
sjohanss@7131 | 344 | HeapWord* end) { |
sjohanss@7131 | 345 | hr->prepare_for_compaction(cp); |
sjohanss@7131 | 346 | // Also clear the part of the card table that will be unused after |
sjohanss@7131 | 347 | // compaction. |
sjohanss@7131 | 348 | _mrbs->clear(MemRegion(hr->compaction_top(), end)); |
sjohanss@7131 | 349 | } |
sjohanss@7131 | 350 | |
sjohanss@7131 | 351 | void G1PrepareCompactClosure::update_sets() { |
sjohanss@7131 | 352 | // We'll recalculate total used bytes and recreate the free list |
sjohanss@7131 | 353 | // at the end of the GC, so no point in updating those values here. |
sjohanss@7131 | 354 | HeapRegionSetCount empty_set; |
sjohanss@7131 | 355 | _g1h->remove_from_old_sets(empty_set, _humongous_regions_removed); |
sjohanss@7131 | 356 | } |
sjohanss@7131 | 357 | |
sjohanss@7131 | 358 | bool G1PrepareCompactClosure::doHeapRegion(HeapRegion* hr) { |
sjohanss@7131 | 359 | if (hr->isHumongous()) { |
sjohanss@7131 | 360 | if (hr->startsHumongous()) { |
sjohanss@7131 | 361 | oop obj = oop(hr->bottom()); |
sjohanss@7131 | 362 | if (obj->is_gc_marked()) { |
sjohanss@7131 | 363 | obj->forward_to(obj); |
sjohanss@7131 | 364 | } else { |
sjohanss@7131 | 365 | free_humongous_region(hr); |
sjohanss@7131 | 366 | } |
sjohanss@7131 | 367 | } else { |
sjohanss@7131 | 368 | assert(hr->continuesHumongous(), "Invalid humongous."); |
sjohanss@7131 | 369 | } |
sjohanss@7131 | 370 | } else { |
sjohanss@7131 | 371 | prepare_for_compaction(hr, hr->end()); |
sjohanss@7131 | 372 | } |
sjohanss@7131 | 373 | return false; |
sjohanss@7131 | 374 | } |