JDK-8272448 : [lworld] C2 compilation fails with "Bad graph detected in build_loop_late"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: repo-valhalla
  • Priority: P3
  • Status: In Progress
  • Resolution: Unresolved
  • Submitted: 2021-08-13
  • Updated: 2021-08-17
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.
Other
repo-valhallaUnresolved
Related Reports
Relates :  
Sub Tasks
JDK-8272511 :  
Description
With the patch for JDK-8271959, some of the java/foreign/ tests fail with:

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/oracle/valhalla3/open/src/hotspot/share/opto/loopnode.cpp:5343), pid=651209, tid=651245
#  assert(false) failed: Bad graph detected in build_loop_late
#
# JRE version: Java(TM) SE Runtime Environment (18.0) (fastdebug build 18-lworld3ea+0-2021-07-08-0750194.tobias...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 18-lworld3ea+0-2021-07-08-0750194.tobias..., mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x138f93b]  PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x18b
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P %E" (or dumping to /oracle/valhalla3/JTwork/scratch/core.651209)
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

Current CompileTask:
C2:   8110 4560       4       java.lang.invoke.LambdaFormEditor::bindArgumentForm (269 bytes)

Stack: [0x00007f0dc1eff000,0x00007f0dc2000000],  sp=0x00007f0dc1ffa1f0,  free space=1004k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x138f93b]  PhaseIdealLoop::build_loop_late_post_work(Node*, bool)+0x18b
V  [libjvm.so+0x138ff5a]  PhaseIdealLoop::build_loop_late(VectorSet&, Node_List&, Node_Stack&)+0xba
V  [libjvm.so+0x13908c7]  PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0x507
V  [libjvm.so+0xa5a257]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x287
V  [libjvm.so+0xa56be4]  Compile::Optimize()+0x1434
V  [libjvm.so+0xa58830]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, bool, DirectiveSet*)+0x1630
V  [libjvm.so+0x841d80]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x6a0
V  [libjvm.so+0xa686d1]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xb71
V  [libjvm.so+0xa69368]  CompileBroker::compiler_thread_loop()+0x598
V  [libjvm.so+0x196991c]  JavaThread::thread_main_inner()+0x27c
V  [libjvm.so+0x196ff60]  Thread::call_run()+0x100
V  [libjvm.so+0x16205b4]  thread_native_entry(Thread*)+0x104

Comments
Potentially related: JDK-8271954, JDK-8272562
17-08-2021

It seems to be another regression of JDK-8252372 in mainline. I've disabled that optimization with JDK-8272511 until it's stable in mainline. We should then re-investigate if this issue still reproduces.
16-08-2021

To reproduce, apply JDK-8271959 and run make test TEST="test/jdk/java/foreign/TestUpcall.java"
16-08-2021