Integrated: 8373820: C2: Robust Node::uncast_helper infinite loop check
Aleksey Shipilev
shade at openjdk.org
Thu Dec 18 09:46:52 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 the new check, and I usually hit the old one 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
> - [x] Linux x86_64 server fastdebug, `hotspot_compiler`
> - [x] Linux x86_64 server fastdebug, `tier1`
This pull request has now been integrated.
Changeset: 4f283f18
Author: Aleksey Shipilev <shade at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/4f283f188c43cb25c4eafcdf22eb7f58eae286cc
Stats: 8 lines in 1 file changed: 5 ins; 1 del; 2 mod
8373820: C2: Robust Node::uncast_helper infinite loop check
Reviewed-by: qamai, chagedorn
-------------
PR: https://git.openjdk.org/jdk/pull/28861
More information about the hotspot-compiler-dev
mailing list