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 omr/compiler/il/OMRNode.cpp:7006: (self()->getOpCodeValue() == TR::aconst)||(self()->getOpCodeValue() == TR::aloadi) #17582

Closed dylanjtuttle closed 1 year ago

dylanjtuttle commented 1 year ago

The assertion at

/home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/omr/compiler/il/OMRNode.cpp:7006: (self()->getOpCodeValue() == TR::aconst)||(self()->getOpCodeValue() == TR::aloadi)

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.

Stack trace:

15:54:51  Creating jdk image
15:55:01  Assertion failed at /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/omr/compiler/il/OMRNode.cpp:7006: (self()->getOpCodeValue() == TR::aconst)||(self()->getOpCodeValue() == TR::aloadi)
15:55:01  VMState: 0x0005ff04
15:55:01    Can only call this for aconst or iaload
15:55:01  
15:55:01  compiling java/util/stream/SortedOps$SizedRefSortingSink.end()V at level: cold
15:55:01  #0: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x7c4c24) [0x40000eb1ec24]
15:55:01  #1: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x7d2b10) [0x40000eb2cb10]
15:55:01  #2: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x497dbc) [0x40000e7f1dbc]
15:55:01  #3: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x498118) [0x40000e7f2118]
15:55:01  #4: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x48e8c8) [0x40000e7e88c8]
15:55:01  #5: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x83e87c) [0x40000eb9887c]
15:55:01  #6: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x3cc298) [0x40000e726298]
15:55:01  #7: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x3cf2b8) [0x40000e7292b8]
15:55:01  #8: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x3cc948) [0x40000e726948]
15:55:01  #9: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x410fe8) [0x40000e76afe8]
15:55:01  #10: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x3e8a78) [0x40000e742a78]
15:55:01  #11: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x410fe8) [0x40000e76afe8]
15:55:01  #12: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0xe1494) [0x40000e43b494]
15:55:01  #13: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x41e8f8) [0x40000e7788f8]
15:55:01  #14: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x41f6a8) [0x40000e7796a8]
15:55:01  #15: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x41c19c) [0x40000e77619c]
15:55:01  #16: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x448b94) [0x40000e7a2b94]
15:55:01  #17: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x117464) [0x40000e471464]
15:55:01  #18: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x1181a4) [0x40000e4721a4]
15:55:01  #19: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9prt29.so(+0x2b3a0) [0x40000e05e3a0]
15:55:01  
15:55:01  JIT: crashed while compiling java/util/stream/SortedOps$SizedRefSortingSink.end()V (recoverable 0)
15:55:01  #0: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x7c4c24) [0x40000eb1ec24]
15:55:01  #1: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x7d2b10) [0x40000eb2cb10]
15:55:01  #2: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9jit29.so(+0x107724) [0x40000e461724]
15:55:01  #3: /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/build/linux-aarch64-normal-server-release/jdk/lib/default/libj9prt29.so(+0x2a6d0) [0x40000e05d6d0]
15:55:01  Unhandled exception
15:55:01  Type=Unhandled trap vmState=0x0005ff04
15:55:01  J9Generic_Signal_Number=00000108 Signal_Number=00000005 Error_Value=00000000 Signal_Code=fffffffa
15:55:01  Handler1=000040000DE90D58 Handler2=000040000E05D558
15:55:01  R0=0000000000000000 R1=0000000000002C1D R2=0000000000000005 R3=0000000000002C03
15:55:01  R4=0000000000002C03 R5=0000000000000000 R6=00000000FFFFFFBB R7=0000000000000000
15:55:01  R8=0000000000000083 R9=0000000000000000 R10=000040002801538C R11=000000000000009D
15:55:01  R12=000040000D944000 R13=0000000000000000 R14=0400000000000000 R15=0000000000000B93
15:55:01  R16=000040000EE4A1F0 R17=000040000D98781C R18=000040000FDF0650 R19=000040000FDF88F0
15:55:01  R20=000040000EE7E618 R21=000040005ACFEFE0 R22=0000000000000000 R23=000040005AC05E60
15:55:01  R24=000040005AD009E0 R25=000040005AD00A50 R26=00000000001AAA00 R27=000040005AD004D0
15:55:01  R28=000040005AD00220 R29=000040000FDF5F70 R30=000040000E7F1F20 R31=000040000FDF0C80
15:55:01  PC=000040000D987850 SP=000040000FDF0C80 PSTATE=0000000060000000
15:55:01  V0 000040000fdf0850 (f: 266274896.000000, d: 3.476691e-310)
15:55:01  V1 000000003f666666 (f: 1063675520.000000, d: 5.255255e-315)
15:55:01  V2 000000003d99999a (f: 1033476480.000000, d: 5.106052e-315)
15:55:01  V3 0000000200000001 (f: 1.000000, d: 4.243992e-314)
15:55:01  V4 0000004000000040 (f: 64.000000, d: 1.358077e-312)
15:55:01  V5 0000000400000004 (f: 4.000000, d: 8.487983e-314)
15:55:01  V6 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V7 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V8 000000003d9374bc (f: 1033073856.000000, d: 5.104063e-315)
15:55:01  V9 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V10 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V11 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V12 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V13 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V14 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V15 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V16 ffffffffffffffff (f: 4294967296.000000, d: -nan)
15:55:01  V17 0f0f0f0f0f0f0f0f (f: 252645136.000000, d: 3.815737e-236)
15:55:01  V18 5555555555555555 (f: 1431655808.000000, d: 1.194531e+103)
15:55:01  V19 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V20 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V21 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V22 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V23 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V24 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V25 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V26 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V27 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V28 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V29 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V30 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  V31 0000000000000000 (f: 0.000000, d: 0.000000e+00)
15:55:01  Module=/lib64/libpthread.so.0
15:55:01  Module_base_address=000040000D977000 Symbol=raise
15:55:01  Symbol_address=000040000D98781C
15:55:01  
15:55:01  Method_being_compiled=java/util/stream/SortedOps$SizedRefSortingSink.end()V
15:55:01  Target=2_90_20230612_465 (Linux 5.10.109-200.el7.aarch64)
15:55:01  CPU=aarch64 (8 logical CPUs) (0x1cf944000 RAM)
15:55:01  ----------- Stack Backtrace -----------
15:55:01  protectedBacktrace+0x18 (0x000040000E059CC0 [libj9prt29.so+0x26cc0])
15:55:01  ---------------------------------------
15:55:01  JVMDUMP039I Processing dump event "gpf", detail "" at 2023/06/12 15:55:00 - please wait.
15:55:01  JVMDUMP032I JVM requested System dump using '/home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/core.20230612.155500.11267.0001.dmp' in response to an event
15:55:01  JVMDUMP010I System dump written to /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/core.20230612.155500.11267.0001.dmp
15:55:01  JVMDUMP032I JVM requested Java dump using '/home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/javacore.20230612.155500.11267.0002.txt' in response to an event
15:55:01  JVMDUMP010I Java dump written to /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/javacore.20230612.155500.11267.0002.txt
15:55:01  JVMDUMP032I JVM requested Snap dump using '/home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/Snap.20230612.155500.11267.0003.trc' in response to an event
15:55:01  JVMDUMP010I Snap dump written to /home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/Snap.20230612.155500.11267.0003.trc
15:55:01  JVMDUMP032I JVM requested JIT dump using '/home/jenkins/workspace/Build_JDK11_aarch64_linux_Personal/make/jitdump.20230612.155500.11267.0004.dmp' in response to an event
15:55:01  JVMDUMP051I JIT dump occurred in 'JIT Compilation Thread-000' thread 0x000000000001B700
15:55:01  JVMDUMP049I JIT dump notified all waiting threads of the current method to be compiled
15:55:01  JVMDUMP054I JIT dump is tracing the IL of the method on the crashed compilation thread
15:55:01  JVMDUMP052I JIT dump recursive crash occurred on diagnostic thread
15:55:01  JVMDUMP048I JIT dump method being compiled is an ordinary method
15:55:01  JVMDUMP053I JIT dump is recompiling java/util/stream/SortedOps$SizedRefSortingSink.end()V
0xdaryl commented 1 year ago

