1.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp Wed Sep 03 08:44:47 2014 +0000 1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp Thu Aug 28 17:05:41 2014 +0200 1.3 @@ -887,7 +887,16 @@ 1.4 } 1.5 1.6 virtual bool doHeapRegion(HeapRegion* r) { 1.7 - return _bitmap->getNextMarkedWordAddress(r->bottom(), r->end()) != r->end(); 1.8 + // This closure can be called concurrently to the mutator, so we must make sure 1.9 + // that the result of the getNextMarkedWordAddress() call is compared to the 1.10 + // value passed to it as limit to detect any found bits. 1.11 + // We can use the region's orig_end() for the limit and the comparison value 1.12 + // as it always contains the "real" end of the region that never changes and 1.13 + // has no side effects. 1.14 + // Due to the latter, there can also be no problem with the compiler generating 1.15 + // reloads of the orig_end() call. 1.16 + HeapWord* end = r->orig_end(); 1.17 + return _bitmap->getNextMarkedWordAddress(r->bottom(), end) != end; 1.18 } 1.19 }; 1.20