[lworld] RFR: 8336003: [lworld] TestLWorld::test151 triggers "Should have been buffered" assert
Tobias Hartmann
thartmann at openjdk.org
Mon Jun 16 14:49:42 UTC 2025
On Fri, 13 Jun 2025 22:53:32 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
> Hi,
>
> The issue here is that the IGVN cannot deduce that the `IsBuffered` input is a constant 1. This is because after the `InlineTypeNode` is pushed down through a `Phi` cluster, the `IsBuffered` input is a `Phi` cluster with loop phis, which makes it difficult for the IGVN to see through. A solution is to do another round of CCP after loop opts, but it is rather a big hammer. In this PR, I propose to make it possible for a `PhiNode` to look through its `Phi` inputs to discover the unique non-phi input of a `Phi` cluster. The test still fails but it seems more like an expected behaviour rather than an issue this time, I have modified the test a little bit for it to pass.
>
> Please take a look and share your thoughts, thanks very much.
Thanks for working on this Quan-Anh!
`compiler/c2/TestDeadLoopSplitIfLoop.java` now fails with `-XX:-EnableValhalla`:
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/open/src/hotspot/share/opto/phaseX.cpp:784), pid=1729076, tid=1729093
# assert(no_dead_loop) failed: dead loop detected
#
# JRE version: Java(TM) SE Runtime Environment (25.0) (fastdebug build 25-lworld5ea-LTS-2025-06-16-1157190.tobias.hartmann.valhalla2)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-lworld5ea-LTS-2025-06-16-1157190.tobias.hartmann.valhalla2, compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x184ec45] PhaseGVN::dead_loop_check(Node*) [clone .part.0]+0x1d5
Current CompileTask:
C2:309 14 b compiler.c2.TestDeadLoopSplitIfLoop::test (88 bytes)
Stack: [0x00007f1323dff000,0x00007f1323eff000], sp=0x00007f1323efa0e0, free space=1004k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x184ec45] PhaseGVN::dead_loop_check(Node*) [clone .part.0]+0x1d5 (phaseX.cpp:784)
V [libjvm.so+0x185fe39] PhaseIterGVN::transform_old(Node*)+0x529 (phaseX.cpp:767)
V [libjvm.so+0x1854c54] PhaseIterGVN::optimize()+0xb4 (phaseX.cpp:1054)
V [libjvm.so+0xb54796] Compile::Optimize()+0x326 (compile.cpp:2779)
V [libjvm.so+0xb583bf] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1fef (compile.cpp:874)
V [libjvm.so+0x96de34] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x484 (c2compiler.cpp:142)
V [libjvm.so+0xb66078] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xb58 (compileBroker.cpp:2307)
V [libjvm.so+0xb67238] CompileBroker::compiler_thread_loop()+0x568 (compileBroker.cpp:1951)
V [libjvm.so+0x10e17fb] JavaThread::thread_main_inner()+0x13b (javaThread.cpp:774)
V [libjvm.so+0x1b5b146] Thread::call_run()+0xb6 (thread.cpp:231)
V [libjvm.so+0x17c6e38] thread_native_entry(Thread*)+0x128 (os_linux.cpp:875)
src/hotspot/share/opto/cfgnode.cpp line 1604:
> 1602: Node* phi_in = current->in(i);
> 1603: if (phi_in->is_Phi()) {
> 1604: visited.append_if_missing(phi_in->as_Phi());
Would a `Unique_Node_List` be more appropriate here?
-------------
PR Review: https://git.openjdk.org/valhalla/pull/1489#pullrequestreview-2932445271
PR Review Comment: https://git.openjdk.org/valhalla/pull/1489#discussion_r2150199110
More information about the valhalla-dev
mailing list