mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8023021: Unnecessary clearing of the card table introduced by the fix for JDK-8023013
Reviewed-by: stefank, ehelin
This commit is contained in:
parent
dab6bdc071
commit
c144b8c30f
4 changed files with 17 additions and 24 deletions
|
@ -310,32 +310,27 @@ void CardTableRS::younger_refs_in_space_iterate(Space* sp,
|
||||||
_ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this);
|
_ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardTableRS::clear_into_younger(Generation* gen) {
|
void CardTableRS::clear_into_younger(Generation* old_gen) {
|
||||||
GenCollectedHeap* gch = GenCollectedHeap::heap();
|
assert(old_gen->level() == 1, "Should only be called for the old generation");
|
||||||
// Generations younger than gen have been evacuated. We can clear
|
// The card tables for the youngest gen need never be cleared.
|
||||||
// card table entries for gen (we know that it has no pointers
|
|
||||||
// to younger gens) and for those below. The card tables for
|
|
||||||
// the youngest gen need never be cleared.
|
|
||||||
// There's a bit of subtlety in the clear() and invalidate()
|
// There's a bit of subtlety in the clear() and invalidate()
|
||||||
// methods that we exploit here and in invalidate_or_clear()
|
// methods that we exploit here and in invalidate_or_clear()
|
||||||
// below to avoid missing cards at the fringes. If clear() or
|
// below to avoid missing cards at the fringes. If clear() or
|
||||||
// invalidate() are changed in the future, this code should
|
// invalidate() are changed in the future, this code should
|
||||||
// be revisited. 20040107.ysr
|
// be revisited. 20040107.ysr
|
||||||
Generation* old_gen = gen;
|
|
||||||
clear(old_gen->prev_used_region());
|
clear(old_gen->prev_used_region());
|
||||||
Generation* young_gen = gch->prev_gen(old_gen);
|
|
||||||
clear(young_gen->prev_used_region());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardTableRS::invalidate_or_clear(Generation* gen) {
|
void CardTableRS::invalidate_or_clear(Generation* old_gen) {
|
||||||
// For generation gen invalidate the cards for the currently
|
assert(old_gen->level() == 1, "Should only be called for the old generation");
|
||||||
// occupied part of that generation and clear the cards for the
|
// Invalidate the cards for the currently occupied part of
|
||||||
|
// the old generation and clear the cards for the
|
||||||
// unoccupied part of the generation (if any, making use
|
// unoccupied part of the generation (if any, making use
|
||||||
// of that generation's prev_used_region to determine that
|
// of that generation's prev_used_region to determine that
|
||||||
// region). No need to do anything for the youngest
|
// region). No need to do anything for the youngest
|
||||||
// generation. Also see note#20040107.ysr above.
|
// generation. Also see note#20040107.ysr above.
|
||||||
MemRegion used_mr = gen->used_region();
|
MemRegion used_mr = old_gen->used_region();
|
||||||
MemRegion to_be_cleared_mr = gen->prev_used_region().minus(used_mr);
|
MemRegion to_be_cleared_mr = old_gen->prev_used_region().minus(used_mr);
|
||||||
if (!to_be_cleared_mr.is_empty()) {
|
if (!to_be_cleared_mr.is_empty()) {
|
||||||
clear(to_be_cleared_mr);
|
clear(to_be_cleared_mr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,12 +142,12 @@ public:
|
||||||
void verify_aligned_region_empty(MemRegion mr);
|
void verify_aligned_region_empty(MemRegion mr);
|
||||||
|
|
||||||
void clear(MemRegion mr) { _ct_bs->clear(mr); }
|
void clear(MemRegion mr) { _ct_bs->clear(mr); }
|
||||||
void clear_into_younger(Generation* gen);
|
void clear_into_younger(Generation* old_gen);
|
||||||
|
|
||||||
void invalidate(MemRegion mr, bool whole_heap = false) {
|
void invalidate(MemRegion mr, bool whole_heap = false) {
|
||||||
_ct_bs->invalidate(mr, whole_heap);
|
_ct_bs->invalidate(mr, whole_heap);
|
||||||
}
|
}
|
||||||
void invalidate_or_clear(Generation* gen);
|
void invalidate_or_clear(Generation* old_gen);
|
||||||
|
|
||||||
static uintx ct_max_alignment_constraint() {
|
static uintx ct_max_alignment_constraint() {
|
||||||
return CardTableModRefBS::ct_max_alignment_constraint();
|
return CardTableModRefBS::ct_max_alignment_constraint();
|
||||||
|
|
|
@ -121,17 +121,15 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, bool c
|
||||||
all_empty = all_empty && gch->get_gen(i)->used() == 0;
|
all_empty = all_empty && gch->get_gen(i)->used() == 0;
|
||||||
}
|
}
|
||||||
GenRemSet* rs = gch->rem_set();
|
GenRemSet* rs = gch->rem_set();
|
||||||
|
Generation* old_gen = gch->get_gen(level);
|
||||||
// Clear/invalidate below make use of the "prev_used_regions" saved earlier.
|
// Clear/invalidate below make use of the "prev_used_regions" saved earlier.
|
||||||
if (all_empty) {
|
if (all_empty) {
|
||||||
// We've evacuated all generations below us.
|
// We've evacuated all generations below us.
|
||||||
Generation* g = gch->get_gen(level);
|
rs->clear_into_younger(old_gen);
|
||||||
rs->clear_into_younger(g);
|
|
||||||
} else {
|
} else {
|
||||||
// Invalidate the cards corresponding to the currently used
|
// Invalidate the cards corresponding to the currently used
|
||||||
// region and clear those corresponding to the evacuated region
|
// region and clear those corresponding to the evacuated region.
|
||||||
// of all generations just collected.
|
rs->invalidate_or_clear(old_gen);
|
||||||
rs->invalidate_or_clear(gch->get_gen(1));
|
|
||||||
rs->invalidate_or_clear(gch->get_gen(0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Threads::gc_epilogue();
|
Threads::gc_epilogue();
|
||||||
|
|
|
@ -135,7 +135,7 @@ public:
|
||||||
// younger than gen from generations gen and older.
|
// younger than gen from generations gen and older.
|
||||||
// The parameter clear_perm indicates if the perm_gen's
|
// The parameter clear_perm indicates if the perm_gen's
|
||||||
// remembered set should also be processed/cleared.
|
// remembered set should also be processed/cleared.
|
||||||
virtual void clear_into_younger(Generation* gen) = 0;
|
virtual void clear_into_younger(Generation* old_gen) = 0;
|
||||||
|
|
||||||
// Informs the RS that refs in the given "mr" may have changed
|
// Informs the RS that refs in the given "mr" may have changed
|
||||||
// arbitrarily, and therefore may contain old-to-young pointers.
|
// arbitrarily, and therefore may contain old-to-young pointers.
|
||||||
|
@ -147,7 +147,7 @@ public:
|
||||||
// Informs the RS that refs in this generation
|
// Informs the RS that refs in this generation
|
||||||
// may have changed arbitrarily, and therefore may contain
|
// may have changed arbitrarily, and therefore may contain
|
||||||
// old-to-young pointers in arbitrary locations.
|
// old-to-young pointers in arbitrary locations.
|
||||||
virtual void invalidate_or_clear(Generation* gen) = 0;
|
virtual void invalidate_or_clear(Generation* old_gen) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHARE_VM_MEMORY_GENREMSET_HPP
|
#endif // SHARE_VM_MEMORY_GENREMSET_HPP
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue