eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.26k stars 717 forks source link

JDK21 compiler debug build fails due to failed assertion "_unionPropertyA union is not disjoint for this node aloadi" #19836

Closed cjjdespres closed 1 month ago

cjjdespres commented 1 month ago

I tried compiling JDK21 with the JIT in debug mode using the extra flags:

export cflags="-Og -ggdb3 -fno-inline -DDEBUG"
export EXTRA_CMAKE_ARGS="-DJ9JIT_EXTRA_CFLAGS=\"$cflags\" -DJ9JIT_EXTRA_CXXFLAGS=\"$cflags\""

The JDK image appears to fail consistently with

[100%] Built target j9ddr
Generating DDR pointer and structure class files
Generating DDR structure stub source files
Generating DDR pointer class source files
superset directory name : /root/hostdir/foo/openj9-openjdk-jdk21/build/linux-x86_64-server-release/vm/
superset file name : superset.dat
superset directory name: /root/hostdir/foo/openj9-openjdk-jdk21/build/linux-x86_64-server-release/vm/
superset file name: superset.dat
Writing generated classes to /root/hostdir/foo/openj9-openjdk-jdk21/build/linux-x86_64-server-release/support/gensrc/openj9.dtfj/com/ibm/j9ddr/vm29/pointer/generated
Writing generated classes to /root/hostdir/foo/openj9-openjdk-jdk21/build/linux-x86_64-server-release/support/gensrc/openj9.dtfj/com/ibm/j9ddr/vm29/structure
Unhandled structure type: big_int_unionPointer->i128 __int128
Unhandled structure type: _IO_FILEPointer->_lock _IO_lock_t*
Structure stub generation complete
Pointer class generation complete
Optimizing the exploded image
Assertion failed at /root/hostdir/foo/openj9-openjdk-jdk21/openj9/runtime/compiler/il/J9Node.cpp:63: self()->hasSymbolReference() + self()->hasRegLoadStoreSymbolReference() + self()->hasBranchDestinationNode() + self()->hasBlock() + self()->hasArrayStride() + self()->hasPinningArrayPointer() + self()->hasDataType() <= 1
VMState: 0x00050080
    _unionPropertyA union is not disjoint for this node aloadi (0x7f861d703770):
  has({SymbolReference, ...}, ..., DataType) = ({1,0},0,0,0,1,0)

compiling java/lang/ref/Reference.refersTo(Ljava/lang/Object;)Z at level: cold

Unhandled exception
Type=Unhandled trap vmState=0x00050080
J9Generic_Signal_Number=00000108 Signal_Number=00000005 Error_Value=00000000 Signal_Code=fffffffa
Handler1=00007F8626E44180 Handler2=00007F86270FFB40
RDI=0000000000016856 RSI=0000000000016865 RAX=0000000000000000 RBX=00007F86250DD640
RCX=00007F862730C9FC RDX=0000000000000005 R8=00007F862674A0A0 R9=000000007FFFFFFF
R10=0000000000000001 R11=0000000000000246 R12=0000000000000005 R13=0000000000000016
R14=00007F862674A010 R15=0000000000000000
RIP=00007F862730C9FC GS=0000 FS=0000 RSP=00007F86250D76D0
EFlags=0000000000000246 CS=0033 RBP=0000000000016865 ERR=0000000000000000
TRAPNO=0000000000000000 OLDMASK=0000000000000000 CR2=0000000000000000
xmm0=0000000000000000 (f: 0.000000, d: 0.000000e+00)
xmm1=0000000000000000 (f: 0.000000, d: 0.000000e+00)
xmm2=000000000000ff00 (f: 65280.000000, d: 3.225261e-319)
xmm3=2b286f732e393274 (f: 775500416.000000, d: 8.727906e-101)
xmm4=78302b286f732e39 (f: 1869819392.000000, d: 8.541775e+270)
xmm5=6a2f657361656c65 (f: 1634036864.000000, d: 3.076135e+203)
xmm6=6975622f31326b64 (f: 825387904.000000, d: 1.023002e+200)
xmm7=74736f682f746f6f (f: 796159872.000000, d: 8.905638e+252)
xmm8=5f2f706d742f000a (f: 1949237248.000000, d: 3.216021e+150)
xmm9=0000000000000000 (f: 0.000000, d: 0.000000e+00)
xmm10=0000000000000000 (f: 0.000000, d: 0.000000e+00)
xmm11=0000000000000000 (f: 0.000000, d: 0.000000e+00)
xmm12=0000000000000000 (f: 0.000000, d: 0.000000e+00)
xmm13=0000000000000000 (f: 0.000000, d: 0.000000e+00)
xmm14=0000000000000000 (f: 0.000000, d: 0.000000e+00)
xmm15=0000000000000000 (f: 0.000000, d: 0.000000e+00)
Module=/lib/x86_64-linux-gnu/libc.so.6
Module_base_address=00007F8627276000 Symbol=pthread_kill
Symbol_address=00007F862730C8D0

