RFR: 8375055: C2: Better dead loop detection printout

Christian Hagedorn chagedorn at openjdk.org
Tue Jan 13 09:36:43 UTC 2026


On Tue, 13 Jan 2026 08:37:16 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Chasing the maddeningly intermittent CTW failure. When C2 fails dead loop verification checks, it prints:
> 
> 
> # Internal Error (/home/shipilev/shipilev-jdk/src/hotspot/share/opto/phaseX.cpp:784), pid=64465, tid=917
> # assert(no_dead_loop) failed: dead loop detected
> 
> 
> It also dumps the bad node graph to tty. This is not really convenient in automated testing and/or driver tests like CTW. With this fix, we now print:
> 
> 
> #  Internal Error (/home/shade/trunks/jdk/src/hotspot/share/opto/phaseX.cpp:781), pid=645409, tid=645480
> #  fatal error: Dead loop detected, node references itself
> #
> #  Node:  1606  CastPP  === 1 1606  [[ 3163 1460 1006 1006 1606 1111 ]]  #instptr:java/lang/Object:NotNull+0,iid=bot floating narrowing dependency  Oop:instptr:java/lang/Object:NotNull+0,iid=bot !orig=[1613],[1629],[1015],1442 !jvms: MethodInfo::get @ bci:236 (line 119)
> 
> 
> ...which allows to have more clues where things may go wrong, and allows to classify the failures better as well.
> 
> Additional testing:
>  - [x] Ad-hoc crashes with selected seeds
>  - [x] Linux x86_64 server fastdebug, `hotspot_compiler`
>  - [x] Linux x86_64 server fastdebug, `applications/ctw/modules`

Otherwise, I like this improvement, thanks for cleaning the code up!

src/hotspot/share/opto/phaseX.cpp line 780:

> 778:       ss.print_cr("Dead loop detected, node references itself");
> 779:       ss.print("#\n#  Node: ");
> 780:       n->dump("", false, &ss);

A full node dump for the failure message seems a little verbose. We also already dump the node as part of `dump_bfs()` above. How about just printing `n->_idx` and `n->Name()` for the failure message itself to get a good first hint? Same below.

-------------

PR Review: https://git.openjdk.org/jdk/pull/29185#pullrequestreview-3654810525
PR Review Comment: https://git.openjdk.org/jdk/pull/29185#discussion_r2685610244


More information about the hotspot-compiler-dev mailing list