< prev index next >

src/share/vm/gc_implementation/shenandoah/shenandoahFreeSet.cpp

Print this page
rev 11463 : Backport Traversal GC

@@ -23,10 +23,11 @@
 
 #include "precompiled.hpp"
 
 #include "gc_implementation/shenandoah/shenandoahFreeSet.hpp"
 #include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp"
+#include "gc_implementation/shenandoah/shenandoahTraversalGC.hpp"
 
 ShenandoahFreeSet::ShenandoahFreeSet(ShenandoahHeap* heap,size_t max_regions) :
         _heap(heap),
         _mutator_free_bitmap(max_regions, /* in_resource_area = */ false),
         _collector_free_bitmap(max_regions, /* in_resource_area = */ false),

@@ -173,10 +174,19 @@
       increase_used(size * HeapWordSize);
     }
 
     // Record actual allocation size
     req.set_actual_size(size);
+
+    if (req.is_gc_alloc() && _heap->is_concurrent_traversal_in_progress()) {
+      // Traversal needs to traverse through GC allocs. Adjust TAMS to the new top
+      // so that these allocations appear below TAMS, and thus get traversed.
+      // See top of shenandoahTraversal.cpp for an explanation.
+      _heap->marking_context()->capture_top_at_mark_start(r);
+      _heap->traversal_gc()->traversal_set()->add_region_check_for_duplicates(r);
+      OrderAccess::fence();
+    }
   }
 
   if (result == NULL || has_no_alloc_capacity(r)) {
     // Region cannot afford this or future allocations. Retire it.
     //
< prev index next >