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

Benoît Maillard bmaillard at openjdk.org
Fri Dec 19 10:24:30 UTC 2025


On Thu, 11 Dec 2025 15:42:42 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> For this failure memory stats are:
>> 
>> 
>> Total Usage: 1095525816 
>>     --- Arena Usage by Arena Type and compilation phase, at arena usage peak of 1095525816 ---
>>         Phase                         Total        ra      node      comp      type    states   reglive  regsplit   regmask superword     cienv        ha     other
>>         none                        5976032    331560   5402064    197512     33712     10200         0         0       984         0         0         0         0
>>         parse                       2716464     65456   1145480    196408   1112752         0         0         0         0         0    196368         0         0
>>         optimizer                     98184         0     32728         0     65456         0         0         0         0         0         0         0         0
>>         connectionGraph               32728         0         0     32728         0         0         0         0         0         0         0         0         0
>>         iterGVN                       32728         0     32728         0         0         0         0         0         0         0         0         0         0
>>         idealLoop                 918189632         0  38687056 872824784    392776         0         0         0         0         0   6285016         0         0
>>         idealLoopVerify             2228144         0         0   2228144         0         0         0         0         0         0         0         0         0
>>         macroExpand                   32728         0     32728         0         0         0         0         0         0         0         0         0         0
>>         graphReshape                  32728         0     32728         0         0         0         0         0         0         0         0         0         0
>>         matcher                    20135944   3369848   9033208   7536400     65456    131032         0         0         0         0         0         0         0
>>         postselect_cleanup           294872    294872         0         0         0         0         0         0         0         0         0         0         0
>>         scheduler                    752944    196488    556456         0         0         0         0         0         0         0         0         0         0
>>         regalloc                     388736    388736         0         0         0         0         0         0         0         0         0         0         0
>>        ...
>
> 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);
    }
}

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

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


More information about the hotspot-dev mailing list