Method_being_compiled=java/lang/ref/Reference.refersTo(Ljava/lang/Object;)Z
Target=2_90_20240709_000000 (Linux 5.14.0-427.22.1.el9_4.x86_64)
CPU=amd64 (8 logical CPUs) (0x3d781b000 RAM)

----------- Stack Backtrace -----------
pthread_kill+0x12c (0x00007F862730C9FC [libc.so.6+0x969fc])
raise+0x16 (0x00007F86272B8476 [libc.so.6+0x42476])
_ZN2TR4trapEv+0x4d (0x00007F86263C5BE9 [libj9jit29.so+0x5c5be9])
_ZN2TR15fatal_assertionEPKciS1_S1_z+0x0 (0x00007F86263C5E4F [libj9jit29.so+0x5c5e4f])
_ZN2TR9assertionEPKciS1_S1_z+0xd0 (0x00007F86263C606C [libj9jit29.so+0x5c606c])
_ZN2J94NodeC2EPN2TR4NodeENS1_9ILOpCodesEt+0x1c5 (0x00007F86260C6961 [libj9jit29.so+0x2c6961])
_ZN2TR4NodeC1EPS0_NS_9ILOpCodesEt+0x10 (0x00007F86263C277A [libj9jit29.so+0x5c277a])
_ZN3OMR4Node14createInternalEPN2TR4NodeENS1_9ILOpCodesEtS3_+0xcc (0x00007F86263AD354 [libj9jit29.so+0x5ad354])
_ZN3OMR4Node35recreateWithSymRefWithoutPropertiesIJPN2TR15SymbolReferenceEEEEPNS2_4NodeES6_NS2_9ILOpCodesEttS6_DpT_+0x25 (0x00007F8625F09F3B [libj9jit29.so+0x109f3b])
_ZN3OMR4Node24createWithSymRefInternalIJPN2TR15SymbolReferenceEEEEPNS2_4NodeENS2_9ILOpCodesEttS6_DpT_+0x23 (0x00007F8625F09FB7 [libj9jit29.so+0x109fb7])
_ZN3OMR4Node16createWithSymRefIJPN2TR15SymbolReferenceEEEEPNS2_4NodeENS2_9ILOpCodesEttS6_DpT_+0x36 (0x00007F8625F09FF2 [libj9jit29.so+0x109ff2])
_ZN24TR_J9ByteCodeIlGenerator30inlineJitCheckIfFinalizeObjectEPN2TR5BlockE+0x128 (0x00007F86260D7718 [libj9jit29.so+0x2d7718])
_ZN24TR_J9ByteCodeIlGenerator18genILFromByteCodesEv+0x70a (0x00007F86260DD37C [libj9jit29.so+0x2dd37c])
_ZN24TR_J9ByteCodeIlGenerator13internalGenILEv+0x57b (0x00007F86260DE97D [libj9jit29.so+0x2de97d])
_ZN24TR_J9ByteCodeIlGenerator5genILEv+0xcc (0x00007F86260DEA50 [libj9jit29.so+0x2dea50])
_ZN3OMR20ResolvedMethodSymbol5genILEP11TR_FrontEndPN2TR11CompilationEPNS3_20SymbolReferenceTableERNS3_12IlGenRequestE+0x502 (0x00007F8626382C4A [libj9jit29.so+0x582c4a])
_ZN3OMR11Compilation7compileEv+0x4b3 (0x00007F8626365889 [libj9jit29.so+0x565889])
_ZN2TR28CompilationInfoPerThreadBase7compileEP10J9VMThreadPNS_11CompilationEP17TR_ResolvedMethodR11TR_J9VMBaseP19TR_OptimizationPlanRKNS_16SegmentAllocatorE+0xae7 (0x00007F8625F3F707 [libj9jit29.so+0x13f707])
_ZN2TR28CompilationInfoPerThreadBase14wrappedCompileEP13J9PortLibraryPv+0xad6 (0x00007F8625F40992 [libj9jit29.so+0x140992])
omrsig_protect+0x241 (0x00007F86271007F1 [libj9prt29.so+0x2a7f1])
_ZN2TR28CompilationInfoPerThreadBase7compileEP10J9VMThreadP21TR_MethodToBeCompiledRN2J917J9SegmentProviderE+0x614 (0x00007F8625F3DB3E [libj9jit29.so+0x13db3e])
_ZN2TR24CompilationInfoPerThread12processEntryER21TR_MethodToBeCompiledRN2J917J9SegmentProviderE+0x2e1 (0x00007F8625F3E1D1 [libj9jit29.so+0x13e1d1])
_ZN2TR24CompilationInfoPerThread14processEntriesEv+0x159 (0x00007F8625F3C70B [libj9jit29.so+0x13c70b])
_ZN2TR24CompilationInfoPerThread3runEv+0x2d (0x00007F8625F3CE6D [libj9jit29.so+0x13ce6d])
_Z30protectedCompilationThreadProcP13J9PortLibraryPN2TR24CompilationInfoPerThreadE+0x97 (0x00007F8625F3CF67 [libj9jit29.so+0x13cf67])
omrsig_protect+0x241 (0x00007F86271007F1 [libj9prt29.so+0x2a7f1])
_Z21compilationThreadProcPv+0x1c0 (0x00007F8625F3D370 [libj9jit29.so+0x13d370])
thread_wrapper+0x187 (0x00007F8627159C07 [libj9thr29.so+0xbc07])
 (0x00007F862730AAC3 [libc.so.6+0x94ac3])
 (0x00007F862739C850 [libc.so.6+0x126850])

There were a lot of "Unhandled exception/Stack Backtrace" blocks interleaved with each other in the log - I think they're mostly the same, other than the Method_being_compiled, and I think what I extracted above is right.

cjjdespres commented 1 month ago

Also note that the compiler won't build with -DDEBUG with the default Ubuntu 22 docker image due to https://github.com/eclipse/omr/issues/7402. I think Ubuntu 20 should be fine, at least, or the fatal warnings option should be turned off.

cjjdespres commented 1 month ago

I see that in https://github.com/eclipse/omr/pull/7345 there was a similar assertion that came up in testing, and the solution was apparently this in omr/compiler/il/OMRNode.cpp:

https://github.com/eclipse/omr/pull/7345/files#diff-0e5625a42146f7d0b2d8dc885b114a40612a550d71d0b2b71a57adb9dd435356L218-R218

@rmnattas Would making a similar change to the assert here:

https://github.com/eclipse-openj9/openj9/blob/4aa1e64fe4c561557211a460951954d1a64ee6de/runtime/compiler/il/J9Node.cpp#L63-L80

be warranted?