RFR[S] 8241158 SA TestHeapDumpForInvokeDynamic.java fails when CDS archive is relocated

Ioi Lam ioi.lam at oracle.com
Tue Apr 14 22:01:55 UTC 2020


This is a bug in the CDS relocation code. When 
-XX:ArchiveRelocationMode=1 is
specified, the CDS archive is mapped to an address picked by the OS
(instead of the default address 0x800000000). As a result, we need to patch
the native Klass* pointers inside java.lang.Class instances that are
stored in the CDS archived heap region.

Before this fix, the patching is done incrementally, when a class is 
However, when SA tries to do a heap dump, it may see a java.lang.Class 
that is not yet resolved, whose Klass* pointer has not been patched.
Dereferencing the unpatched pointer causes SA to fail.

(The failure happens on macos only, probably because the invalid dereference
causes different exceptions on other platforms due to specific memory 
and SA is able to handle such exceptions and limp on).

The fix is to unconditionally patch all the Klass* pointers during VM

We already patch a lot of stuff at start-up when the CDS archive is 
so doing a little patching more doesn't hurt.


Passed mach5 tiers 1-4. Ran the failed test manually on macos and it passed.

- Ioi

More information about the hotspot-runtime-dev mailing list