diff src/share/vm/memory/genCollectedHeap.hpp @ 1027:39b01ab7035a

6888898: CMS: ReduceInitialCardMarks unsafe in the presence of cms precleaning 6889757: G1: enable card mark elision for initializing writes from compiled code (ReduceInitialCardMarks) Summary: Defer the (compiler-elided) card-mark upon a slow-path allocation until after the store and before the next subsequent safepoint; G1 now answers yes to can_elide_tlab_write_barriers(). Reviewed-by: jcoomes, kvn, never
author ysr
date Fri, 16 Oct 2009 02:05:46 -0700
parents 148e5441d916
children 052a899eec3e
line wrap: on
line diff
--- a/src/share/vm/memory/genCollectedHeap.hpp	Wed Oct 07 19:01:55 2009 -0400
+++ b/src/share/vm/memory/genCollectedHeap.hpp	Fri Oct 16 02:05:46 2009 -0700
@@ -260,6 +260,17 @@
     return true;
   }
 
+  // We don't need barriers for stores to objects in the
+  // young gen and, a fortiori, for initializing stores to
+  // objects therein. This applies to {DefNew,ParNew}+{Tenured,CMS}
+  // only and may need to be re-examined in case other
+  // kinds of collectors are implemented in the future.
+  virtual bool can_elide_initializing_store_barrier(oop new_obj) {
+    assert(UseParNewGC || UseSerialGC || UseConcMarkSweepGC,
+           "Check can_elide_initializing_store_barrier() for this collector");
+    return is_in_youngest((void*)new_obj);
+  }
+
   // Can a compiler elide a store barrier when it writes
   // a permanent oop into the heap?  Applies when the compiler
   // is storing x to the heap, where x->is_perm() is true.