Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/g1/heapRegion.cpp @ 20652:e8bf410d5e23
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
author | mgerdin |
---|---|
date | Fri, 14 Nov 2014 14:23:25 +0100 |
parents | 0fcaab91d485 |
children | 7848fc12602b |
comparison
equal
deleted
inserted
replaced
20651:600c44255e5f | 20652:e8bf410d5e23 |
---|---|
1013 } | 1013 } |
1014 | 1014 |
1015 HeapWord* G1OffsetTableContigSpace::saved_mark_word() const { | 1015 HeapWord* G1OffsetTableContigSpace::saved_mark_word() const { |
1016 G1CollectedHeap* g1h = G1CollectedHeap::heap(); | 1016 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
1017 assert( _gc_time_stamp <= g1h->get_gc_time_stamp(), "invariant" ); | 1017 assert( _gc_time_stamp <= g1h->get_gc_time_stamp(), "invariant" ); |
1018 if (_gc_time_stamp < g1h->get_gc_time_stamp()) | 1018 HeapWord* local_top = top(); |
1019 return top(); | 1019 OrderAccess::loadload(); |
1020 else | 1020 if (_gc_time_stamp < g1h->get_gc_time_stamp()) { |
1021 return local_top; | |
1022 } else { | |
1021 return Space::saved_mark_word(); | 1023 return Space::saved_mark_word(); |
1024 } | |
1022 } | 1025 } |
1023 | 1026 |
1024 void G1OffsetTableContigSpace::record_top_and_timestamp() { | 1027 void G1OffsetTableContigSpace::record_top_and_timestamp() { |
1025 G1CollectedHeap* g1h = G1CollectedHeap::heap(); | 1028 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
1026 unsigned curr_gc_time_stamp = g1h->get_gc_time_stamp(); | 1029 unsigned curr_gc_time_stamp = g1h->get_gc_time_stamp(); |