8067499: G1SATBCardTableModRefBS should not inherit from CardTableModRefBSForCTRS
authorkbarrett
Thu, 18 Dec 2014 13:26:37 -0500
changeset 28217 57791914628c
parent 28216 25cac6c2349d
child 28218 84ded0ce573d
child 28375 3eb2963297fb
8067499: G1SATBCardTableModRefBS should not inherit from CardTableModRefBSForCTRS Summary: G1SATBCardTableModRefBS inherits from CardTableModRefBS Reviewed-by: mgerdin, brutisso, tschatzl
hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
hotspot/src/share/vm/memory/cardTableRS.cpp
hotspot/src/share/vm/memory/genCollectedHeap.cpp
hotspot/src/share/vm/memory/genCollectedHeap.hpp
hotspot/src/share/vm/memory/genOopClosures.inline.hpp
hotspot/src/share/vm/memory/generation.cpp
hotspot/src/share/vm/memory/sharedHeap.cpp
hotspot/src/share/vm/memory/sharedHeap.hpp
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Dec 22 17:40:46 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Dec 18 13:26:37 2014 -0500
@@ -1886,13 +1886,12 @@
 
   initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size()));
 
-  // Create the gen rem set (and barrier set) for the entire reserved region.
-  _rem_set = collector_policy()->create_rem_set(reserved_region());
-  set_barrier_set(rem_set()->bs());
-  if (!barrier_set()->is_a(BarrierSet::G1SATBCTLogging)) {
-    vm_exit_during_initialization("G1 requires a G1SATBLoggingCardTableModRefBS");
-    return JNI_ENOMEM;
-  }
+  // Create the barrier set for the entire reserved region.
+  G1SATBCardTableLoggingModRefBS* bs
+    = new G1SATBCardTableLoggingModRefBS(reserved_region());
+  bs->initialize();
+  assert(bs->is_a(BarrierSet::G1SATBCTLogging), "sanity");
+  set_barrier_set(bs);
 
   // Also create a G1 rem set.
   _g1_rem_set = new G1RemSet(this, g1_barrier_set());
@@ -3153,8 +3152,6 @@
         failures = true;
       }
     }
-    if (!silent) gclog_or_tty->print("RemSet ");
-    rem_set()->verify();
 
     if (G1StringDedup::is_enabled()) {
       if (!silent) gclog_or_tty->print("StrDedup ");
@@ -5588,8 +5585,6 @@
 
   init_for_evac_failure(NULL);
 
-  rem_set()->prepare_for_younger_refs_iterate(true);
-
   assert(dirty_card_queue_set().completed_buffers_num() == 0, "Should be empty");
   double start_par_time_sec = os::elapsedTime();
   double end_par_time_sec;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Mon Dec 22 17:40:46 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Thu Dec 18 13:26:37 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, 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
@@ -33,7 +33,7 @@
 #include "runtime/thread.inline.hpp"
 
 G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap) :
