changeset 5122:14f15bdfffcb

8039042: G1: Phantom zeros in cardtable Reviewed-by: tschatzl, mgerdin
author pliden
date Tue, 20 May 2014 10:24:30 +0200
parents 9f942f05c968
children dc59a0f4447e
files src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Mon May 12 15:03:19 2014 +0100
+++ b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Tue May 20 10:24:30 2014 +0200
@@ -107,7 +107,15 @@
   jbyte *const first = byte_for(mr.start());
   jbyte *const last = byte_after(mr.last());
 
-  memset(first, g1_young_gen, last - first);
+  // Below we may use an explicit loop instead of memset() because on
+  // certain platforms memset() can give concurrent readers phantom zeros.
+  if (UseMemSetInBOT) {
+    memset(first, g1_young_gen, last - first);
+  } else {
+    for (jbyte* i = first; i < last; i++) {
+      *i = g1_young_gen;
+    }
+  }
 }
 
 #ifndef PRODUCT