Skip to content

Commit 36aefa3

Browse files
committed
8270447: [IR Framework] Add missing compilation level restriction when using FlipC1C2 stress option
Reviewed-by: kvn, thartmann
1 parent e4295cc commit 36aefa3

File tree

1 file changed

+17
-15
lines changed
  • test/hotspot/jtreg/compiler/lib/ir_framework/test

1 file changed

+17
-15
lines changed

test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ private void addBaseTests() {
271271
BaseTest baseTest = new BaseTest(test, shouldExcludeTest(m.getName()));
272272
allTests.add(baseTest);
273273
if (PRINT_VALID_IR_RULES) {
274-
irMatchRulePrinter.emitRuleEncoding(m, baseTest.isSkipped());
274+
irMatchRulePrinter.emitRuleEncoding(m, baseTest.isSkipped());
275275
}
276276
} catch (TestFormatException e) {
277277
// Failure logged. Continue and report later.
@@ -452,19 +452,20 @@ private void dontCompileWithCompiler(Executable ex, Compiler compiler) {
452452
private void applyForceCompileCommand(Executable ex) {
453453
ForceCompile forceCompileAnno = getAnnotation(ex, ForceCompile.class);
454454
if (forceCompileAnno != null) {
455-
CompLevel complevel = forceCompileAnno.value();
456-
TestFormat.check(complevel != CompLevel.SKIP && complevel != CompLevel.WAIT_FOR_COMPILATION,
455+
CompLevel compLevel = forceCompileAnno.value();
456+
TestFormat.check(compLevel != CompLevel.SKIP && compLevel != CompLevel.WAIT_FOR_COMPILATION,
457457
"Cannot define compilation level SKIP or WAIT_FOR_COMPILATION in @ForceCompile at " + ex);
458-
complevel = restrictCompLevel(forceCompileAnno.value());
458+
compLevel = restrictCompLevel(forceCompileAnno.value());
459459
if (FLIP_C1_C2) {
460-
complevel = complevel.flipCompLevel();
460+
compLevel = compLevel.flipCompLevel();
461+
compLevel = restrictCompLevel(compLevel.flipCompLevel());
461462
}
462463
if (EXCLUDE_RANDOM) {
463-
complevel = complevel.excludeCompilationRandomly(ex);
464+
compLevel = compLevel.excludeCompilationRandomly(ex);
464465
}
465-
if (complevel != CompLevel.SKIP) {
466-
enqueueForCompilation(ex, complevel);
467-
forceCompileMap.put(ex, complevel);
466+
if (compLevel != CompLevel.SKIP) {
467+
enqueueForCompilation(ex, compLevel);
468+
forceCompileMap.put(ex, compLevel);
468469
}
469470
}
470471
}
@@ -494,7 +495,7 @@ private void setupDeclaredTests() {
494495
} else {
495496
TestFormat.checkNoThrow(!m.isAnnotationPresent(IR.class), "Found @IR annotation on non-@Test method " + m);
496497
TestFormat.checkNoThrow(!m.isAnnotationPresent(Warmup.class) || getAnnotation(m, Run.class) != null,
497-
"Found @Warmup annotation on non-@Test or non-@Run method " + m);
498+
"Found @Warmup annotation on non-@Test or non-@Run method " + m);
498499
}
499500
} catch (TestFormatException e) {
500501
// Failure logged. Continue and report later.
@@ -520,6 +521,7 @@ private void addDeclaredTest(Method m) {
520521
CompLevel compLevel = restrictCompLevel(testAnno.compLevel());
521522
if (FLIP_C1_C2) {
522523
compLevel = compLevel.flipCompLevel();
524+
compLevel = restrictCompLevel(compLevel.flipCompLevel());
523525
}
524526
if (EXCLUDE_RANDOM) {
525527
compLevel = compLevel.excludeCompilationRandomly(m);
@@ -711,8 +713,8 @@ private void checkCustomRunTest(Method m, String testName, Method testMethod, De
711713
"Cannot use @Arguments at test method " + testMethod + " in combination with @Run method " + m);
712714
Warmup warmupAnno = getAnnotation(testMethod, Warmup.class);
713715
TestFormat.checkNoThrow(warmupAnno == null,
714-
"Cannot set @Warmup at @Test method " + testMethod + " when used with its @Run method "
715-
+ m + ". Use @Warmup at @Run method instead.");
716+
"Cannot set @Warmup at @Test method " + testMethod + " when used with its @Run method "
717+
+ m + ". Use @Warmup at @Run method instead.");
716718
Test testAnno = getAnnotation(testMethod, Test.class);
717719
TestFormat.checkNoThrow(runMode != RunMode.STANDALONE || testAnno.compLevel() == CompLevel.ANY,
718720
"Setting explicit compilation level for @Test method " + testMethod + " has no effect "
@@ -848,7 +850,7 @@ enum TriState {
848850

849851
public static void compile(Method m, CompLevel compLevel) {
850852
TestRun.check(compLevel != CompLevel.SKIP && compLevel != CompLevel.WAIT_FOR_COMPILATION,
851-
"Invalid compilation request with level " + compLevel);
853+
"Invalid compilation request with level " + compLevel);
852854
enqueueForCompilation(m, compLevel);
853855
}
854856

@@ -891,7 +893,7 @@ public static void assertDeoptimizedByC2(Method m) {
891893
*/
892894
private static boolean notUnstableDeoptAssertion(Method m, CompLevel level) {
893895
return (USE_COMPILER && !XCOMP && !IGNORE_COMPILER_CONTROLS && !TEST_C1 &&
894-
(!EXCLUDE_RANDOM || WHITE_BOX.isMethodCompilable(m, level.getValue(), false)));
896+
(!EXCLUDE_RANDOM || WHITE_BOX.isMethodCompilable(m, level.getValue(), false)));
895897
}
896898

897899
public static void assertCompiledByC1(Method m) {
@@ -946,7 +948,7 @@ private static TriState compiledAtLevel(Method m, CompLevel level) {
946948
default -> throw new TestRunException("compiledAtLevel() should not be called with " + level);
947949
}
948950
}
949-
if (!USE_COMPILER || XCOMP || TEST_C1 || IGNORE_COMPILER_CONTROLS ||
951+
if (!USE_COMPILER || XCOMP || TEST_C1 || IGNORE_COMPILER_CONTROLS || FLIP_C1_C2 ||
950952
(EXCLUDE_RANDOM && !WHITE_BOX.isMethodCompilable(m, level.getValue(), false))) {
951953
return TriState.Maybe;
952954
}

0 commit comments

Comments
 (0)