JDK-8277324 : C2 compilation fails with "bad AD file" on x86-32 after JDK-8276162 due to missing match rule
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 18
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • CPU: x86
  • Submitted: 2021-11-17
  • Updated: 2021-12-13
  • Resolved: 2021-11-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 18
18 b25Fixed
Related Reports
Relates :  
Relates :  
Description
Reproduces on 32-bit x86 with newly added compiler/c2/irTests/TestUnsignedComparison.java:

 628       3       compiler.c2.irTests.TestUnsignedComparison::testLongVarNE (20 bytes)   made not entrant
    770  641    b  4       compiler.c2.irTests.TestUnsignedComparison::testLongVarLT (20 bytes)
 13  Parm  ===  3  [[ 34 ]] Parm3: long !jvms: TestUnsignedComparison::testLongVarLT @ bci:-1 (line 234)
 11  Parm  ===  3  [[ 34 ]] Parm1: long !jvms: TestUnsignedComparison::testLongVarLT @ bci:-1 (line 234)
 34  CmpUL  === _  11  13  [[ 47 ]]  !jvms: TestUnsignedComparison::testLongVarLT @ bci:11 (line 234)
 30  ConI  ===  0  [[ 48 ]]  #int:0
 41  ConI  ===  0  [[ 48 ]]  #int:1
 47  Bool  === _  34  [[ 48 ]] [ge]
 3  Start  ===  3  0  [[ 3  5  6  7  8  9  13  11 ]]  #{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address, 5:compiler/c2/irTests/TestUnsignedComparison:NotNull *, 6:long, 7:half, 8:long, 9:half}
 48  CMoveI  === _  47  41  30  [[ 45 ]]  #bool !orig=[46],[43] !jvms: TestUnsignedComparison::testLongVarLT @ bci:19 (line 234)
 9  Parm  ===  3  [[ 45 ]] ReturnAdr !jvms: TestUnsignedComparison::testLongVarLT @ bci:-1 (line 234)
 8  Parm  ===  3  [[ 45 ]] FramePtr !jvms: TestUnsignedComparison::testLongVarLT @ bci:-1 (line 234)
 7  Parm  ===  3  [[ 45 ]] Memory  Memory: @BotPTR *+bot, idx=Bot; !jvms: TestUnsignedComparison::testLongVarLT @ bci:-1 (line 234)
 6  Parm  ===  3  [[ 45 ]] I_O !jvms: TestUnsignedComparison::testLongVarLT @ bci:-1 (line 234)
 5  Parm  ===  3  [[ 45 ]] Control !jvms: TestUnsignedComparison::testLongVarLT @ bci:-1 (line 234)
 45  Return  ===  5  6  7  8  9 returns 48  [[ 0 ]] 
 0  Root  ===  0  45  [[ 0  1  3  41  30 ]] inner 
o48  CMoveI  === _ o49 o50  [[o45  2 ]]  #bool

