RFR: JDK-8308285: Assert on -Xshare:dump when running with -Xlog:cds=trace
Thomas Stuefe
stuefe at openjdk.org
Wed May 17 12:24:12 UTC 2023
We assert for `java -Xshare:dump -Xlog:cds*=trace`:
# assert(counter_check_mirror == java_class) failed: must be consistent
at
29 Stack: [0x00007f8821535000,0x00007f8821635000], sp=0x00007f8821632e80, free space=1015k
30 Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
31 V [libjvm.so+0xda0155] java_lang_Class::primitive_type(oopDesc*)+0x13d (javaClasses.cpp:1367)
32 V [libjvm.so+0xd9fb95] java_lang_Class::print_signature(oopDesc*, outputStream*)+0x9f (javaClasses.cpp:1284)
33 V [libjvm.so+0xd623f5] InstanceKlass::oop_print_on(oopDesc*, outputStream*)+0x175 (instanceKlass.cpp:3652)
34 V [libjvm.so+0x127ec71] oopDesc::print_on(outputStream*) const+0x9f (oop.cpp:47)
35 V [libjvm.so+0xd34621] void WalkOopAndArchiveClosure::do_oop_work<narrowOop>(narrowOop*)+0x1e1 (heapShared.cpp:1124)
...
When tracing with at trace level, we print each copied oop in full, including the basic java mirrors. As part of the trace, we print the basic type. The utility function `BasicType java_lang_Class::primitive_type(oop java_class)` does a sanity check: the printed oop is supposed to be a class mirror for a basic type, so it must be the same as the oop resolved via (this oop)->array_klass->element_type->mirror for that type).
But at this point in the dump process, we have two variants of these basic mirrors: `Universe::_basic_type_mirrors` and `HeapShared::_scratch_basic_type_mirrors`.
The patch loosens the assert when dumping such that the assert condition is fulfilled if the mirror is found in either of these two arrays.
-------------
Commit messages:
- JDK-8308285-Assert-on-Xshare-dump-when-running-with--Xlog-cds=trace
Changes: https://git.openjdk.org/jdk/pull/14031/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14031&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8308285
Stats: 9 lines in 1 file changed: 8 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/14031.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14031/head:pull/14031
PR: https://git.openjdk.org/jdk/pull/14031
More information about the hotspot-runtime-dev
mailing list