Skip to content

Commit f908cee

Browse files
committed
8270447: [IR Framework] Add missing compilation level restriction when using FlipC1C2 stress option
Backport-of: 36aefa351afeb5fd6b87060e06c1e8060afb87a0
1 parent be52dc5 commit f908cee

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
@@ -281,7 +281,7 @@ private void addBaseTests() {
281281
BaseTest baseTest = new BaseTest(test, shouldExcludeTest(m.getName()));
282282
allTests.add(baseTest);
283283
if (PRINT_VALID_IR_RULES) {
284-
irMatchRulePrinter.emitRuleEncoding(m, baseTest.isSkipped());
284+
irMatchRulePrinter.emitRuleEncoding(m, baseTest.isSkipped());
285285
}
286286
} catch (TestFormatException e) {
287287
// Failure logged. Continue and report later.
@@ -462,19 +462,20 @@ private void dontCompileWithCompiler(Executable ex, Compiler compiler) {
462462
private void applyForceCompileCommand(Executable ex) {
463463
ForceCompile forceCompileAnno = getAnnotation(ex, ForceCompile.class);
464464
if (forceCompileAnno != null) {
465-
CompLevel complevel = forceCompileAnno.value();
466-
TestFormat.check(complevel != CompLevel.SKIP && complevel != CompLevel.WAIT_FOR_COMPILATION,
465+
CompLevel compLevel = forceCompileAnno.value();
466+
TestFormat.check(compLevel != CompLevel.SKIP && compLevel != CompLevel.WAIT_FOR_COMPILATION,
467467
"Cannot define compilation level SKIP or WAIT_FOR_COMPILATION in @ForceCompile at " + ex);
468-
complevel = restrictCompLevel(forceCompileAnno.value());
468+
compLevel = restrictCompLevel(forceCompileAnno.value());
469469
if (FLIP_C1_C2) {
470-
complevel = complevel.flipCompLevel();
470+
compLevel = compLevel.flipCompLevel();
471+
compLevel = restrictCompLevel(compLevel.flipCompLevel());
471472
}
472473
if (EXCLUDE_RANDOM) {
473-
complevel = complevel.excludeCompilationRandomly(ex);
474+
compLevel = compLevel.excludeCompilationRandomly(ex);
474475
}
475-
if (complevel != CompLevel.SKIP) {
476-
enqueueForCompilation(ex, complevel);
477-
forceCompileMap.put(ex, complevel);
476+
if (compLevel != CompLevel.SKIP) {
477+
enqueueForCompilation(ex, compLevel);
478+
forceCompileMap.put(ex, compLevel);
478479
}
479480
}
480481
}
@@ -504,7 +505,7 @@ private void setupDeclaredTests() {
504505
} else {
505506
TestFormat.checkNoThrow(!m.isAnnotationPresent(IR.class), "Found @IR annotation on non-@Test method " + m);
506507
TestFormat.checkNoThrow(!m.isAnnotationPresent(Warmup.class) || getAnnotation(m, Run.class) != null,
507-
"Found @Warmup annotation on non-@Test or non-@Run method " + m);
508+
"Found @Warmup annotation on non-@Test or non-@Run method " + m);
508509
}
509510
} catch (TestFormatException e) {
510511
// Failure logged. Continue and report later.
@@ -530,6 +531,7 @@ private void addDeclaredTest(Method m) {
530531
CompLevel compLevel = restrictCompLevel(testAnno.compLevel());
531532
if (FLIP_C1_C2) {
532533
compLevel = compLevel.flipCompLevel();
534+
compLevel = restrictCompLevel(compLevel.flipCompLevel());
533535
}
534536
if (EXCLUDE_RANDOM) {
535537
compLevel = compLevel.excludeCompilationRandomly(m);
@@ -727,8 +729,8 @@ private void checkCustomRunTest(Method m, String testName, Method testMethod, De
727729
"Cannot use @Arguments at test method " + testMethod + " in combination with @Run method " + m);
728730
Warmup warmupAnno = getAnnotation(testMethod, Warmup.class);
729731
TestFormat.checkNoThrow(warmupAnno == null,
730-
"Cannot set @Warmup at @Test method " + testMethod + " when used with its @Run method "
731-
+ m + ". Use @Warmup at @Run method instead.");
732+
"Cannot set @Warmup at @Test method " + testMethod + " when used with its @Run method "
733+
+ m + ". Use @Warmup at @Run method instead.");
732734
Test testAnno = getAnnotation(testMethod, Test.class);
733735
TestFormat.checkNoThrow(runMode != RunMode.STANDALONE || testAnno.compLevel() == CompLevel.ANY,
734736
"Setting explicit compilation level for @Test method " + testMethod + " has no effect "
@@ -864,7 +866,7 @@ enum TriState {
864866

865867
public static void compile(Method m, CompLevel compLevel) {
866868
TestRun.check(compLevel != CompLevel.SKIP && compLevel != CompLevel.WAIT_FOR_COMPILATION,
867-
"Invalid compilation request with level " + compLevel);
869+
"Invalid compilation request with level " + compLevel);
868870
enqueueForCompilation(m, compLevel);
869871
}
870872

@@ -907,7 +909,7 @@ public static void assertDeoptimizedByC2(Method m) {
907909
*/
908910
private static boolean notUnstableDeoptAssertion(Method m, CompLevel level) {
909911
return (USE_COMPILER && !XCOMP && !IGNORE_COMPILER_CONTROLS && !TEST_C1 &&
910-
(!EXCLUDE_RANDOM || WHITE_BOX.isMethodCompilable(m, level.getValue(), false)));
912+
(!EXCLUDE_RANDOM || WHITE_BOX.isMethodCompilable(m, level.getValue(), false)));
911913
}
912914

913915
public static void assertCompiledByC1(Method m) {
@@ -962,7 +964,7 @@ private static TriState compiledAtLevel(Method m, CompLevel level) {
962964
default -> throw new TestRunException("compiledAtLevel() should not be called with " + level);
963965
}
964966
}
965-
if (!USE_COMPILER || XCOMP || TEST_C1 || IGNORE_COMPILER_CONTROLS ||
967+
if (!USE_COMPILER || XCOMP || TEST_C1 || IGNORE_COMPILER_CONTROLS || FLIP_C1_C2 ||
966968
(EXCLUDE_RANDOM && !WHITE_BOX.isMethodCompilable(m, level.getValue(), false))) {
967969
return TriState.Maybe;
968970
}

0 commit comments

Comments
 (0)