If you have created the default CDS archive by "java -Xshare:dump", then " java -XX:+EnableValhalla -version" would fail with a stack trace similar to the following. That's because CDS is automatically used when the default archive exists.
Because Valhalla does not support CDS yet, the VM should automatically disable CDS when -XX:+EnableValhalla is specified.
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/home/iklam/jdk/valhalla/open/src/hotspot/share/oops/oop.inline.hpp:155), pid=29241, tid=29245
# assert(!EnableValhalla || (k->is_value() && Klass::ptr_is_value_type(k)) || (!k->is_value() && !Klass::ptr_is_value_type(k))) failed: Klass value encoding
#
# JRE version: (11.0) (fastdebug build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 11-internal+0-adhoc.iklam.open, mixed mode, sharing, compressed oops, g1 gc, linux-amd64)
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %P" (or dumping to /jdk/tmp/jtreg/work/scratch/7/core.29241)
Current thread (0x00007fa20c01c800): JavaThread "Unknown thread" [_thread_in_vm, id=29245, stack(0x00007fa2153ac000,0x00007fa2154ad000)]
Stack: [0x00007fa2153ac000,0x00007fa2154ad000], sp=0x00007fa2154ab540, free space=1021k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x19657a2] VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x162
V [libjvm.so+0x19666cf] VMError::report_and_die(Thread*, void*, char const*, int, char const*, char const*, __va_list_tag*)+0x2f
V [libjvm.so+0xbbc3dd] report_vm_error(char const*, int, char const*, char const*, ...)+0xfd
V [libjvm.so+0x6d9996] CollectedHeap::post_allocation_setup_array(Klass*, HeapWord*, int)+0x766
V [libjvm.so+0x18c0e41] TypeArrayKlass::allocate_common(int, bool, Thread*)+0x13a1
V [libjvm.so+0x183dfa1] SystemDictionary::initialize(Thread*)+0x191
V [libjvm.so+0x18ce1a8] Universe::genesis(Thread*)+0x4a8
V [libjvm.so+0x18ceaac] universe2_init()+0x2c
V [libjvm.so+0xf27aa8] init_globals()+0xa8
V [libjvm.so+0x188cddc] Threads::create_vm(JavaVMInitArgs*, bool*)+0x2cc
V [libjvm.so+0x10add18] JNI_CreateJavaVM+0xa8
C [libjli.so+0x4371] JavaMain+0x81a
....
Dynamic libraries:
...
/jdk/bld/valhalla-fastdebug/images/jdk/lib/server/classes.jsa
Because Valhalla does not support CDS yet, the VM should automatically disable CDS when -XX:+EnableValhalla is specified.
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/home/iklam/jdk/valhalla/open/src/hotspot/share/oops/oop.inline.hpp:155), pid=29241, tid=29245
# assert(!EnableValhalla || (k->is_value() && Klass::ptr_is_value_type(k)) || (!k->is_value() && !Klass::ptr_is_value_type(k))) failed: Klass value encoding
#
# JRE version: (11.0) (fastdebug build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 11-internal+0-adhoc.iklam.open, mixed mode, sharing, compressed oops, g1 gc, linux-amd64)
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %P" (or dumping to /jdk/tmp/jtreg/work/scratch/7/core.29241)
Current thread (0x00007fa20c01c800): JavaThread "Unknown thread" [_thread_in_vm, id=29245, stack(0x00007fa2153ac000,0x00007fa2154ad000)]
Stack: [0x00007fa2153ac000,0x00007fa2154ad000], sp=0x00007fa2154ab540, free space=1021k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x19657a2] VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x162
V [libjvm.so+0x19666cf] VMError::report_and_die(Thread*, void*, char const*, int, char const*, char const*, __va_list_tag*)+0x2f
V [libjvm.so+0xbbc3dd] report_vm_error(char const*, int, char const*, char const*, ...)+0xfd
V [libjvm.so+0x6d9996] CollectedHeap::post_allocation_setup_array(Klass*, HeapWord*, int)+0x766
V [libjvm.so+0x18c0e41] TypeArrayKlass::allocate_common(int, bool, Thread*)+0x13a1
V [libjvm.so+0x183dfa1] SystemDictionary::initialize(Thread*)+0x191
V [libjvm.so+0x18ce1a8] Universe::genesis(Thread*)+0x4a8
V [libjvm.so+0x18ceaac] universe2_init()+0x2c
V [libjvm.so+0xf27aa8] init_globals()+0xa8
V [libjvm.so+0x188cddc] Threads::create_vm(JavaVMInitArgs*, bool*)+0x2cc
V [libjvm.so+0x10add18] JNI_CreateJavaVM+0xa8
C [libjli.so+0x4371] JavaMain+0x81a
....
Dynamic libraries:
...
/jdk/bld/valhalla-fastdebug/images/jdk/lib/server/classes.jsa
- duplicates
-
JDK-8207193 [lworld] java -XX:+EnableValhalla crashes on start-up if default CDS archive exists
-
- Closed
-