src/hotspot/share/gc/shenandoah/shenandoahMarkCompact.cpp
changeset 58429 eba8b29bf528
parent 55513 be05771cdfdf
child 58544 8b60ae8a2569
equal deleted inserted replaced
58428:9b644c06226f 58429:eba8b29bf528
   325   ShenandoahRegionIterator        _heap_regions;
   325   ShenandoahRegionIterator        _heap_regions;
   326 
   326 
   327   ShenandoahHeapRegion* next_from_region(ShenandoahHeapRegionSet* slice) {
   327   ShenandoahHeapRegion* next_from_region(ShenandoahHeapRegionSet* slice) {
   328     ShenandoahHeapRegion* from_region = _heap_regions.next();
   328     ShenandoahHeapRegion* from_region = _heap_regions.next();
   329 
   329 
   330     while (from_region != NULL && (!from_region->is_move_allowed() || from_region->is_humongous())) {
   330     // Look for next candidate for this slice:
       
   331     while (from_region != NULL) {
       
   332       // Empty region: get it into the slice to defragment the slice itself.
       
   333       // We could have skipped this without violating correctness, but we really
       
   334       // want to compact all live regions to the start of the heap, which sometimes
       
   335       // means moving them into the fully empty regions.
       
   336       if (from_region->is_empty()) break;
       
   337 
       
   338       // Can move the region, and this is not the humongous region. Humongous
       
   339       // moves are special cased here, because their moves are handled separately.
       
   340       if (from_region->is_move_allowed() && !from_region->is_humongous()) break;
       
   341 
   331       from_region = _heap_regions.next();
   342       from_region = _heap_regions.next();
   332     }
   343     }
   333 
   344 
   334     if (from_region != NULL) {
   345     if (from_region != NULL) {
   335       assert(slice != NULL, "sanity");
   346       assert(slice != NULL, "sanity");
   336       assert(!from_region->is_humongous(), "this path cannot handle humongous regions");
   347       assert(!from_region->is_humongous(), "this path cannot handle humongous regions");
   337       assert(from_region->is_move_allowed(), "only regions that can be moved in mark-compact");
   348       assert(from_region->is_empty() || from_region->is_move_allowed(), "only regions that can be moved in mark-compact");
   338       slice->add_region(from_region);
   349       slice->add_region(from_region);
   339     }
   350     }
   340 
   351 
   341     return from_region;
   352     return from_region;
   342   }
   353   }