diff -r 5fcccfdea459 -r 5ed9ce1e4a2f hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java --- a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java Thu Apr 07 12:16:03 2016 +0000 +++ b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java Wed Apr 06 14:48:45 2016 +0200 @@ -24,6 +24,7 @@ import sun.hotspot.WhiteBox; import sun.hotspot.code.NMethod; + import java.lang.reflect.Executable; import java.util.Objects; import java.util.concurrent.Callable; @@ -58,6 +59,8 @@ /** Value of {@code -XX:BackgroundCompilation} */ protected static final boolean BACKGROUND_COMPILATION = Boolean.valueOf(getVMOption("BackgroundCompilation", "true")); + protected static final boolean USE_COUNTER_DECAY + = Boolean.valueOf(getVMOption("UseCounterDecay", "true")); /** Value of {@code -XX:TieredCompilation} */ protected static final boolean TIERED_COMPILATION = Boolean.valueOf(getVMOption("TieredCompilation", "false")); @@ -370,7 +373,10 @@ * @return accumulated result * @see #compile(int) */ - protected final int compile() { + protected final int compile() throws Exception { + if (USE_COUNTER_DECAY) { + throw new Exception("Tests using compile method must turn off counter decay for reliability"); + } if (testCase.isOsr()) { return compile(1); } else {