mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 09:04:41 +02:00
8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs
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
This commit is contained in:
parent
95704b233c
commit
4feb7b4dab
1 changed files with 6 additions and 3 deletions
|
@ -1004,10 +1004,13 @@ HeapWord* G1OffsetTableContigSpace::cross_threshold(HeapWord* start,
|
||||||
HeapWord* G1OffsetTableContigSpace::saved_mark_word() const {
|
HeapWord* G1OffsetTableContigSpace::saved_mark_word() const {
|
||||||
G1CollectedHeap* g1h = G1CollectedHeap::heap();
|
G1CollectedHeap* g1h = G1CollectedHeap::heap();
|
||||||
assert( _gc_time_stamp <= g1h->get_gc_time_stamp(), "invariant" );
|
assert( _gc_time_stamp <= g1h->get_gc_time_stamp(), "invariant" );
|
||||||
if (_gc_time_stamp < g1h->get_gc_time_stamp())
|
HeapWord* local_top = top();
|
||||||
return top();
|
OrderAccess::loadload();
|
||||||
else
|
if (_gc_time_stamp < g1h->get_gc_time_stamp()) {
|
||||||
|
return local_top;
|
||||||
|
} else {
|
||||||
return Space::saved_mark_word();
|
return Space::saved_mark_word();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void G1OffsetTableContigSpace::record_top_and_timestamp() {
|
void G1OffsetTableContigSpace::record_top_and_timestamp() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue