-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8366990: C2: Compilation hits the memory limit when verifying loop opts in Split-If code #27731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
3801d77
a51c1c4
61d1d18
7cdcd05
5605539
b49d1ae
37ff941
04582cc
482976d
6c93a87
4f4728f
98a36ab
1491922
a27bd07
9a00164
f9d737f
1f13f87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| /* | ||
| * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. | ||
| * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| * | ||
| * This code is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU General Public License version 2 only, as | ||
| * published by the Free Software Foundation. | ||
| * | ||
| * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| * version 2 for more details (a copy is included in the LICENSE file that | ||
| * accompanied this code). | ||
| * | ||
| * You should have received a copy of the GNU General Public License version | ||
| * 2 along with this work; if not, write to the Free Software Foundation, | ||
| * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| * | ||
| * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| * or visit www.oracle.com if you need additional information or have any | ||
| * questions. | ||
| */ | ||
|
|
||
| package compiler.loopopts; | ||
|
|
||
| /** | ||
| * @test | ||
| * @bug 8366990 | ||
| * @summary Loop optimizations verification results in hitting the memory limit. | ||
| * This is caused by the high number of verification passes triggered | ||
| * in PhaseIdealLoop::split_if_with_blocks_post and repetitive memory | ||
| * allocations while building the ideal Loop tree in preparation for | ||
| * the verification. | ||
| * | ||
| * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions | ||
| * -XX:CompileCommand=compileonly,compiler.loopopts.TestVerifyLoopOptimizationsHitsMemLimit::test | ||
| * -XX:CompileCommand=memlimit,compiler.loopopts.TestVerifyLoopOptimizationsHitsMemLimit::test,100M~crash | ||
| * -XX:-TieredCompilation -Xcomp -XX:PerMethodTrapLimit=0 | ||
| * -XX:+StressLoopPeeling -XX:+VerifyLoopOptimizations | ||
| * -XX:StressSeed=1870557292 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest to remove the stress seed since it might not trigger anymore in later builds. Usually, we add a run with a fixed stress seed and one without but since this test requires to do just some verification work, I would suggest to not add two runs but only one without fixed seed. Another question: How close are we to hit the default the memory limit with this test? With your fix it probably consumes not much memory anymore. I therefore suggest to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was able to reduce the test further using a memory limit of 100M (approximately 10 times less than the default) and a shorter timeout with |
||
| * compiler.loopopts.TestVerifyLoopOptimizationsHitsMemLimit | ||
| * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions | ||
| * -XX:CompileCommand=compileonly,compiler.loopopts.TestVerifyLoopOptimizationsHitsMemLimit::test | ||
| * -XX:CompileCommand=memlimit,compiler.loopopts.TestVerifyLoopOptimizationsHitsMemLimit::test,100M~crash | ||
| * -XX:-TieredCompilation -Xcomp -XX:PerMethodTrapLimit=0 | ||
| * -XX:+StressLoopPeeling -XX:+VerifyLoopOptimizations | ||
| * compiler.loopopts.TestVerifyLoopOptimizationsHitsMemLimit | ||
| * @run main compiler.loopopts.TestVerifyLoopOptimizationsHitsMemLimit | ||
| * | ||
| */ | ||
|
|
||
| public class TestVerifyLoopOptimizationsHitsMemLimit { | ||
| final int a = 400; | ||
| int b; | ||
| float c; | ||
| static double d; | ||
| static byte f; | ||
| long g[]; | ||
| volatile int h[]; | ||
|
|
||
| void test() { | ||
| int j, k = 2, l, o[] = new int[a]; | ||
| short m = 10492; | ||
| for (j = 1;; ++j) { | ||
| l = 1; | ||
| do { | ||
| g[j] = l; | ||
| switch (j) { | ||
| case 45: | ||
| o[1] = b; | ||
| case 163: | ||
| case 62: | ||
| case 72: | ||
| case 319: | ||
| h[1] -= k; | ||
| case 109: | ||
| case 47: | ||
| case 91: | ||
| case 68: | ||
| case 162: | ||
| case 76: | ||
| case 60: | ||
| case 66: | ||
| case 83: | ||
| d = m; | ||
| case 2314: | ||
| f = (byte) c; | ||
| } | ||
| } while (++l < 4); | ||
| } | ||
| } | ||
|
|
||
| public static void main(String[] args) { | ||
| try { | ||
| TestVerifyLoopOptimizationsHitsMemLimit test = new TestVerifyLoopOptimizationsHitsMemLimit(); | ||
| test.test(); | ||
| throw new RuntimeException("Expected a NPE for uninitialized array"); | ||
| } catch (NullPointerException e) { | ||
| // expected | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.