RFR: 8357781: Deep recursion in PhaseCFG::set_next_call leads to stack overflow [v3]

SendaoYan syan at openjdk.org
Wed May 28 13:31:59 UTC 2025


On Tue, 27 May 2025 11:52:14 GMT, Marc Chevalier <mchevalier at openjdk.org> wrote:

>> 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.

Thanks for your detail explanations.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25448#discussion_r2111925304


More information about the hotspot-compiler-dev mailing list