< prev index next >
hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
Print this page
rev 6908 : 8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs
Summary: Read _top before _gc_time_stamp in saved_mark_word() with LoadLoad order to ensure we get a consistent view
Reviewed-by: brutisso, dcubed, dholmes, stefank
*** 1013,1026 ****
}
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
return Space::saved_mark_word();
}
void G1OffsetTableContigSpace::record_top_and_timestamp() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
unsigned curr_gc_time_stamp = g1h->get_gc_time_stamp();
--- 1013,1029 ----
}
HeapWord* G1OffsetTableContigSpace::saved_mark_word() const {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
assert( _gc_time_stamp <= g1h->get_gc_time_stamp(), "invariant" );
! 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() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
unsigned curr_gc_time_stamp = g1h->get_gc_time_stamp();
< prev index next >