mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
7029036: Card-table verification hangs with all framework collectors, except G1, even before the first GC
When verifying clean card ranges, use memory-range-bounded iteration over oops of objects overlapping that range, thus avoiding the otherwise quadratic worst-case cost of scanning large object arrays. Reviewed-by: jmasa, jwilhelm, tonyp
This commit is contained in:
parent
4282af91a0
commit
3e02204f5d
1 changed files with 26 additions and 14 deletions
|
@ -318,17 +318,28 @@ private:
|
||||||
protected:
|
protected:
|
||||||
template <class T> void do_oop_work(T* p) {
|
template <class T> void do_oop_work(T* p) {
|
||||||
HeapWord* jp = (HeapWord*)p;
|
HeapWord* jp = (HeapWord*)p;
|
||||||
if (jp >= _begin && jp < _end) {
|
assert(jp >= _begin && jp < _end,
|
||||||
oop obj = oopDesc::load_decode_heap_oop(p);
|
err_msg("Error: jp " PTR_FORMAT " should be within "
|
||||||
guarantee(obj == NULL ||
|
"[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")",
|
||||||
(HeapWord*)p < _boundary ||
|
_begin, _end));
|
||||||
(HeapWord*)obj >= _boundary,
|
oop obj = oopDesc::load_decode_heap_oop(p);
|
||||||
"pointer on clean card crosses boundary");
|
guarantee(obj == NULL || (HeapWord*)obj >= _boundary,
|
||||||
}
|
err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on "
|
||||||
|
"clean card crosses boundary" PTR_FORMAT,
|
||||||
|
(HeapWord*)obj, jp, _boundary));
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VerifyCleanCardClosure(HeapWord* b, HeapWord* begin, HeapWord* end) :
|
VerifyCleanCardClosure(HeapWord* b, HeapWord* begin, HeapWord* end) :
|
||||||
_boundary(b), _begin(begin), _end(end) {}
|
_boundary(b), _begin(begin), _end(end) {
|
||||||
|
assert(b <= begin,
|
||||||
|
err_msg("Error: boundary " PTR_FORMAT " should be at or below begin " PTR_FORMAT,
|
||||||
|
b, begin));
|
||||||
|
assert(begin <= end,
|
||||||
|
err_msg("Error: begin " PTR_FORMAT " should be strictly below end " PTR_FORMAT,
|
||||||
|
begin, end));
|
||||||
|
}
|
||||||
|
|
||||||
virtual void do_oop(oop* p) { VerifyCleanCardClosure::do_oop_work(p); }
|
virtual void do_oop(oop* p) { VerifyCleanCardClosure::do_oop_work(p); }
|
||||||
virtual void do_oop(narrowOop* p) { VerifyCleanCardClosure::do_oop_work(p); }
|
virtual void do_oop(narrowOop* p) { VerifyCleanCardClosure::do_oop_work(p); }
|
||||||
};
|
};
|
||||||
|
@ -392,13 +403,14 @@ void CardTableRS::verify_space(Space* s, HeapWord* gen_boundary) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Now traverse objects until end.
|
// Now traverse objects until end.
|
||||||
HeapWord* cur = start_block;
|
if (begin < end) {
|
||||||
VerifyCleanCardClosure verify_blk(gen_boundary, begin, end);
|
MemRegion mr(begin, end);
|
||||||
while (cur < end) {
|
VerifyCleanCardClosure verify_blk(gen_boundary, begin, end);
|
||||||
if (s->block_is_obj(cur) && s->obj_is_alive(cur)) {
|
for (HeapWord* cur = start_block; cur < end; cur += s->block_size(cur)) {
|
||||||
oop(cur)->oop_iterate(&verify_blk);
|
if (s->block_is_obj(cur) && s->obj_is_alive(cur)) {
|
||||||
|
oop(cur)->oop_iterate(&verify_blk, mr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cur += s->block_size(cur);
|
|
||||||
}
|
}
|
||||||
cur_entry = first_dirty;
|
cur_entry = first_dirty;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue