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.29k stars 722 forks source link

Assertion failure at openj9/runtime/compiler/aarch64/codegen/J9TreeEvaluator.cpp:1828: node->getSecondChild()->getOpCodeValue() != TR::loadaddr #17581

Closed dylanjtuttle closed 1 year ago

dylanjtuttle commented 1 year ago

The assertion at

openj9/runtime/compiler/aarch64/codegen/J9TreeEvaluator.cpp:1828: node->getSecondChild()->getOpCodeValue() != TR::loadaddr

fires when building OpenJDK 11 on aarch64_linux with the -DPROD_WITH_ASSUMES flag enabled in openj9/runtime/compiler/CMakeLists.txt.

Link to the Jenkins build.

For some reason, the assertion message did not print during the build. See the stack trace:

13:43:56  Compiling 4 files for BUILD_JIGSAW_TOOLS
13:43:57  JIT: crashed while compiling java/util/WeakHashMap.expungeStaleEntries()V (recoverable 0)
13:43:57  #0: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x7c4ab4) [0x4000087c4ab4]
13:43:57  #1: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x7d29a0) [0x4000087d29a0]
13:43:57  #2: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x1076f4) [0x4000081076f4]
13:43:57  #3: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9prt29.so(+0x2a6d0) [0x4000032136d0]
13:43:57  Unhandled exception
13:43:57 
 Type=Segmentation error vmState=0x0005ff04
13:43:57  J9Generic_Signal_Number=00000018 Signal_Number=0000000b Error_Value=00000000 Signal_Code=00000001
13:43:57  Handler1=0000400003046D58 Handler2=0000400003213558 InaccessibleAddress=0000000000000000
13:43:57  R0=0000000000000000 R1=0000000000000001 R2=000000000000B770 R3=0000000000000066
13:43:57  R4=0000000000000001 R5=00004000194719C0 R6=00004000194718E0 R7=000040001932CF50
13:43:57  R8=0000000000000000 R9=6E616C2F6176616A R10=00247463656A624F R11=000040000387A8D0
13:43:57  R12=6E616C2F6176616A R13=0000000000000000 R14=FFFF800000000000 R15=0000000000001150
13:43:57  R16=0000400008AF0010 R17=0000400002C2CCD4 R18=00000000000011F0 R19=000040001932CF50
13:43:57  R20=00004000193A8860 R21=00004000194718E0 R22=0000400019471B40 R23=00000000FFFFFFFF
13:43:57  R24=0000400019471AB0 R25=00004000194726F0 R26=0000400019471F30 R27=0000000000000001
13:43:57  R28=00004000194719C0 R29=0000400003F2FF70 R30=00004000083DBE5C R31=0000400003F2AF90
13:43:57  PC=00004000083DBC5C SP=0000400003F2AF90 PSTATE=0000000020000000
13:43:57  V0 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V1 0000002300000022 (f: 34.000000, d: 7.426985e-313)
13:43:57  V2 0000000600000005 (f: 5.000000, d: 1.273197e-313)
13:43:57  V3 0000000200000001 (f: 1.000000, d: 4.243992e-314)
13:43:57  V4 0000004000000040 (f: 64.000000, d: 1.358077e-312)
13:43:57  V5 0000000400000004 (f: 4.000000, d: 8.487983e-314)
13:43:57  V6 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V7 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V8 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V9 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V10 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V11 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V12 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V13 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V14 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V15 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V16 ffffffffffffffff (f: 4294967296.000000, d: -nan)
13:43:57  V17 0f0f0f0f0f0f0f0f (f: 252645136.000000, d: 3.815737e-236)
13:43:57  V18 5555555555555555 (f: 1431655808.000000, d: 1.194531e+103)
13:43:57  V19 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V20 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V21 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V22 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V23 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V24 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V25 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V26 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V27 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V28 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V29 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V30 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  V31 0000000000000000 (f: 0.000000, d: 0.000000e+00)
13:43:57  Module=/home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so
13:43:57  Module_base_address=0000400008000000
13:43:57  
13:43:57  Method_being_compiled=java/util/WeakHashMap.expungeStaleEntries()V
13:43:57  Target=2_90_20230609_461 (Linux 5.10.109-200.el7.aarch64)
13:43:57  CPU=aarch64 (12 logical CPUs) (0x3c5cc1000 RAM)
13:43:57  ----------- Stack Backtrace -----------
13:43:57  protectedBacktrace+0x18 (0x000040000320FCC0 [libj9prt29.so+0x26cc0])
13:43:57  ---------------------------------------
13:43:57  JVMDUMP039I Processing dump event "gpf", detail "" at 2023/06/09 13:43:56 - please wait.
13:43:57  JVMDUMP032I JVM requested System dump using '/home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/core.20230609.134356.28985.0001.dmp' in response to an event
13:43:57  JVMDUMP010I System dump written to /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/core.20230609.134356.28985.0001.dmp
13:43:57  JVMDUMP032I JVM requested Java dump using '/home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/javacore.20230609.134356.28985.0002.txt' in response to an event
13:43:58  JVMDUMP010I Java dump written to /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/javacore.20230609.134356.28985.0002.txt
13:43:58  JVMDUMP032I JVM requested Snap dump using '/home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/Snap.20230609.134356.28985.0003.trc' in response to an event
13:43:58  JVMDUMP010I Snap dump written to /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/Snap.20230609.134356.28985.0003.trc
13:43:58  JVMDUMP032I JVM requested JIT dump using '/home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/jitdump.20230609.134356.28985.0004.dmp' in response to an event
13:43:58  JVMDUMP051I JIT dump occurred in '(unnamed thread)' thread 0x000000000001F100
13:43:58  JVMDUMP049I JIT dump notified all waiting threads of the current method to be compiled
13:43:58  JVMDUMP054I JIT dump is tracing the IL of the method on the crashed compilation thread
13:43:58  JVMDUMP052I JIT dump recursive crash occurred on diagnostic thread
13:43:58  JVMDUMP048I JIT dump method being compiled is an ordinary method
13:43:58  JVMDUMP053I JIT dump is recompiling java/util/WeakHashMap.expungeStaleEntries()V
13:43:58  JVMDUMP052I JIT dump recursive crash occurred on diagnostic thread
13:43:58  JVMDUMP010I JIT dump written to /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/jitdump.20230609.134356.28985.0004.dmp
13:43:58  JVMDUMP013I Processed dump event "gpf", detail "".

