< prev index next >

src/hotspot/share/gc/g1/g1CollectionSet.cpp

Print this page
rev 52675 : 8213890: Implementation of JEP 344: Abortable Mixed Collections for G1
Reviewed-by:
Contributed-by: erik.helin@oracle.com, stefan.johansson@oracle.com
rev 52676 : imported patch AMGC-impl
rev 52677 : imported patch AMGC-tsch-rev1
rev 52678 : imported patch AMGC-tsch-rev1-optcset
rev 52680 : imported patch AMGC-tsch-rev2
rev 52681 : [mq]: AMGC-kbar-rev1
rev 52682 : [mq]: AMGC-kbar-rev1b

@@ -24,10 +24,11 @@
 
 #include "precompiled.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1CollectionSet.hpp"
 #include "gc/g1/g1CollectorState.hpp"
+#include "gc/g1/g1ParScanThreadState.hpp"
 #include "gc/g1/g1Policy.hpp"
 #include "gc/g1/heapRegion.inline.hpp"
 #include "gc/g1/heapRegionRemSet.hpp"
 #include "gc/g1/heapRegionSet.hpp"
 #include "logging/logStream.hpp"

@@ -102,10 +103,12 @@
   _collection_set_regions = NEW_C_HEAP_ARRAY(uint, max_region_length, mtGC);
 }
 
 void G1CollectionSet::initialize_optional(uint max_length) {
   assert(_optional_regions == NULL, "Already initialized");
+  assert(_optional_region_length == 0, "Already initialized");
+  assert(_optional_region_max_length == 0, "Already initialized");
   _optional_region_max_length = max_length;
   _optional_regions = NEW_C_HEAP_ARRAY(HeapRegion*, _optional_region_max_length, mtGC);
 }
 
 void G1CollectionSet::free_optional_regions() {

@@ -447,10 +450,11 @@
   _g1h->old_set_remove(hr);
   add_optional_region(hr);
 }
 
 bool G1CollectionSet::optional_is_full() {
+  assert(_optional_region_length <= _optional_region_max_length, "Invariant");
   return _optional_region_length == _optional_region_max_length;
 }
 
 void G1CollectionSet::clear_optional_region(const HeapRegion* hr) {
   assert(_optional_regions != NULL, "Must not be called before array is allocated");

@@ -628,10 +632,11 @@
   while (!is_empty()) {
     // We want to return regions not evacuated to the
     // chooser in reverse order to maintain the old order.
     HeapRegion* hr = _cset->remove_last_optional_region();
     assert(hr != NULL, "Should be valid region left");
+    _pset->record_unused_optional_region(hr);
     g1h->old_set_add(hr);
     g1h->clear_in_cset(hr);
     hr->set_index_in_opt_cset(InvalidCSetIndex);
     _cset->cset_chooser()->push(hr);
   }
< prev index next >