src/share/vm/gc/g1/collectionSetChooser.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -208,15 +208,16 @@
   _front = 0;
   _end = 0;
   _remaining_reclaimable_bytes = 0;
 }
 
-class ParKnownGarbageHRClosure: public HeapRegionClosure {
+class ParKnownGarbageTask: public G1ParallelizeByRegionsTask {
+  class ParKnownGarbageHRClosure: public HeapRegionClosure {
   G1CollectedHeap* _g1h;
   CSetChooserParUpdater _cset_updater;
 
-public:
+  public:
   ParKnownGarbageHRClosure(CollectionSetChooser* hrSorted,
                            uint chunk_size) :
     _g1h(G1CollectedHeap::heap()),
     _cset_updater(hrSorted, true /* parallel */, chunk_size) { }
 

@@ -230,27 +231,23 @@
         _cset_updater.add_region(r);
       }
     }
     return false;
   }
-};
+  };
 
-class ParKnownGarbageTask: public AbstractGangTask {
   CollectionSetChooser* _hrSorted;
   uint _chunk_size;
-  G1CollectedHeap* _g1;
-  HeapRegionClaimer _hrclaimer;
 
 public:
   ParKnownGarbageTask(CollectionSetChooser* hrSorted, uint chunk_size, uint n_workers) :
-      AbstractGangTask("ParKnownGarbageTask"),
-      _hrSorted(hrSorted), _chunk_size(chunk_size),
-      _g1(G1CollectedHeap::heap()), _hrclaimer(n_workers) {}
+      G1ParallelizeByRegionsTask("ParKnownGarbageTask", n_workers),
+      _hrSorted(hrSorted), _chunk_size(chunk_size) {}
 
   void work(uint worker_id) {
     ParKnownGarbageHRClosure parKnownGarbageCl(_hrSorted, _chunk_size);
-    _g1->heap_region_par_iterate(&parKnownGarbageCl, worker_id, &_hrclaimer);
+    all_heap_regions_work(&parKnownGarbageCl, worker_id);
   }
 };
 
 uint CollectionSetChooser::calculate_parallel_work_chunk_size(uint n_workers, uint n_regions) const {
   assert(n_workers > 0, "Active gc workers should be greater than 0");