RFR: 8373820: C2: Robust Node::uncast_helper infinite loop check
Quan Anh Mai
qamai at openjdk.org
Wed Dec 17 08:44:07 UTC 2025
On Wed, 17 Dec 2025 06:56:32 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> Current check in `Node::uncast_helper` checks for "infinite loop", but really checks for the depth of 1K nodes when searching through the graph:
>
>
> assert(depth_count++ < K, "infinite loop in Node::uncast_helper");
>
>
> I suppose it is plausible to have a legit chain of 1K nodes with very deep inlining and/or optimization, which is _not_ an infinite loop. This might be the cause for some CTW failures in deeper stress modes: I have been running CTW stress tests for 12+ hours without ever hitting this check, and I usually hit it within that timeframe in current mainline.
>
> Given how we basically walk through `in(1)`, i.e. moving as if through the linked list of nodes, I think we can check against the number of nodes we have. If we walk more nodes than we have, that would mean we visited some node twice, which necessarily means there is a infinite loop in this walk. This makes the check more robust.
>
> Additional testing:
> - [x] Linux x86_64 server fastdebug, `applications/ctw/modules` in different stress modes, 10x passes
> - [ ] Linux x86_64 server fastdebug, `hotspot_compiler`
> - [ ] Linux x86_64 server fastdebug, `tier1`
Marked as reviewed by qamai (Committer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/28861#pullrequestreview-3586603093
More information about the hotspot-compiler-dev
mailing list