JDK-8344251 : C2: remove blackholes with dead control input
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,21,24,25
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-11-14
  • Updated: 2025-05-01
  • Resolved: 2025-04-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.
JDK 25
25 b20Fixed
Related Reports
Causes :  
Description
Running org.openjdk.bench.vm.lambda.chain.ChainLambdaCap0.call1 benchmark fails with the following assertion:

To reproduce as described in the comments below:
> make build-microbenchmark
> java -jar ./build/linux-x64-debug/images/test/micro/benchmarks.jar org.openjdk.bench.vm.lambda.chain.ChainMrefUnbound.call1


#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/3fe4557b-066a-4392-9b05-ef874140c35c-S211/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/75684d7c-96c5-4008-8725-69adc3eb5ec8/runs/598ad8c3-46d4-4344-972d-60f171ec3176/workspace/open/src/hotspot/share/opto/loopnode.cpp:5871), pid=25661, tid=25677
#  assert(!in->is_CFG()) failed: CFG Node with no controlling input?
#
# JRE version: OpenJDK Runtime Environment (24.0+1) (fastdebug build 24-jep483+1-15)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 24-jep483+1-15, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x1312972]  PhaseIdealLoop::build_loop_early(VectorSet&, Node_List&, Node_Stack&)+0x7b2

Command Line: -XX:AOTMode=record -XX:AOTConfiguration=test%pid.aotconfig -XX:+AOTClassLinking -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -DcompilerBlackholesEnabled=true -XX:CompileCommandFile=/tmp/jmh303354834779757008compilecommand org.openjdk.jmh.runner.ForkedMain 127.0.0.1 38603

Host:xxxxxx, Intel(R) Xeon(R) CPU E5-2630 0 @ 2.30GHz, 24 cores, 15G, Ubuntu 16.04.6 LTS
Time: Thu Nov 14 12:36:02 2024 PST elapsed time: 1.958854 seconds (0d 0h 0m 1s)

---------------  T H R E A D  ---------------

Current thread (0x00007fa6a8341340):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=25677, stack(0x00007fa67ad18000,0x00007fa67ae19000) (1028K)]


Current CompileTask:
C2:1958  816 %     4       org.openjdk.bench.vm.lambda.chain.ChainBase::process @ 2 (25 bytes)

Stack: [0x00007fa67ad18000,0x00007fa67ae19000],  sp=0x00007fa67ae13ee0,  free space=1007k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x1312972]  PhaseIdealLoop::build_loop_early(VectorSet&, Node_List&, Node_Stack&)+0x7b2  (loopnode.cpp:5871)
V  [libjvm.so+0x131f9c9]  PhaseIdealLoop::build_and_optimize()+0x5e9
V  [libjvm.so+0xa52cf5]  PhaseIdealLoop::verify(PhaseIterGVN&)+0x3c5
V  [libjvm.so+0xa4d9f3]  Compile::Optimize()+0x743
V  [libjvm.so+0xa51d0f]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b6f
V  [libjvm.so+0x89ca75]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1d5
V  [libjvm.so+0xa5dd98]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x928
V  [libjvm.so+0xa5ead8]  CompileBroker::compiler_thread_loop()+0x528
V  [libjvm.so+0xf15cbc]  JavaThread::thread_main_inner()+0xcc
V  [libjvm.so+0x18512c6]  Thread::call_run()+0xb6
V  [libjvm.so+0x1531288]  thread_native_entry(Thread*)+0x128


Comments
Changeset: 1138a186 Branch: master Author: Marc Chevalier <mchevalier@openjdk.org> Committer: Tobias Hartmann <thartmann@openjdk.org> Date: 2025-04-17 07:24:14 +0000 URL: https://git.openjdk.org/jdk/commit/1138a186eb670e2c0662bda69c35680b41f4d66c
17-04-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/24663 Date: 2025-04-15 13:39:52 +0000
15-04-2025

I've added a visualization of the problem: BlackholeNodes are not removed when their control is dead.
15-04-2025

ILW = Assertion failure in loop opts, single benchmark, disable compilation of affected method = HLM = P3
23-01-2025

The benchmark crashes without AOT/CDS in jdk25. Steps to reproduce: > bash jib.sh make -- build-microbenchmark > $TESTED_JAVA/bin/java -jar ./build/linux-x64/images/test/micro/benchmarks.jar org.openjdk.bench.vm.lambda.chain.ChainMrefUnbound.call1 The crash is observed starting from jdk25b01. Transferring the issue to compiler team because the issue is reproduced without AOT/CDS
21-01-2025

The issue is still present.
16-01-2025

The issue is reproduced without AOTClassLinking. It is also reproduced the same way using old CDS and latest promoted jdk24 build: > jdk/24/b24/fastdebug/bin/java -Xshare:off -XX:DumpLoadedClassList=test%pid.aotconfig -jar WS/build/linux-x64/images/test/micro/benchmarks.jar -i 1 -wi 1 -f 1 org.openjdk.bench.vm.lambda.chain.ChainMrefBound.call1
14-11-2024

The list of benchmarks which crash: org.openjdk.bench.vm.lambda.chain.ChainLambdaCap0.call1 org.openjdk.bench.vm.lambda.chain.ChainMrefBound.call1 org.openjdk.bench.vm.lambda.chain.ChainMrefUnbound.call1
14-11-2024

The issue could be related to https://bugs.openjdk.org/browse/JDK-8308675
14-11-2024

Steps to reproduce: > bash jib.sh make -- build-microbenchmark > $TESTED_JAVA/bin/java -XX:AOTMode=record -XX:AOTConfiguration=test%pid.aotconfig -XX:+AOTClassLinking -jar $WS/build/linux-x64/images/test/micro/benchmarks.jar -i 1 -wi 1 -f 1 org.openjdk.bench.vm.lambda.chain.ChainLambdaCap0.call1
14-11-2024