--N: o48  CMoveI  === _ o49 o50  [[o45  2 ]]  #bool

   --N: o49  Binary  === _ o47 o34  [[o48 ]] 
   _Binary_cmpOpU_commute_flagsReg_ulong_LEGT  300  _Binary_cmpOpU_commute_flagsReg_ulong_LEGT

      --N: o47  Bool  === _ o34  [[o49 ]] [ge]
      CMPOP  0  CMPOP
      CMPOPU  0  CMPOPU
      CMPOPUCF  0  CMPOPUCF
      CMPOP_FCMOV  0  CMPOP_FCMOV
      CMPOP_COMMUTE  0  CMPOP_COMMUTE
      CMPOPU_COMMUTE  0  CMPOPU_COMMUTE
      CMPOP_VCMPPD  0  CMPOP_VCMPPD

      --N: o34  CmpUL  === _ o11 o13  [[o47 o49 ]] 
      FLAGSREG_ULONG_LTGE  300  cmpUL_reg_flags_LTGE
      FLAGSREG_ULONG_EQNE  500  cmpUL_reg_flags_EQNE
      FLAGSREG_ULONG_LEGT  300  cmpUL_reg_flags_LEGT

         --N: o11  Parm  === o3  [[o34 ]] Parm1: long
         EREGL  0  EREGL
         EADXREGL  0  EADXREGL
         EBCXREGL  0  EBCXREGL
         EADXREGL_LOW_ONLY  0  EADXREGL_LOW_ONLY
         STACKSLOTL  200  storeSSL

         --N: o13  Parm  === o3  [[o34 ]] Parm3: long
         EREGL  0  EREGL
         EADXREGL  0  EADXREGL
         EBCXREGL  0  EBCXREGL
         EADXREGL_LOW_ONLY  0  EADXREGL_LOW_ONLY
         STACKSLOTL  200  storeSSL

   --N: o50  Binary  === _ o41 o30  [[o48 ]] 
   _Binary_rRegI_rRegI  150  _Binary_rRegI_rRegI
   _Binary_eAXRegI_rRegI  150  _Binary_eAXRegI_rRegI
   _Binary_eAXRegI_eCXRegI  150  _Binary_eAXRegI_eCXRegI
   _Binary_nadxRegI_eAXRegI  150  _Binary_nadxRegI_eAXRegI

      --N: o41  ConI  === o0  [[o50 ]]  #int:1
      IMMI  10  IMMI
      IMMI_1  0  IMMI_1
      IMMI2  0  IMMI2
      IMMI8  5  IMMI8
      IMMU8  5  IMMU8
      IMMI16  10  IMMI16
      IMMU31  0  IMMU31
      IMMI_1_31  0  IMMI_1_31
      RREGI  100  loadConI
      XREGI  100  loadConI
      EAXREGI  100  loadConI
      EBXREGI  100  loadConI
      ECXREGI  100  loadConI
      EDXREGI  100  loadConI
      EDIREGI  100  loadConI
      NAXREGI  100  loadConI
      NADXREGI  100  loadConI
      NCXREGI  100  loadConI
      ESIREGI  100  loadConI
      STACKSLOTI  200  storeSSI

      --N: o30  ConI  === o0  [[o50 ]]  #int:0
      IMMI  10  IMMI
      IMMI_0  0  IMMI_0
      IMMI2  0  IMMI2
      IMMI8  5  IMMI8
      IMMU8  5  IMMU8
      IMMI16  10  IMMI16
      IMMU31  0  IMMU31
      RREGI  50  loadConI0
      XREGI  50  loadConI0
      EAXREGI  50  loadConI0
      EBXREGI  50  loadConI0
      ECXREGI  50  loadConI0
      EDXREGI  50  loadConI0
      EDIREGI  50  loadConI0
      NAXREGI  50  loadConI0
      NADXREGI  50  loadConI0
      NCXREGI  50  loadConI0
      ESIREGI  50  loadConI0
      STACKSLOTI  150  storeSSI

# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/matcher.cpp:1714
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/buildbot/worker/build-jdkX-linux/build/src/hotspot/share/opto/matcher.cpp:1714), pid=446199, tid=446214
#  assert(false) failed: bad AD file
#
# JRE version: OpenJDK Runtime Environment (18.0) (fastdebug build 18-testing+0-builds.shipilev.net-openjdk-jdk-b74-20211116)
# Java VM: OpenJDK Server VM (fastdebug 18-testing+0-builds.shipilev.net-openjdk-jdk-b74-20211116, mixed mode, sharing, tiered, g1 gc, linux-x86)
# Problematic frame:
# V  [libjvm.so+0x1164aa5]  Matcher::Label_Root(Node const*, State*, Node*, Node*&)+0x565
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
Unsupported internal testing APIs have been used.

# An error report file with more information is saved as:
# /oracle/jdk/JTwork/scratch/hs_err_pid446199.log
#
# Compiler replay data is saved as:
# /oracle/jdk/JTwork/scratch/replay_pid446199.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#
Comments
Changeset: 3a76d397 Author: Tobias Hartmann <thartmann@openjdk.org> Date: 2021-11-19 08:23:45 +0000 URL: https://git.openjdk.java.net/jdk/commit/3a76d397949ad22e4786476e583cc9d33c015214
19-11-2021

The problem is that 32-bit x86 does not have a match rule for CMoveI comparing 2 longs.
17-11-2021

JDK-8276162 introduced new IR shapes and it looks like 32-bit x86 is missing a corresponding matching rule in the backend. ILW = Crash during C2 compilation (regression from JDK-8276162), reproducible with test on 32-bit x86, no workaround but disable compilation of affected method = HMM = P2
17-11-2021