-    CardTableModRefBSForCTRS(whole_heap)
+    CardTableModRefBS(whole_heap)
 {
   _kind = G1SATBCT;
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Mon Dec 22 17:40:46 2014 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Thu Dec 18 13:26:37 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, 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
@@ -37,7 +37,7 @@
 // This barrier is specialized to use a logging barrier to support
 // snapshot-at-the-beginning marking.
 
-class G1SATBCardTableModRefBS: public CardTableModRefBSForCTRS {
+class G1SATBCardTableModRefBS: public CardTableModRefBS {
 protected:
   enum G1CardValues {
     g1_young_gen = CT_MR_BS_last_reserved << 1
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp	Mon Dec 22 17:40:46 2014 +0000
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp	Thu Dec 18 13:26:37 2014 -0500
@@ -33,24 +33,13 @@
 #include "runtime/java.hpp"
 #include "runtime/os.hpp"
 #include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc_implementation/g1/concurrentMark.hpp"
-#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
-#endif // INCLUDE_ALL_GCS
 
 CardTableRS::CardTableRS(MemRegion whole_heap) :
   GenRemSet(),
   _cur_youngergen_card_val(youngergenP1_card)
 {
-#if INCLUDE_ALL_GCS
-  if (UseG1GC) {
-      _ct_bs = new G1SATBCardTableLoggingModRefBS(whole_heap);
-  } else {
-    _ct_bs = new CardTableModRefBSForCTRS(whole_heap);
-  }
-#else
+  guarantee(Universe::heap()->kind() == CollectedHeap::GenCollectedHeap, "sanity");
   _ct_bs = new CardTableModRefBSForCTRS(whole_heap);
-#endif
   _ct_bs->initialize();
   set_bs(_ct_bs);
   _last_cur_val_in_gen = NEW_C_HEAP_ARRAY3(jbyte, GenCollectedHeap::max_gens + 1,
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Mon Dec 22 17:40:46 2014 +0000
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Thu Dec 18 13:26:37 2014 -0500
@@ -70,6 +70,7 @@
 
 GenCollectedHeap::GenCollectedHeap(GenCollectorPolicy *policy) :
   SharedHeap(policy),
+  _rem_set(NULL),
   _gen_policy(policy),
   _gen_process_roots_tasks(new SubTasksDone(GCH_PS_NumElements)),
   _full_collections_completed(0)
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Mon Dec 22 17:40:46 2014 +0000
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Thu Dec 18 13:26:37 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -66,6 +66,9 @@
   Generation* _gens[max_gens];
   GenerationSpec** _gen_specs;
 
+  // The singleton Gen Remembered Set.
+  GenRemSet* _rem_set;
+
   // The generational collector policy.
   GenCollectorPolicy* _gen_policy;
 
@@ -383,6 +386,10 @@
     return _n_gens;
   }
 
+  // This function returns the "GenRemSet" object that allows us to scan
+  // generations in a fully generational heap.
+  GenRemSet* rem_set() { return _rem_set; }
+
   // Convenience function to be used in situations where the heap type can be
   // asserted to be this type.
   static GenCollectedHeap* heap();
--- a/hotspot/src/share/vm/memory/genOopClosures.inline.hpp	Mon Dec 22 17:40:46 2014 +0000
+++ b/hotspot/src/share/vm/memory/genOopClosures.inline.hpp	Thu Dec 18 13:26:37 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, 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
@@ -44,7 +44,7 @@
   _gen_boundary = _gen->reserved().start();
   // Barrier set for the heap, must be set after heap is initialized
   if (_rs == NULL) {
-    GenRemSet* rs = SharedHeap::heap()->rem_set();
+    GenRemSet* rs = GenCollectedHeap::heap()->rem_set();
     _rs = (CardTableRS*)rs;
   }
 }
--- a/hotspot/src/share/vm/memory/generation.cpp	Mon Dec 22 17:40:46 2014 +0000
+++ b/hotspot/src/share/vm/memory/generation.cpp	Thu Dec 18 13:26:37 2014 -0500
@@ -297,7 +297,7 @@
 
 void Generation::younger_refs_in_space_iterate(Space* sp,
                                                OopsInGenClosure* cl) {
-  GenRemSet* rs = SharedHeap::heap()->rem_set();
+  GenRemSet* rs = GenCollectedHeap::heap()->rem_set();
   rs->younger_refs_in_space_iterate(sp, cl);
 }
 
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp	Mon Dec 22 17:40:46 2014 +0000
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp	Thu Dec 18 13:26:37 2014 -0500
@@ -58,7 +58,6 @@
 SharedHeap::SharedHeap(CollectorPolicy* policy_) :
   CollectedHeap(),
   _collector_policy(policy_),
-  _rem_set(NULL),
   _strong_roots_scope(NULL),
   _strong_roots_parity(0),
   _process_strong_tasks(new SubTasksDone(SH_PS_NumElements)),
--- a/hotspot/src/share/vm/memory/sharedHeap.hpp	Mon Dec 22 17:40:46 2014 +0000
+++ b/hotspot/src/share/vm/memory/sharedHeap.hpp	Thu Dec 18 13:26:37 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -114,10 +114,6 @@
   // set the static pointer "_sh" to that instance.
   static SharedHeap* _sh;
 
-  // and the Gen Remembered Set, at least one good enough to scan the perm
-  // gen.
-  GenRemSet* _rem_set;
-
   // A gc policy, controls global gc resource issues
   CollectorPolicy *_collector_policy;
 
@@ -152,10 +148,6 @@
   // Initialization of ("weak") reference processing support
   virtual void ref_processing_init();
 
-  // This function returns the "GenRemSet" object that allows us to scan
-  // generations in a fully generational heap.
-  GenRemSet* rem_set() { return _rem_set; }
-
   // Iteration functions.
   void oop_iterate(ExtendedOopClosure* cl) = 0;