changeset 7008:aa64b1cbb1b8

Merge
author tschatzl
date Thu, 28 Aug 2014 15:55:05 +0000
parents b515190809d5 40c22d6c0cef
children 1a3bdc233bda f80bb126b5bb
files
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Aug 28 18:38:31 2014 +0400
+++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Aug 28 15:55:05 2014 +0000
@@ -888,7 +888,16 @@
   }
 
   virtual bool doHeapRegion(HeapRegion* r) {
-    return _bitmap->getNextMarkedWordAddress(r->bottom(), r->end()) != r->end();
+    // This closure can be called concurrently to the mutator, so we must make sure
+    // that the result of the getNextMarkedWordAddress() call is compared to the
+    // value passed to it as limit to detect any found bits.
+    // We can use the region's orig_end() for the limit and the comparison value
+    // as it always contains the "real" end of the region that never changes and
+    // has no side effects.
+    // Due to the latter, there can also be no problem with the compiler generating
+    // reloads of the orig_end() call.
+    HeapWord* end = r->orig_end();
+    return _bitmap->getNextMarkedWordAddress(r->bottom(), end) != end;
   }
 };
 
--- a/src/share/vm/gc_implementation/g1/heapRegion.hpp	Thu Aug 28 18:38:31 2014 +0400
+++ b/src/share/vm/gc_implementation/g1/heapRegion.hpp	Thu Aug 28 15:55:05 2014 +0000
@@ -566,7 +566,7 @@
   void set_next_dirty_cards_region(HeapRegion* hr) { _next_dirty_cards_region = hr; }
   bool is_on_dirty_cards_region_list() const { return get_next_dirty_cards_region() != NULL; }
 
-  HeapWord* orig_end() { return _orig_end; }
+  HeapWord* orig_end() const { return _orig_end; }
 
   // Reset HR stuff to default values.
   void hr_clear(bool par, bool clear_space, bool locked = false);