@knn-k : FYI

knn-k commented 1 year ago

I changed the TR_ASSERT() in isMethodPointerConstant() to TR_ASSERT_FATAL() locally, and reproduced the failure in building Java 11.

Method_being_compiled=java/util/stream/Collectors.lambda$partitioningBy$62(Ljava/util/function/BiConsumer;Ljava/util/function/Predicate;Ljava/util/stream/Collectors$Partition;Ljava/lang/Object;)V

Method_being_compiled=java/util/Comparator.lambda$comparing$77a9974f$1(Ljava/util/function/Function;Ljava/lang/Object;Ljava/lang/Object;)I

Method_being_compiled=jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.getOrdinal(Ljdk/tools/jlink/plugin/ResourcePoolEntry;)I

Assertion failed at /home/ubuntu/openj9/openj9-openjdk-jdk11/omr/compiler/il/OMRNode.cpp:7006: (self()->getOpCodeValue() == TR::aconst)||(self()->getOpCodeValue() == TR::aloadi)
VMState: 0x0005ff04
        Can only call this for aconst or iaload

All of these assertion failures show the following backtrace with VMcheckcastEvaluator(). isClassUnloadingConst() in the backtrace calls isMethodPointerConstant().

_ZN2TR4trapEv+0x4c (0x0000FFFFB12969A0 [libj9jit29.so+0x4369a0])
 (0x0000FFFFB1296A0C [libj9jit29.so+0x436a0c])
