diff --git a/src/share/vm/gc_implementation/g1/heapRegion.cpp b/src/share/vm/gc_implementation/g1/heapRegion.cpp index 072e0210e9f9e7022d00c1a76adcbdf3403a6491..3a7251b563965791a4b371c3f71021ff16a69cd9 100644 --- a/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -1015,10 +1015,13 @@ HeapWord* G1OffsetTableContigSpace::cross_threshold(HeapWord* start, HeapWord* G1OffsetTableContigSpace::saved_mark_word() const { G1CollectedHeap* g1h = G1CollectedHeap::heap(); assert( _gc_time_stamp <= g1h->get_gc_time_stamp(), "invariant" ); - if (_gc_time_stamp < g1h->get_gc_time_stamp()) - return top(); - else + HeapWord* local_top = top(); + OrderAccess::loadload(); + if (_gc_time_stamp < g1h->get_gc_time_stamp()) { + return local_top; + } else { return Space::saved_mark_word(); + } } void G1OffsetTableContigSpace::record_top_and_timestamp() {