8202722: Move marksweep_init into GC code
authorstefank
Mon, 07 May 2018 16:16:17 +0200
changeset 50059 10843c8ecd54
parent 50058 f7e564cacfbc
child 50060 06d5b1f66553
8202722: Move marksweep_init into GC code Reviewed-by: ehelin, kbarrett
src/hotspot/share/gc/parallel/psMarkSweep.cpp
src/hotspot/share/gc/serial/markSweep.cpp
src/hotspot/share/gc/serial/markSweep.hpp
src/hotspot/share/gc/shared/genCollectedHeap.cpp
src/hotspot/share/runtime/init.cpp
--- a/src/hotspot/share/gc/parallel/psMarkSweep.cpp	Mon May 07 16:12:07 2018 +0200
+++ b/src/hotspot/share/gc/parallel/psMarkSweep.cpp	Mon May 07 16:16:17 2018 +0200
@@ -71,6 +71,7 @@
   _span_based_discoverer.set_span(ParallelScavengeHeap::heap()->reserved_region());
   set_ref_processor(new ReferenceProcessor(&_span_based_discoverer));     // a vanilla ref proc
   _counters = new CollectorCounters("PSMarkSweep", 1);
+  MarkSweep::initialize();
 }
 
 // This method contains all heap specific policy for invoking mark sweep.
--- a/src/hotspot/share/gc/serial/markSweep.cpp	Mon May 07 16:12:07 2018 +0200
+++ b/src/hotspot/share/gc/serial/markSweep.cpp	Mon May 07 16:16:17 2018 +0200
@@ -265,7 +265,7 @@
 void MarkSweep::KeepAliveClosure::do_oop(oop* p)       { MarkSweep::KeepAliveClosure::do_oop_work(p); }
 void MarkSweep::KeepAliveClosure::do_oop(narrowOop* p) { MarkSweep::KeepAliveClosure::do_oop_work(p); }
 
-void marksweep_init() {
+void MarkSweep::initialize() {
   MarkSweep::_gc_timer = new (ResourceObj::C_HEAP, mtGC) STWGCTimer();
   MarkSweep::_gc_tracer = new (ResourceObj::C_HEAP, mtGC) SerialOldTracer();
 }
--- a/src/hotspot/share/gc/serial/markSweep.hpp	Mon May 07 16:12:07 2018 +0200
+++ b/src/hotspot/share/gc/serial/markSweep.hpp	Mon May 07 16:16:17 2018 +0200
@@ -87,7 +87,6 @@
   friend class AdjustPointerClosure;
   friend class KeepAliveClosure;
   friend class VM_MarkSweep;
-  friend void marksweep_init();
 
   //
   // Vars
@@ -117,6 +116,8 @@
   static KeepAliveClosure keep_alive;
 
  public:
+  static void initialize();
+
   // Public closures
   static IsAliveClosure       is_alive;
   static FollowRootClosure    follow_root_closure;
--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Mon May 07 16:12:07 2018 +0200
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Mon May 07 16:16:17 2018 +0200
@@ -182,6 +182,8 @@
   initialize_size_policy(def_new_gen->eden()->capacity(),
                          _old_gen->capacity(),
                          def_new_gen->from()->capacity());
+
+  MarkSweep::initialize();
 }
 
 void GenCollectedHeap::ref_processing_init() {
--- a/src/hotspot/share/runtime/init.cpp	Mon May 07 16:12:07 2018 +0200
+++ b/src/hotspot/share/runtime/init.cpp	Mon May 07 16:16:17 2018 +0200
@@ -62,9 +62,6 @@
 void gc_barrier_stubs_init();
 void interpreter_init();       // before any methods loaded
 void invocationCounter_init(); // before any methods loaded
-#if INCLUDE_SERIALGC
-void marksweep_init();
-#endif
 void accessFlags_init();
 void templateTable_init();
 void InterfaceSupport_init();
@@ -119,7 +116,6 @@
   gc_barrier_stubs_init();   // depends on universe_init, must be before interpreter_init
   interpreter_init();        // before any methods loaded
   invocationCounter_init();  // before any methods loaded
-  SERIALGC_ONLY(marksweep_init());
   accessFlags_init();
   templateTable_init();
   InterfaceSupport_init();