@a7ehuo and I were able to confirm that the problem was in fact an assertion failure (and commenting it out does fix the problem), but we're unsure why the message didn't appear in the console output. Perhaps because it happened while it was building exploded-image-optimize?

a7ehuo commented 1 year ago

Add backtrace

...
#12 <signal handler called>
#13 genSuperClassTest (node=node@entry=0x4000193a8860, instanceClassReg=instanceClassReg@entry=0x400019471ab0, 
    instanceClassRegCanBeReclaimed=instanceClassRegCanBeReclaimed@entry=true, castClassReg=0x400019471f30, castClassDepth=castClassDepth@entry=-1, 
    falseLabel=0x4000194719c0, srm=0x4000194718e0, cg=0x40001932cf50)
    at /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/openj9/runtime/compiler/aarch64/codegen/J9TreeEvaluator.cpp:1828
#14 0x00004000083ed888 in VMarrayStoreCHKEvaluator (cg=0x40001932cf50, helperCallLabel=0x4000194719c0, doneLabel=0x400019471900, 
    srm=0x4000194718e0, dstReg=0x400019471530, srcReg=0x40001946fc50, node=0x4000193a8860)
    at /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/openj9/runtime/compiler/aarch64/codegen/J9TreeEvaluator.cpp:4207
#15 J9::ARM64::TreeEvaluator::ArrayStoreCHKEvaluator (node=0x4000193a8860, cg=0x40001932cf50)
    at /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/openj9/runtime/compiler/aarch64/codegen/J9TreeEvaluator.cpp:4287
#16 0x0000400008410e78 in OMR::CodeGenerator::evaluate (this=this@entry=0x40001932cf50, node=node@entry=0x4000193a8860)
    at /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/omr/compiler/codegen/NodeEvaluation.cpp:181
#17 0x00004000080e1464 in J9::CodeGenerator::doInstructionSelection (this=this@entry=0x40001932cf50)
    at /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/openj9/runtime/compiler/codegen/J9CodeGenerator.cpp:2140
#18 0x000040000841e788 in OMR::CodeGenPhase::performInstructionSelectionPhase (cg=cg@entry=0x40001932cf50, phase=0x40001932d3c8)
    at /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/omr/compiler/codegen/OMRCodeGenPhase.cpp:414
#19 0x000040000841f538 in OMR::CodeGenPhase::performAll (this=this@entry=0x40001932d3c8)
    at /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/omr/compiler/codegen/OMRCodeGenPhase.cpp:138
#20 0x000040000841c02c in OMR::CodeGenerator::generateCode (this=0x40001932cf50)
    at /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/omr/compiler/codegen/OMRCodeGenerator.cpp:1409
#21 0x0000400008448a24 in OMR::Compilation::compile (this=this@entry=0x400019327000)
    at /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/omr/compiler/compile/OMRCompilation.cpp:1112
#22 0x0000400008117434 in TR::CompilationInfoPerThreadBase::compile (this=this@entry=0x400003d42080, vmThread=vmThread@entry=0x1f100, 
    compiler=0x400019327000, compilee=compilee@entry=0x400003f30460, vm=..., optimizationPlan=0x400003db0c70, scratchSegmentProvider=...)
    at /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/openj9/runtime/compiler/control/CompilationThread.cpp:9988
---Type <return> to continue, or q <return> to quit---q
Quit
0xdaryl commented 1 year ago

@knn-k : FYI

knn-k commented 1 year ago

