8253081: G1 fails on stale objects in archived module graph in Open Archive regions

Change the handling of Open Archive areas, instead of assuming that everything in there is live always, a root containing references to all live root objects is provided. Adapt G1 to handle Open Archive regions as any other old region apart from never compacting or evacuating them.

Co-authored-by: Ioi Lam <iklam@openjdk.org>
Reviewed-by: kbarrett, sjohanss, redestad
This commit is contained in:
Thomas Schatzl 2020-11-18 08:21:03 +00:00
parent c08921487b
commit d30956055b
32 changed files with 584 additions and 230 deletions

View file

@ -774,15 +774,22 @@ void ConstantPoolCache::deallocate_contents(ClassLoaderData* data) {
#if INCLUDE_CDS_JAVA_HEAP
oop ConstantPoolCache::archived_references() {
if (CompressedOops::is_null(_archived_references)) {
if (_archived_references_index < 0) {
return NULL;
}
return HeapShared::materialize_archived_object(_archived_references);
return HeapShared::get_root(_archived_references_index);
}
void ConstantPoolCache::clear_archived_references() {
if (_archived_references_index >= 0) {
HeapShared::clear_root(_archived_references_index);
_archived_references_index = -1;
}
}
void ConstantPoolCache::set_archived_references(oop o) {
assert(DumpSharedSpaces, "called only during runtime");
_archived_references = CompressedOops::encode(o);
_archived_references_index = HeapShared::append_root(o);
}
#endif