mirror of
https://github.com/openjdk/jdk.git
synced 2026-06-01 16:22:31 +00:00
8166898: G1SATBCardTableLoggingModRefBS::invalidate() incorrect with whole_heap == true
Reviewed-by: tschatzl, kbarrett
This commit is contained in:
parent
06bd79afed
commit
9a28eb0745
@ -178,44 +178,37 @@ G1SATBCardTableLoggingModRefBS::write_ref_field_work(void* field,
|
||||
}
|
||||
|
||||
void
|
||||
G1SATBCardTableLoggingModRefBS::invalidate(MemRegion mr, bool whole_heap) {
|
||||
G1SATBCardTableLoggingModRefBS::invalidate(MemRegion mr) {
|
||||
volatile jbyte* byte = byte_for(mr.start());
|
||||
jbyte* last_byte = byte_for(mr.last());
|
||||
Thread* thr = Thread::current();
|
||||
if (whole_heap) {
|
||||
while (byte <= last_byte) {
|
||||
*byte = dirty_card;
|
||||
byte++;
|
||||
}
|
||||
} else {
|
||||
// skip all consecutive young cards
|
||||
for (; byte <= last_byte && *byte == g1_young_gen; byte++);
|
||||
for (; byte <= last_byte && *byte == g1_young_gen; byte++);
|
||||
|
||||
if (byte <= last_byte) {
|
||||
OrderAccess::storeload();
|
||||
// Enqueue if necessary.
|
||||
if (thr->is_Java_thread()) {
|
||||
JavaThread* jt = (JavaThread*)thr;
|
||||
for (; byte <= last_byte; byte++) {
|
||||
if (*byte == g1_young_gen) {
|
||||
continue;
|
||||
}
|
||||
if (*byte != dirty_card) {
|
||||
*byte = dirty_card;
|
||||
jt->dirty_card_queue().enqueue(byte);
|
||||
}
|
||||
if (byte <= last_byte) {
|
||||
OrderAccess::storeload();
|
||||
// Enqueue if necessary.
|
||||
if (thr->is_Java_thread()) {
|
||||
JavaThread* jt = (JavaThread*)thr;
|
||||
for (; byte <= last_byte; byte++) {
|
||||
if (*byte == g1_young_gen) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
MutexLockerEx x(Shared_DirtyCardQ_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
for (; byte <= last_byte; byte++) {
|
||||
if (*byte == g1_young_gen) {
|
||||
continue;
|
||||
}
|
||||
if (*byte != dirty_card) {
|
||||
*byte = dirty_card;
|
||||
_dcqs.shared_dirty_card_queue()->enqueue(byte);
|
||||
}
|
||||
if (*byte != dirty_card) {
|
||||
*byte = dirty_card;
|
||||
jt->dirty_card_queue().enqueue(byte);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MutexLockerEx x(Shared_DirtyCardQ_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
for (; byte <= last_byte; byte++) {
|
||||
if (*byte == g1_young_gen) {
|
||||
continue;
|
||||
}
|
||||
if (*byte != dirty_card) {
|
||||
*byte = dirty_card;
|
||||
_dcqs.shared_dirty_card_queue()->enqueue(byte);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS {
|
||||
|
||||
// NB: if you do a whole-heap invalidation, the "usual invariant" defined
|
||||
// above no longer applies.
|
||||
void invalidate(MemRegion mr, bool whole_heap = false);
|
||||
void invalidate(MemRegion mr);
|
||||
|
||||
void write_region_work(MemRegion mr) { invalidate(mr); }
|
||||
void write_ref_array_work(MemRegion mr) { invalidate(mr); }
|
||||
|
||||
@ -380,7 +380,7 @@ void CardTableModRefBS::dirty_MemRegion(MemRegion mr) {
|
||||
}
|
||||
}
|
||||
|
||||
void CardTableModRefBS::invalidate(MemRegion mr, bool whole_heap) {
|
||||
void CardTableModRefBS::invalidate(MemRegion mr) {
|
||||
assert((HeapWord*)align_size_down((uintptr_t)mr.start(), HeapWordSize) == mr.start(), "Unaligned start");
|
||||
assert((HeapWord*)align_size_up ((uintptr_t)mr.end(), HeapWordSize) == mr.end(), "Unaligned end" );
|
||||
for (int i = 0; i < _cur_covered_regions; i++) {
|
||||
|
||||
@ -260,7 +260,7 @@ public:
|
||||
}
|
||||
|
||||
// ModRefBS functions.
|
||||
virtual void invalidate(MemRegion mr, bool whole_heap = false);
|
||||
virtual void invalidate(MemRegion mr);
|
||||
void clear(MemRegion mr);
|
||||
void dirty(MemRegion mr);
|
||||
|
||||
|
||||
@ -159,8 +159,8 @@ public:
|
||||
void clear(MemRegion mr) { _ct_bs->clear(mr); }
|
||||
void clear_into_younger(Generation* old_gen);
|
||||
|
||||
void invalidate(MemRegion mr, bool whole_heap = false) {
|
||||
_ct_bs->invalidate(mr, whole_heap);
|
||||
void invalidate(MemRegion mr) {
|
||||
_ct_bs->invalidate(mr);
|
||||
}
|
||||
void invalidate_or_clear(Generation* old_gen);
|
||||
|
||||
|
||||
@ -86,10 +86,8 @@ public:
|
||||
assert(false, "can't call");
|
||||
}
|
||||
|
||||
// Causes all refs in "mr" to be assumed to be modified. If "whole_heap"
|
||||
// is true, the caller asserts that the entire heap is being invalidated,
|
||||
// which may admit an optimized implementation for some barriers.
|
||||
virtual void invalidate(MemRegion mr, bool whole_heap = false) = 0;
|
||||
// Causes all refs in "mr" to be assumed to be modified.
|
||||
virtual void invalidate(MemRegion mr) = 0;
|
||||
|
||||
// The caller guarantees that "mr" contains no references. (Perhaps it's
|
||||
// objects have been moved elsewhere.)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user