RFR: 8357781: Deep recursion in PhaseCFG::set_next_call leads to stack overflow [v3]
Marc Chevalier
mchevalier at openjdk.org
Tue May 27 11:54:52 UTC 2025
On Tue, 27 May 2025 11:39:07 GMT, SendaoYan <syan at openjdk.org> wrote:
>> Marc Chevalier has updated the pull request incrementally with one additional commit since the last revision:
>>
>> address comment
>
> test/hotspot/jtreg/compiler/c2/StackOverflowInSetNextCall.java line 65:
>
>> 63: public static void main(String[] args) {
>> 64: for (int i = 0; i < 400; ++i) {
>> 65: test();
>
> Do we need to use the return value of function `test`, to avoid the compiler do the dead code elimination
Experimentally it's not useful since if the call was overall eliminated, it wouldn't reproduce the crash.
Moreover the test uses `-XX:CompileCommand=compileonly,StackOverflowInSetNextCall::test` so `main` is not compiled so no dead code elimination can kick in. This is not even necessary: one can just force compilation of `test` (and more) without `-Xcomp` and CompileCommand just by having enough iterations of this loop. It's just not very nice as a test since it compiles a lot more things, and takes longer overall, without benefit.
Also, the code couldn't be eliminated overall: `test()` could have some side effects, it would need inlining to conclude it can be removed, and even then, it can't since `test()` assigns `d` and reads `arr`: even if nothing happens actually, I don't think it could remove everything.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25448#discussion_r2108984147
More information about the hotspot-compiler-dev
mailing list