_ZN3OMR4Node21isClassUnloadingConstEv+0x0 (0x0000FFFFB128E810 [libj9jit29.so+0x42e810])
_Z28loadAddressConstantInSnippetPN2TR13CodeGeneratorEPNS_4NodeElPNS_8RegisterE31TR_ExternalRelocationTargetKindbPNS_11InstructionE+0x80 (0x0000FFFFB15ED020 [libj9jit29.so+0x78d020])
_ZL42genInstanceOfOrCheckCastArbitraryClassTestPN2TR4NodeEPNS_8RegisterEP19TR_OpaqueClassBlockP30TR_ARM64ScratchRegisterManagerPNS_13CodeGeneratorE+0xf4 (0x0000FFFFB11F08A4 [libj9jit29.so+0x3908a4])
_ZN2J95ARM6413TreeEvaluator20VMcheckcastEvaluatorEPN2TR4NodeEPNS2_13CodeGeneratorE+0x608 (0x0000FFFFB11FEE1C [libj9jit29.so+0x39ee1c])
_ZN3OMR13CodeGenerator8evaluateEPN2TR4NodeE+0x50 (0x0000FFFFB1220820 [libj9jit29.so+0x3c0820])
_ZN2J913CodeGenerator22doInstructionSelectionEv+0x964 (0x0000FFFFB0F3B864 [libj9jit29.so+0xdb864])
_ZN3OMR12CodeGenPhase32performInstructionSelectionPhaseEPN2TR13CodeGeneratorEPNS1_12CodeGenPhaseE+0x70 (0x0000FFFFB122E4E0 [libj9jit29.so+0x3ce4e0])
knn-k commented 1 year ago

@Akira1Saitoh FYI.

knn-k commented 1 year ago

A checkcast node is passed to isMethodPointerConstant(). The following output is from TR_ASSERT_FATAL_WITH_NODE().

Assertion failed at /home/ubuntu/openj9/openj9-openjdk-jdk11/omr/compiler/il/OMRNode.cpp:7006: (self()->getOpCodeValue() ==
 TR::aconst)||(self()->getOpCodeValue() == TR::aloadi)
VMState: 0x0005ff04
        Node 0xffffb049f690 [checkcast]: Can only call this for aconst or iaload 0xffffb049f690

Node context:
...
n73n      checkcast [#86]                                                                     [    0xffffb049f690] bci=[0,1,-] rc=0 vc=232 vn=- li=21 udi=- nc=2
n71n        aload  t<parm 3 Ljava/lang/Object;>[#352  Parm] [flags 0xc0000107 0x0 ]           [    0xffffb049f5f0] bci=[0,0,-] rc=2 vc=232 vn=- li=21 udi=10816 nc=0
n72n        loadaddr  jdk/tools/jlink/internal/Archive$Entry[#363  Static] [flags 0x18307 0x0 ]  [    0xffffb049f640] bci=[0,1,-] rc=1 vc=232 vn=- li=21 udi=11552 nc=0
...
Akira1Saitoh commented 1 year ago

Can we simply change isMethodPointerConstant() in loadAddressConstantInSnippet() to chkMethodPointerConstant()? https://github.com/eclipse/omr/blob/efe8caf43537270e978f504215342bfba466f0b0/compiler/aarch64/codegen/OMRTreeEvaluator.cpp#L5355

knn-k commented 1 year ago

That solution looks reasonable to me.

knn-k commented 1 year ago

I opened PR https://github.com/eclipse/omr/pull/7033 as the fix.

0xdaryl commented 1 year ago

@knn-k : can you open a 0.40 PR in openj9-omr for this fix please?

knn-k commented 1 year ago

I opened https://github.com/eclipse-openj9/openj9-omr/pull/176 for v0.40.0.

knn-k commented 1 year ago

I think this issue can be closed.

0xdaryl commented 1 year ago

Fixed in 0.40.