< prev index next >

src/share/vm/gc/shenandoah/shenandoahCollectorPolicy.cpp

Print this page
rev 12551 : Refactor/consolidate/cleanup

@@ -117,26 +117,26 @@
   ShenandoahHeapRegionSet* sorted_regions = ShenandoahHeap::heap()->sorted_regions();
   sorted_regions->sort(compareHeapRegionsByGarbage);
 
   size_t i = 0;
   size_t end = sorted_regions->active_regions();
-
+  ShenandoahHeap* heap = ShenandoahHeap::heap();
   while (i < end) {
     ShenandoahHeapRegion* region = sorted_regions->get(i++);
     if (region->garbage() > _garbage_threshold && ! region->is_humongous() && ! region->is_pinned()) {
       log_develop_trace(gc)("Choose region " SIZE_FORMAT " with garbage = " SIZE_FORMAT " and live = " SIZE_FORMAT " and _garbage_threshold = " SIZE_FORMAT "\n",
                             region->region_number(), region->garbage(), region->get_live_data(), _garbage_threshold);
 
       assert(! region->is_humongous(), "no humongous regions in collection set");
 
       if (region->get_live_data() == 0) {
         // We can recycle it right away and put it in the free set.
-        ShenandoahHeap::heap()->decrease_used(region->used());
+        heap->decrease_used(region->used());
         region->recycle();
       } else {
         collection_set->add_region(region);
-        region->set_is_in_collection_set(true);
+        region->set_in_collection_set(true);
       }
     } else {
       log_develop_trace(gc)("Rejected region " SIZE_FORMAT " with garbage = " SIZE_FORMAT " and live = " SIZE_FORMAT " and _garbage_threshold = " SIZE_FORMAT "\n",
                             region->region_number(), region->garbage(), region->get_live_data(), _garbage_threshold);
     }

@@ -154,24 +154,25 @@
   while (i < end && garbage < min_garbage) {
     ShenandoahHeapRegion* region = sorted_regions->get(i++);
     if (region->garbage() > _garbage_threshold && ! region->is_humongous() && ! region->is_pinned()) {
       collection_set->add_region(region);
       garbage += region->garbage();
-      region->set_is_in_collection_set(true);
+      region->set_in_collection_set(true);
     }
   }
 }
 
 void ShenandoahHeuristics::choose_free_set(ShenandoahFreeSet* free_set) {
 
   ShenandoahHeapRegionSet* ordered_regions = ShenandoahHeap::heap()->regions();
   size_t i = 0;
   size_t end = ordered_regions->active_regions();
 
+  ShenandoahHeap* heap = ShenandoahHeap::heap();
   while (i < end) {
     ShenandoahHeapRegion* region = ordered_regions->get(i++);
-    if ((! region->is_in_collection_set())
+    if ((! heap->in_collection_set(region))
         && (! region->is_humongous())
         && (! region->is_pinned())) {
       free_set->add_region(region);
     }
   }
< prev index next >