JDK-8316719 : C2 compilation still fails with "bad AD file"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 21,22
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-09-22
  • Updated: 2024-01-09
  • Resolved: 2023-11-08
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 21 JDK 22
21.0.2Fixed 22 b24Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
Even with the fix for JDK-8314191, we still see the same failure:

java -Xcomp -XX:CompileCommand=compileonly,Test::* -XX:-TieredCompilation -XX:-UseLoopPredicate Test.java

o181  CountedLoopEnd  === o180 o202 o201  [[ o182 o183 27 ]] [gt] P=0,900000, C=-1,000000

--N: o181  CountedLoopEnd  === o180 o202 o201  [[ o182 o183 27 ]] [gt] P=0,900000, C=-1,000000

   --N: o202  Bool  === _ o201  [[ o181 ]] [gt]
   CMPOP  0  CMPOP
   CMPOPU  0  CMPOPU
   CMPOPUCF  0  CMPOPUCF

   --N: o201  CmpU  === _ o10 o11  [[ o202 o181 ]] 
   RFLAGSREGU  100  compU_rReg

      --N: o10  Parm  === o3  [[ o164 o46 o282 o201 o194 o85 o171 o173 ]] Parm0: int
      RREGI  0  RREGI
      RAX_REGI  0  RAX_REGI
      RBX_REGI  0  RBX_REGI
      RCX_REGI  0  RCX_REGI
      RDX_REGI  0  RDX_REGI
      RDI_REGI  0  RDI_REGI
      NO_RAX_RDX_REGI  0  NO_RAX_RDX_REGI
      NO_RBP_R13_REGI  0  NO_RBP_R13_REGI
      STACKSLOTI  100  storeSSI

      --N: o11  Parm  === o3  [[ o145 o121 o102 o201 o46 o356 11 ]] Parm1: int
      RREGI  0  RREGI
      RAX_REGI  0  RAX_REGI
      RBX_REGI  0  RBX_REGI
      RCX_REGI  0  RCX_REGI
      RDX_REGI  0  RDX_REGI
      RDI_REGI  0  RDI_REGI
      NO_RAX_RDX_REGI  0  NO_RAX_RDX_REGI
      NO_RBP_R13_REGI  0  NO_RBP_R13_REGI
      STACKSLOTI  100  storeSSI

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S182890/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/ee8091e4-76ff-4dc6-9579-9aa04624063d/runs/9396d582-a195-4809-ad29-8d156225a827/workspace/open/src/hotspot/share/opto/matcher.cpp:1724), pid=1214791, tid=1214805
#  assert(false) failed: bad AD file
#
# JRE version: Java(TM) SE Runtime Environment (22.0+17) (fastdebug build 22-ea+17-1281)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-ea+17-1281, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x135a378]  Matcher::Label_Root(Node const*, State*, Node*, Node*&)+0x508

Comments
[jdk21u-fix-request] Approval Request from Aleksey Shipilëv Clean backport to amend previous C2 regression fix. Applies cleanly. Testing passes.
14-11-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u/pull/342 Date: 2023-11-09 08:41:30 +0000
09-11-2023

Changeset: 1e687b45 Author: Quan Anh Mai <qamai@openjdk.org> Date: 2023-11-08 10:47:00 +0000 URL: https://git.openjdk.org/jdk/commit/1e687b4529ae695d991623dc13796faecd6be7da
08-11-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/16509 Date: 2023-11-05 18:25:53 +0000
05-11-2023

[~qamai], any update on this?
01-11-2023

Reproduces after JDK-8302814.
22-09-2023

It seems that the added is_cloop_increment() in JDK-8314191 does not work when peeling a loop for which a CountedLoopEndNode will serve as a zero trip guard. For the peeled iteration, the CountedLoopNode will have top for the backedge (see graph.png). Therefore, incr() will return null here: https://github.com/openjdk/jdk/blob/fe862639e7ce40f5adef0e482b1fb9c718e061a3/src/hotspot/share/opto/subnode.cpp#L138 and we continue to replace the CmpI of the CountedLoopEndNode with CmpU and hit the assert.
22-09-2023

[~qamai], could you please have a look? Thanks.
22-09-2023

ILW = Same as JDK-8314191 = P3
22-09-2023