hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java
changeset 38025 5ed9ce1e4a2f
parent 36599 8dd1694c0480
child 40059 c2304140ed64
equal deleted inserted replaced
38023:5fcccfdea459 38025:5ed9ce1e4a2f
    22  */
    22  */
    23 package compiler.whitebox;
    23 package compiler.whitebox;
    24 
    24 
    25 import sun.hotspot.WhiteBox;
    25 import sun.hotspot.WhiteBox;
    26 import sun.hotspot.code.NMethod;
    26 import sun.hotspot.code.NMethod;
       
    27 
    27 import java.lang.reflect.Executable;
    28 import java.lang.reflect.Executable;
    28 import java.util.Objects;
    29 import java.util.Objects;
    29 import java.util.concurrent.Callable;
    30 import java.util.concurrent.Callable;
    30 import java.util.function.Function;
    31 import java.util.function.Function;
    31 
    32 
    56     protected static final int COMPILE_THRESHOLD
    57     protected static final int COMPILE_THRESHOLD
    57             = Integer.parseInt(getVMOption("CompileThreshold", "10000"));
    58             = Integer.parseInt(getVMOption("CompileThreshold", "10000"));
    58     /** Value of {@code -XX:BackgroundCompilation} */
    59     /** Value of {@code -XX:BackgroundCompilation} */
    59     protected static final boolean BACKGROUND_COMPILATION
    60     protected static final boolean BACKGROUND_COMPILATION
    60             = Boolean.valueOf(getVMOption("BackgroundCompilation", "true"));
    61             = Boolean.valueOf(getVMOption("BackgroundCompilation", "true"));
       
    62     protected static final boolean USE_COUNTER_DECAY
       
    63             = Boolean.valueOf(getVMOption("UseCounterDecay", "true"));
    61     /** Value of {@code -XX:TieredCompilation} */
    64     /** Value of {@code -XX:TieredCompilation} */
    62     protected static final boolean TIERED_COMPILATION
    65     protected static final boolean TIERED_COMPILATION
    63             = Boolean.valueOf(getVMOption("TieredCompilation", "false"));
    66             = Boolean.valueOf(getVMOption("TieredCompilation", "false"));
    64     /** Value of {@code -XX:TieredStopAtLevel} */
    67     /** Value of {@code -XX:TieredStopAtLevel} */
    65     protected static final int TIERED_STOP_AT_LEVEL
    68     protected static final int TIERED_STOP_AT_LEVEL
   368      * {@linkplain TestCase#getCallable()} enough times.
   371      * {@linkplain TestCase#getCallable()} enough times.
   369      *
   372      *
   370      * @return accumulated result
   373      * @return accumulated result
   371      * @see #compile(int)
   374      * @see #compile(int)
   372      */
   375      */
   373     protected final int compile() {
   376     protected final int compile() throws Exception {
       
   377         if (USE_COUNTER_DECAY) {
       
   378             throw new Exception("Tests using compile method must turn off counter decay for reliability");
       
   379         }
   374         if (testCase.isOsr()) {
   380         if (testCase.isOsr()) {
   375             return compile(1);
   381             return compile(1);
   376         } else {
   382         } else {
   377             return compile(THRESHOLD);
   383             return compile(THRESHOLD);
   378         }
   384         }