RFR: 8370519: C2: Hit MemLimit when running with +VerifyLoopOptimizations [v6]

Roland Westrelin roland at openjdk.org
Mon Jan 19 13:59:55 UTC 2026


On Fri, 19 Dec 2025 10:21:29 GMT, Benoît Maillard <bmaillard at openjdk.org> wrote:

>> Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   package declaration
>
> I think we should use the following test, which is quite concise and only takes a few seconds to execute thanks to setting `memlimit` to `100M`.
> 
> ```c++
> /**
>  * @test
>  * @key stress randomness
>  * @bug 8370519
>  * @summary C2: Hit MemLimit when running with +VerifyLoopOptimizations
>  * @run main/othervm -XX:CompileCommand=compileonly,${test.main.class}::* -XX:-TieredCompilation -Xbatch
>  *                   -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions
>  *                   -XX:+StressLoopPeeling -XX:+VerifyLoopOptimizations
>  *                   -XX:CompileCommand=memlimit,${test.main.class}::*,100M~crash
>  *                   -XX:StressSeed=3106998670 ${test.main.class}
>  * @run main ${test.main.class}
>  */
> 
> package compiler.c2;
> 
> public class TestVerifyLoopOptimizationsHighMemUsage {
> 
>     static int b = 400;
>     static long c;
>     static boolean d;
> 
>     static long lMeth(int e) {
>         int f, g, h, k[] = new int[b];
>         long l[] = new long[b];
>         boolean m[] = new boolean[b];
>         for (f = 5; f < 330; ++f)
>         for (g = 1; g < 5; ++g)
>             for (h = 2; h > 1; h -= 3)
>             switch (f * 5 + 54) {
>             case 156:
>             case 354:
>             case 98:
>             case 173:
>             case 120:
>             case 374:
>             case 140:
>             case 57:
>             case 106:
>             case 306:
>             case 87:
>             case 399:
>                 k[1] = (int)c;
>             case 51:
>             case 287:
>             case 148:
>             case 70:
>             case 74:
>             case 59:
>                 m[h] = d;
>             }
>         long n = p(l);
>         return n;
>     }
> 
>     public static long p(long[] a) {
>         long o = 0;
>         for (int j = 0; j < a.length; j++)
>         o += j;
>         return o;
>     }
> 
>     public static void main(String[] args) {
>         for (int i = 0; i < 10; i++)
>         lMeth(9);
>     }
> }

@benoitmaillard how feasible/time consuming would it be to find a more robust test case? Do you agree with my concern above?

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

PR Comment: https://git.openjdk.org/jdk/pull/28581#issuecomment-3768463138


More information about the hotspot-compiler-dev mailing list