During the AOT assembly phase, we create various of tables to store information about Java objects that are being stored into the AOT cache. E.g.
typedef ResizeableResourceHashtable<oop, CachedOopInfo,
AnyObj::C_HEAP,
mtClassShared,
HeapShared::oop_hash> ArchivedObjectCache;
static ArchivedObjectCache* _archived_object_cache;
These tables use raw "oop" pointers. Today, in the JDK mainline, these tables are created and used strictly within the CDS safepoint, so the raw oop pointers will remain valid during the entire lifetime of these tables.
However, in the Leyden repo, we need to use some of these tables after we leave the CDS safepoint. For example, the AOT method compiler may need to consult these tables, but the compiler cannot work while the VM is still inside the CDS safepoint.
Another example in the Leyden repo is that the -Xlog:aot+map logging is done after AOT methods are compiled, but the logs also need to consult these tables. Without this fix, -Xlog:aot+map=trace,aot+map+oops=trace:file=cds.oops.txt:none:filesize=0 will sometimes fail due to stale oops.
PROPOSAL:
[1] Convert some of these tables to use OopHandles to ensure GC safety
[2] Explicitly delete other tables before exiting the CDS safepoint, so that they cannot be mis-used.
This RFE is a prerequisite for upstreaming the AOT method compiler from Leyden to mainline.
typedef ResizeableResourceHashtable<oop, CachedOopInfo,
AnyObj::C_HEAP,
mtClassShared,
HeapShared::oop_hash> ArchivedObjectCache;
static ArchivedObjectCache* _archived_object_cache;
These tables use raw "oop" pointers. Today, in the JDK mainline, these tables are created and used strictly within the CDS safepoint, so the raw oop pointers will remain valid during the entire lifetime of these tables.
However, in the Leyden repo, we need to use some of these tables after we leave the CDS safepoint. For example, the AOT method compiler may need to consult these tables, but the compiler cannot work while the VM is still inside the CDS safepoint.
Another example in the Leyden repo is that the -Xlog:aot+map logging is done after AOT methods are compiled, but the logs also need to consult these tables. Without this fix, -Xlog:aot+map=trace,aot+map+oops=trace:file=cds.oops.txt:none:filesize=0 will sometimes fail due to stale oops.
PROPOSAL:
[1] Convert some of these tables to use OopHandles to ensure GC safety
[2] Explicitly delete other tables before exiting the CDS safepoint, so that they cannot be mis-used.
This RFE is a prerequisite for upstreaming the AOT method compiler from Leyden to mainline.