< prev index next >

src/hotspot/share/gc/serial/genMarkSweep.cpp

Print this page
@@ -43,10 +43,11 @@
  #include "gc/shared/generation.hpp"
  #include "gc/shared/genOopClosures.inline.hpp"
  #include "gc/shared/modRefBarrierSet.hpp"
  #include "gc/shared/referencePolicy.hpp"
  #include "gc/shared/referenceProcessorPhaseTimes.hpp"
+ #include "gc/shared/slidingForwarding.hpp"
  #include "gc/shared/space.hpp"
  #include "gc/shared/strongRootsScope.hpp"
  #include "gc/shared/weakProcessor.hpp"
  #include "memory/universe.hpp"
  #include "oops/instanceRefKlass.hpp"

@@ -91,10 +92,12 @@
  
    allocate_stacks();
  
    mark_sweep_phase1(clear_all_softrefs);
  
+   SlidingForwarding::begin();
+ 
    mark_sweep_phase2();
  
    // Don't add any more derived pointers during phase3
  #if COMPILER2_OR_JVMCI
    assert(DerivedPointerTable::is_active(), "Sanity");

@@ -109,10 +112,12 @@
  
    // Set saved marks for allocation profiler (and other things? -- dld)
    // (Should this be in general part?)
    gch->save_marks();
  
+   SlidingForwarding::end();
+ 
    deallocate_stacks();
  
    // If compaction completely evacuated the young generation then we
    // can clear the card table.  Otherwise, we must invalidate
    // it (consider all cards dirty).  In the future, we might consider doing

@@ -272,22 +277,35 @@
    GCTraceTime(Info, gc, phases) tm("Phase 3: Adjust pointers", gc_timer());
  
    // Need new claim bits for the pointer adjustment tracing.
    ClassLoaderDataGraph::clear_claimed_marks();
  
-   {
-     StrongRootsScope srs(0);
- 
-     gch->full_process_roots(true,  // this is the adjust phase
-                             GenCollectedHeap::SO_AllCodeCache,
-                             false, // all roots
-                             &adjust_pointer_closure,
-                             &adjust_cld_closure);
+   if (UseAltGCForwarding) {
+     AdjustPointerClosure<true> adjust_pointer_closure;
+     CLDToOopClosure adjust_cld_closure(&adjust_pointer_closure, ClassLoaderData::_claim_strong);
+     {
+       StrongRootsScope srs(0);
+       gch->full_process_roots(true,  // this is the adjust phase
+                               GenCollectedHeap::SO_AllCodeCache,
+                               false, // all roots
+                               &adjust_pointer_closure,
+                               &adjust_cld_closure);
+     }
+     gch->gen_process_weak_roots(&adjust_pointer_closure);
+   } else {
+     AdjustPointerClosure<false> adjust_pointer_closure;
+     CLDToOopClosure adjust_cld_closure(&adjust_pointer_closure, ClassLoaderData::_claim_strong);
+     {
+       StrongRootsScope srs(0);
+       gch->full_process_roots(true,  // this is the adjust phase
+                               GenCollectedHeap::SO_AllCodeCache,
+                               false, // all roots
+                               &adjust_pointer_closure,
+                               &adjust_cld_closure);
+     }
+     gch->gen_process_weak_roots(&adjust_pointer_closure);
    }
- 
-   gch->gen_process_weak_roots(&adjust_pointer_closure);
- 
    adjust_marks();
    GenAdjustPointersClosure blk;
    gch->generation_iterate(&blk, true);
  }
  
< prev index next >