Integrated: JDK-8308285: Assert on -Xshare:dump when running with -Xlog:cds=trace

Thomas Stuefe stuefe at openjdk.org
Thu May 18 05:50:59 UTC 2023


On Wed, 17 May 2023 12:17:17 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 95da499e
Author:    Thomas Stuefe <stuefe at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/95da499ef229d0dfd5fc348f68b9bfd91015b045
Stats:     9 lines in 1 file changed: 8 ins; 0 del; 1 mod

8308285: Assert on -Xshare:dump when running with -Xlog:cds=trace

Reviewed-by: ccheung, iklam

-------------

PR: https://git.openjdk.org/jdk/pull/14031


More information about the hotspot-runtime-dev mailing list