The code in genSuperClassTest() was implemented in PR #15683.

knn-k commented 1 year ago

My local build shows failures with node->getSecondChild() being NULL in genSuperClassTest(). When node->getSecondChild() happens to be non-NULL, it would fail with the assertion node->getSecondChild()->getOpCodeValue() != TR::loadaddr.

_ZN2TR4trapEv+0x4c (0x0000FFFFAA2F7820 [libj9jit29.so+0x437820])
 (0x0000FFFFAA2F788C [libj9jit29.so+0x43788c])
_ZL17genSuperClassTestPN2TR4NodeEPNS_8RegisterEbS3_iPNS_11LabelSymbolEP30TR_ARM64ScratchRegisterManagerPNS_13CodeGeneratorE+0x51c (0x0000FFFFAA254370 [libj9jit29.so+0x394370])
_ZN2J95ARM6413TreeEvaluator22ArrayStoreCHKEvaluatorEPN2TR4NodeEPNS2_13CodeGeneratorE+0xc74 (0x0000FFFFAA266AA8 [libj9jit29.so+0x3a6aa8])
_ZN3OMR13CodeGenerator8evaluateEPN2TR4NodeE+0x50 (0x0000FFFFAA2827E0 [libj9jit29.so+0x3c27e0])
_ZN2J913CodeGenerator22doInstructionSelectionEv+0x964 (0x0000FFFFA9F9B9A4 [libj9jit29.so+0xdb9a4])
Akira1Saitoh commented 1 year ago

I checked the jitdump in the artifact of failed jenkins build. ArrayStoreCHK has only 1 child. I guess it is wrong to assume that node has 2 children.

  32003 ------------------------------
  32004  n130n    (  0)  ArrayStoreCHK [#43] ()                                                               [    0x40004ec8186  32004 0] bci=[-1,83,-] rc=0 vc=1482 vn=- li=8 udi=- nc=1 flg=0x20
  32005  n129n    (  2)    awrtbari  <array-shadow>[#210  Shadow] [flags 0x80000607 0x0 ] ()                  [    0x40004ec8181  32005 0] bci=[-1,83,-] rc=2 vc=1482 vn=- li=8 udi=- nc=3 flg=0x20
  32006  n128n    (  1)      aladd (X>=0 internalPtr )                                                        [    0x40004ec817c  32006 0] bci=[-1,83,-] rc=1 vc=1482 vn=- li=8 udi=- nc=2 flg=0x8100
  32007  n115n    (  2)        ==>l2a (in &GPR_    0x40004eefb5f0) (X!=0 )
  32008  n127n    (  1)        lsub (X>=0 cannotOverflow )                                                    [    0x40004ec8177  32008 0] bci=[-1,83,-] rc=1 vc=1482 vn=- li=8 udi=- nc=2 flg=0x1100
  32009  n125n    (  1)          lshl (X>=0 )                                                                 [    0x40004ec816d  32009 0] bci=[-1,83,-] rc=1 vc=1482 vn=- li=8 udi=- nc=2 flg=0x100
  32010  n124n    (  1)            i2l (highWordZero X>=0 )                                                   [    0x40004ec8168  32010 0] bci=[-1,83,-] rc=1 vc=1482 vn=- li=8 udi=- nc=1 flg=0x4100
  32011  n585n    (  1)              ==>iRegLoad (in GPR_    0x40004eef7e40) (X>=0 cannotOverflow SeenRealReference )
  32012  n123n    (  1)            iconst 2 (Unsigned X!=0 X>=0 )                                             [    0x40004ec8163  32012 0] bci=[-1,83,-] rc=1 vc=1482 vn=- li=8 udi=- nc=0 flg=0x4104
  32013  n126n    (  1)          lconst -8 (X!=0 X<=0 )                                                       [    0x40004ec8172  32013 0] bci=[-1,83,-] rc=1 vc=1482 vn=- li=8 udi=- nc=0 flg=0x204
  32014  n741n    (  1)      l2i                                                                              [    0x40004ec8d75  32014 0] bci=[-1,58,-] rc=1 vc=1482 vn=- li=- udi=- nc=1
  32015  n740n    (  1)        a2l                                                                            [    0x40004ec8d70  32015 0] bci=[-1,58,-] rc=1 vc=1482 vn=- li=- udi=- nc=1
  32016  n88n     (  1)          ==>l2a (in &GPR_    0x40004eef9030)
  32017  n115n    (  2)      ==>l2a (in &GPR_    0x40004eefb5f0) (X!=0 )
  32018 ------------------------------
Akira1Saitoh commented 1 year ago

The intention of the assert is to verify that the opcode of the class node is not loadaddr if the cast class is unknown at compile time. The class node is the second child of the node passed as the first argument when genSuperClassTest is called from instanceof or checkcast evaluator, but that is not true if called from VMarrayStoreCHKEvaluator.

I opened https://github.com/eclipse-openj9/openj9/pull/17589 to fix this inconsistency.