RFR: 8373820: C2: Robust Node::uncast_helper infinite loop check
Aleksey Shipilev
shade at openjdk.org
Wed Dec 17 07:06:24 UTC 2025
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, `all`
-------------
Commit messages:
- Fix
Changes: https://git.openjdk.org/jdk/pull/28861/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28861&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8373820
Stats: 8 lines in 1 file changed: 5 ins; 1 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/28861.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28861/head:pull/28861
PR: https://git.openjdk.org/jdk/pull/28861
More information about the hotspot-compiler-dev
mailing list