Java Code Examples for com.oracle.java.testlibrary.Platform#isServer()

The following examples show how to use com.oracle.java.testlibrary.Platform#isServer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CorrectnessTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    if (!Platform.isServer()) {
        System.out.println("ALL TESTS SKIPPED");
    }
    Asserts.assertGTE(args.length, 1);
    ProfilingType profilingType = ProfilingType.valueOf(args[0]);
    if (runTests(profilingType)) {
        System.out.println("ALL TESTS PASSED");
    } else {
        throw new RuntimeException("SOME TESTS FAILED");
    }
}
 
Example 2
Source File: CorrectnessTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    if (!Platform.isServer()) {
        System.out.println("ALL TESTS SKIPPED");
    }
    Asserts.assertGTE(args.length, 1);
    ProfilingType profilingType = ProfilingType.valueOf(args[0]);
    if (runTests(profilingType)) {
        System.out.println("ALL TESTS PASSED");
    } else {
        throw new RuntimeException("SOME TESTS FAILED");
    }
}
 
Example 3
Source File: CorrectnessTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    if (!Platform.isServer()) {
        System.out.println("ALL TESTS SKIPPED");
    }
    Asserts.assertGTE(args.length, 1);
    ProfilingType profilingType = ProfilingType.valueOf(args[0]);
    if (runTests(profilingType)) {
        System.out.println("ALL TESTS PASSED");
    } else {
        throw new RuntimeException("SOME TESTS FAILED");
    }
}
 
Example 4
Source File: CorrectnessTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    if (!Platform.isServer()) {
        System.out.println("ALL TESTS SKIPPED");
    }
    Asserts.assertGTE(args.length, 1);
    ProfilingType profilingType = ProfilingType.valueOf(args[0]);
    if (runTests(profilingType)) {
        System.out.println("ALL TESTS PASSED");
    } else {
        throw new RuntimeException("SOME TESTS FAILED");
    }
}
 
Example 5
Source File: BmiIntrinsicBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void test() throws Exception {
    BmiTestCase bmiTestCase = (BmiTestCase) testCase;

    if (!(Platform.isX86() || Platform.isX64())) {
        System.out.println("Unsupported platform, test SKIPPED");
        return;
    }

    if (!Platform.isServer()) {
        System.out.println("Not server VM, test SKIPPED");
        return;
    }

    if (!CPUInfo.hasFeature(bmiTestCase.getCpuFlag())) {
        System.out.println("Unsupported hardware, no required CPU flag " + bmiTestCase.getCpuFlag() + " , test SKIPPED");
        return;
    }

    if (!Boolean.valueOf(getVMOption(bmiTestCase.getVMFlag()))) {
        System.out.println("VM flag " + bmiTestCase.getVMFlag() + " disabled, test SKIPPED");
        return;
    }

    System.out.println(testCase.name());

    switch (MODE) {
        case "compiled mode":
        case "mixed mode":
            if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX) {
                System.out.println("TieredStopAtLevel value (" + TIERED_STOP_AT_LEVEL + ") is too low, test SKIPPED");
                return;
            }
            deoptimize();
            compileAtLevelAndCheck(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
            break;
        case "interpreted mode": // test is not applicable in this mode;
            System.err.println("Warning: This test is not applicable in mode: " + MODE);
            break;
        default:
            throw new AssertionError("Test bug, unknown VM mode: " + MODE);
    }
}
 
Example 6
Source File: IsMethodCompilableTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Tests {@code WB::isMethodCompilable()} by recompilation of tested method
 * 'PerMethodRecompilationCutoff' times and checks compilation status. Also
 * checks that WB::clearMethodState() clears no-compilable flags. Only
 * applicable to c2 compiled methods.
 *
 * @throws Exception if one of the checks fails.
 */
@Override
protected void test() throws Exception {
    // Only c2 compilations can be disabled through PerMethodRecompilationCutoff
    if (!Platform.isServer()) {
        return;
    }

    if (skipXcompOSR()) {
      return;
    }
    if (!isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method + " must be compilable");
    }
    System.out.println("PerMethodRecompilationCutoff = "
            + PER_METHOD_RECOMPILATION_CUTOFF);
    if (PER_METHOD_RECOMPILATION_CUTOFF == -1) {
        System.err.println(
                "Warning: test is not applicable if PerMethodRecompilationCutoff == Inf");
        return;
    }

    // deoptimize 'PerMethodRecompilationCutoff' times
    for (long attempts = 0, successes = 0;
           (successes < PER_METHOD_RECOMPILATION_CUTOFF)  &&
           (attempts < PER_METHOD_RECOMPILATION_CUTOFF*2) &&
           isCompilable(COMP_LEVEL_FULL_OPTIMIZATION); attempts++) {
        if (compileAndDeoptimize() == COMP_LEVEL_FULL_OPTIMIZATION) {
            successes++;
        }
    }

    if (!testCase.isOsr() && !isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        // in osr test case count of deopt maybe more than iterations
        throw new RuntimeException(method + " is not compilable after "
                + PER_METHOD_RECOMPILATION_CUTOFF + " iterations");
    }

    // Now compile once more
    compileAndDeoptimize();

    if (isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method + " is still compilable after "
                + PER_METHOD_RECOMPILATION_CUTOFF + " iterations");
    }
    checkNotCompiled();
    compile();
    waitBackgroundCompilation();
    checkNotCompiled(COMP_LEVEL_FULL_OPTIMIZATION);

    // WB.clearMethodState() must reset no-compilable flags
    WHITE_BOX.clearMethodState(method);
    if (!isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method
                + " is not compilable after clearMethodState()");
    }
    compile();
    checkCompiled();
}
 
Example 7
Source File: SupportedVM.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean getAsBoolean() {
    return Platform.isServer() && !Platform.isEmbedded();
}
 
Example 8
Source File: TestRangeCheckSmearing.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
void doTest(String name) {
    Method m = tests.get(name);
    tests.remove(name);
    int[] args = m.getAnnotation(Args.class).value();
    int index0 = args[0], index1;
    boolean exceptionRequired = true;
    if (args.length == 2) {
        index1 = args[1];
    } else {
        // no negative test for this one
        assert(args.length == 1);
        assert(name.equals("m13"));
        exceptionRequired = false;
        index1 = index0;
    }
    // Get the method compiled.
    if (!WHITE_BOX.isMethodCompiled(m)) {
        // If not, try to compile it with C2
        if(!WHITE_BOX.enqueueMethodForCompilation(m, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION)) {
            // C2 compiler not available, try to compile with C1
            WHITE_BOX.enqueueMethodForCompilation(m, CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
        }
    }
    if (!WHITE_BOX.isMethodCompiled(m)) {
        throw new RuntimeException(m + " not compiled");
    }

    // valid access
    invokeTest(m, array, index0, true);

    if (!WHITE_BOX.isMethodCompiled(m)) {
        throw new RuntimeException(m + " deoptimized on valid array access");
    }

    exception = false;
    boolean test_success = true;
    try {
        invokeTest(m, array, index1, false);
    } catch(ArrayIndexOutOfBoundsException aioob) {
        exception = true;
        System.out.println("ArrayIndexOutOfBoundsException thrown in "+name);
    }
    if (!exception) {
        System.out.println("ArrayIndexOutOfBoundsException was not thrown in "+name);
    }

    if (Platform.isServer()) {
        if (exceptionRequired == WHITE_BOX.isMethodCompiled(m)) {
            System.out.println((exceptionRequired?"Didn't deoptimized":"deoptimized") + " in "+name);
            test_success = false;
        }
    }

    if (exception != exceptionRequired) {
        System.out.println((exceptionRequired?"exception required but not thrown":"not exception required but thrown") + " in "+name);
        test_success = false;
    }

    if (!test_success) {
        success = false;
        System.out.println("TEST FAILED: "+name);
    }

}
 
Example 9
Source File: IsMethodCompilableTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Tests {@code WB::isMethodCompilable()} by recompilation of tested method
 * 'PerMethodRecompilationCutoff' times and checks compilation status. Also
 * checks that WB::clearMethodState() clears no-compilable flags. Only
 * applicable to c2 compiled methods.
 *
 * @throws Exception if one of the checks fails.
 */
@Override
protected void test() throws Exception {
    // Only c2 compilations can be disabled through PerMethodRecompilationCutoff
    if (!Platform.isServer()) {
        return;
    }

    if (skipXcompOSR()) {
      return;
    }
    if (!isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method + " must be compilable");
    }
    System.out.println("PerMethodRecompilationCutoff = "
            + PER_METHOD_RECOMPILATION_CUTOFF);
    if (PER_METHOD_RECOMPILATION_CUTOFF == -1) {
        System.err.println(
                "Warning: test is not applicable if PerMethodRecompilationCutoff == Inf");
        return;
    }

    // deoptimize 'PerMethodRecompilationCutoff' times
    for (long attempts = 0, successes = 0;
           (successes < PER_METHOD_RECOMPILATION_CUTOFF)  &&
           (attempts < PER_METHOD_RECOMPILATION_CUTOFF*2) &&
           isCompilable(COMP_LEVEL_FULL_OPTIMIZATION); attempts++) {
        if (compileAndDeoptimize() == COMP_LEVEL_FULL_OPTIMIZATION) {
            successes++;
        }
    }

    if (!testCase.isOsr() && !isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        // in osr test case count of deopt maybe more than iterations
        throw new RuntimeException(method + " is not compilable after "
                + PER_METHOD_RECOMPILATION_CUTOFF + " iterations");
    }

    // Now compile once more
    compileAndDeoptimize();

    if (isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method + " is still compilable after "
                + PER_METHOD_RECOMPILATION_CUTOFF + " iterations");
    }
    checkNotCompiled();
    compile();
    waitBackgroundCompilation();
    checkNotCompiled(COMP_LEVEL_FULL_OPTIMIZATION);

    // WB.clearMethodState() must reset no-compilable flags
    WHITE_BOX.clearMethodState(method);
    if (!isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method
                + " is not compilable after clearMethodState()");
    }
    compile();
    checkCompiled();
}
 
Example 10
Source File: BmiIntrinsicBase.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void test() throws Exception {
    BmiTestCase bmiTestCase = (BmiTestCase) testCase;

    if (!(Platform.isX86() || Platform.isX64())) {
        System.out.println("Unsupported platform, test SKIPPED");
        return;
    }

    if (!Platform.isServer()) {
        System.out.println("Not server VM, test SKIPPED");
        return;
    }

    if (!CPUInfo.hasFeature(bmiTestCase.getCpuFlag())) {
        System.out.println("Unsupported hardware, no required CPU flag " + bmiTestCase.getCpuFlag() + " , test SKIPPED");
        return;
    }

    if (!Boolean.valueOf(getVMOption(bmiTestCase.getVMFlag()))) {
        System.out.println("VM flag " + bmiTestCase.getVMFlag() + " disabled, test SKIPPED");
        return;
    }

    System.out.println(testCase.name());

    switch (MODE) {
        case "compiled mode":
        case "mixed mode":
            if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX) {
                System.out.println("TieredStopAtLevel value (" + TIERED_STOP_AT_LEVEL + ") is too low, test SKIPPED");
                return;
            }
            deoptimize();
            compileAtLevelAndCheck(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
            break;
        case "interpreted mode": // test is not applicable in this mode;
            System.err.println("Warning: This test is not applicable in mode: " + MODE);
            break;
        default:
            throw new AssertionError("Test bug, unknown VM mode: " + MODE);
    }
}
 
Example 11
Source File: SupportedVM.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean getAsBoolean() {
    return Platform.isServer() && !Platform.isEmbedded();
}
 
Example 12
Source File: SupportedVM.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean getAsBoolean() {
    return Platform.isServer() && !Platform.isEmbedded();
}
 
Example 13
Source File: IsMethodCompilableTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Tests {@code WB::isMethodCompilable()} by recompilation of tested method
 * 'PerMethodRecompilationCutoff' times and checks compilation status. Also
 * checks that WB::clearMethodState() clears no-compilable flags. Only
 * applicable to c2 compiled methods.
 *
 * @throws Exception if one of the checks fails.
 */
@Override
protected void test() throws Exception {
    // Only c2 compilations can be disabled through PerMethodRecompilationCutoff
    if (!Platform.isServer()) {
        return;
    }

    if (skipXcompOSR()) {
      return;
    }
    if (!isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method + " must be compilable");
    }
    System.out.println("PerMethodRecompilationCutoff = "
            + PER_METHOD_RECOMPILATION_CUTOFF);
    if (PER_METHOD_RECOMPILATION_CUTOFF == -1) {
        System.err.println(
                "Warning: test is not applicable if PerMethodRecompilationCutoff == Inf");
        return;
    }

    // deoptimize 'PerMethodRecompilationCutoff' times
    for (long attempts = 0, successes = 0;
           (successes < PER_METHOD_RECOMPILATION_CUTOFF)  &&
           (attempts < PER_METHOD_RECOMPILATION_CUTOFF*2) &&
           isCompilable(COMP_LEVEL_FULL_OPTIMIZATION); attempts++) {
        if (compileAndDeoptimize() == COMP_LEVEL_FULL_OPTIMIZATION) {
            successes++;
        }
    }

    if (!testCase.isOsr() && !isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        // in osr test case count of deopt maybe more than iterations
        throw new RuntimeException(method + " is not compilable after "
                + PER_METHOD_RECOMPILATION_CUTOFF + " iterations");
    }

    // Now compile once more
    compileAndDeoptimize();

    if (isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method + " is still compilable after "
                + PER_METHOD_RECOMPILATION_CUTOFF + " iterations");
    }
    checkNotCompiled();
    compile();
    waitBackgroundCompilation();
    checkNotCompiled(COMP_LEVEL_FULL_OPTIMIZATION);

    // WB.clearMethodState() must reset no-compilable flags
    WHITE_BOX.clearMethodState(method);
    if (!isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method
                + " is not compilable after clearMethodState()");
    }
    compile();
    checkCompiled();
}
 
Example 14
Source File: IsMethodCompilableTest.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Tests {@code WB::isMethodCompilable()} by recompilation of tested method
 * 'PerMethodRecompilationCutoff' times and checks compilation status. Also
 * checks that WB::clearMethodState() clears no-compilable flags. Only
 * applicable to c2 compiled methods.
 *
 * @throws Exception if one of the checks fails.
 */
@Override
protected void test() throws Exception {
    // Only c2 compilations can be disabled through PerMethodRecompilationCutoff
    if (!Platform.isServer()) {
        return;
    }

    if (skipXcompOSR()) {
      return;
    }
    if (!isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method + " must be compilable");
    }
    System.out.println("PerMethodRecompilationCutoff = "
            + PER_METHOD_RECOMPILATION_CUTOFF);
    if (PER_METHOD_RECOMPILATION_CUTOFF == -1) {
        System.err.println(
                "Warning: test is not applicable if PerMethodRecompilationCutoff == Inf");
        return;
    }

    // deoptimize 'PerMethodRecompilationCutoff' times
    for (long attempts = 0, successes = 0;
           (successes < PER_METHOD_RECOMPILATION_CUTOFF)  &&
           (attempts < PER_METHOD_RECOMPILATION_CUTOFF*2) &&
           isCompilable(COMP_LEVEL_FULL_OPTIMIZATION); attempts++) {
        if (compileAndDeoptimize() == COMP_LEVEL_FULL_OPTIMIZATION) {
            successes++;
        }
    }

    if (!testCase.isOsr() && !isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        // in osr test case count of deopt maybe more than iterations
        throw new RuntimeException(method + " is not compilable after "
                + PER_METHOD_RECOMPILATION_CUTOFF + " iterations");
    }

    // Now compile once more
    compileAndDeoptimize();

    if (isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method + " is still compilable after "
                + PER_METHOD_RECOMPILATION_CUTOFF + " iterations");
    }
    checkNotCompiled();
    compile();
    waitBackgroundCompilation();
    checkNotCompiled(COMP_LEVEL_FULL_OPTIMIZATION);

    // WB.clearMethodState() must reset no-compilable flags
    WHITE_BOX.clearMethodState(method);
    if (!isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method
                + " is not compilable after clearMethodState()");
    }
    compile();
    checkCompiled();
}
 
Example 15
Source File: SupportedVM.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean getAsBoolean() {
    return Platform.isServer() && !Platform.isEmbedded();
}
 
Example 16
Source File: TestRangeCheckSmearing.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
void doTest(String name) {
    Method m = tests.get(name);
    tests.remove(name);
    int[] args = m.getAnnotation(Args.class).value();
    int index0 = args[0], index1;
    boolean exceptionRequired = true;
    if (args.length == 2) {
        index1 = args[1];
    } else {
        // no negative test for this one
        assert(args.length == 1);
        assert(name.equals("m13"));
        exceptionRequired = false;
        index1 = index0;
    }
    // Get the method compiled.
    if (!WHITE_BOX.isMethodCompiled(m)) {
        // If not, try to compile it with C2
        if(!WHITE_BOX.enqueueMethodForCompilation(m, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION)) {
            // C2 compiler not available, try to compile with C1
            WHITE_BOX.enqueueMethodForCompilation(m, CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
        }
    }
    if (!WHITE_BOX.isMethodCompiled(m)) {
        throw new RuntimeException(m + " not compiled");
    }

    // valid access
    invokeTest(m, array, index0, true);

    if (!WHITE_BOX.isMethodCompiled(m)) {
        throw new RuntimeException(m + " deoptimized on valid array access");
    }

    exception = false;
    boolean test_success = true;
    try {
        invokeTest(m, array, index1, false);
    } catch(ArrayIndexOutOfBoundsException aioob) {
        exception = true;
        System.out.println("ArrayIndexOutOfBoundsException thrown in "+name);
    }
    if (!exception) {
        System.out.println("ArrayIndexOutOfBoundsException was not thrown in "+name);
    }

    if (Platform.isServer()) {
        if (exceptionRequired == WHITE_BOX.isMethodCompiled(m)) {
            System.out.println((exceptionRequired?"Didn't deoptimized":"deoptimized") + " in "+name);
            test_success = false;
        }
    }

    if (exception != exceptionRequired) {
        System.out.println((exceptionRequired?"exception required but not thrown":"not exception required but thrown") + " in "+name);
        test_success = false;
    }

    if (!test_success) {
        success = false;
        System.out.println("TEST FAILED: "+name);
    }

}
 
Example 17
Source File: IsMethodCompilableTest.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Tests {@code WB::isMethodCompilable()} by recompilation of tested method
 * 'PerMethodRecompilationCutoff' times and checks compilation status. Also
 * checks that WB::clearMethodState() clears no-compilable flags. Only
 * applicable to c2 compiled methods.
 *
 * @throws Exception if one of the checks fails.
 */
@Override
protected void test() throws Exception {
    // Only c2 compilations can be disabled through PerMethodRecompilationCutoff
    if (!Platform.isServer()) {
        return;
    }

    if (skipXcompOSR()) {
      return;
    }
    if (!isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method + " must be compilable");
    }
    System.out.println("PerMethodRecompilationCutoff = "
            + PER_METHOD_RECOMPILATION_CUTOFF);
    if (PER_METHOD_RECOMPILATION_CUTOFF == -1) {
        System.err.println(
                "Warning: test is not applicable if PerMethodRecompilationCutoff == Inf");
        return;
    }

    // deoptimize 'PerMethodRecompilationCutoff' times
    for (long attempts = 0, successes = 0;
           (successes < PER_METHOD_RECOMPILATION_CUTOFF)  &&
           (attempts < PER_METHOD_RECOMPILATION_CUTOFF*2) &&
           isCompilable(COMP_LEVEL_FULL_OPTIMIZATION); attempts++) {
        if (compileAndDeoptimize() == COMP_LEVEL_FULL_OPTIMIZATION) {
            successes++;
        }
    }

    if (!testCase.isOsr() && !isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        // in osr test case count of deopt maybe more than iterations
        throw new RuntimeException(method + " is not compilable after "
                + PER_METHOD_RECOMPILATION_CUTOFF + " iterations");
    }

    // Now compile once more
    compileAndDeoptimize();

    if (isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method + " is still compilable after "
                + PER_METHOD_RECOMPILATION_CUTOFF + " iterations");
    }
    checkNotCompiled();
    compile();
    waitBackgroundCompilation();
    checkNotCompiled(COMP_LEVEL_FULL_OPTIMIZATION);

    // WB.clearMethodState() must reset no-compilable flags
    WHITE_BOX.clearMethodState(method);
    if (!isCompilable(COMP_LEVEL_FULL_OPTIMIZATION)) {
        throw new RuntimeException(method
                + " is not compilable after clearMethodState()");
    }
    compile();
    checkCompiled();
}
 
Example 18
Source File: BmiIntrinsicBase.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void test() throws Exception {
    BmiTestCase bmiTestCase = (BmiTestCase) testCase;

    if (!(Platform.isX86() || Platform.isX64())) {
        System.out.println("Unsupported platform, test SKIPPED");
        return;
    }

    if (!Platform.isServer()) {
        System.out.println("Not server VM, test SKIPPED");
        return;
    }

    if (!CPUInfo.hasFeature(bmiTestCase.getCpuFlag())) {
        System.out.println("Unsupported hardware, no required CPU flag " + bmiTestCase.getCpuFlag() + " , test SKIPPED");
        return;
    }

    if (!Boolean.valueOf(getVMOption(bmiTestCase.getVMFlag()))) {
        System.out.println("VM flag " + bmiTestCase.getVMFlag() + " disabled, test SKIPPED");
        return;
    }

    System.out.println(testCase.name());

    switch (MODE) {
        case "compiled mode":
        case "mixed mode":
            if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX) {
                System.out.println("TieredStopAtLevel value (" + TIERED_STOP_AT_LEVEL + ") is too low, test SKIPPED");
                return;
            }
            deoptimize();
            compileAtLevelAndCheck(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
            break;
        case "interpreted mode": // test is not applicable in this mode;
            System.err.println("Warning: This test is not applicable in mode: " + MODE);
            break;
        default:
            throw new AssertionError("Test bug, unknown VM mode: " + MODE);
    }
}
 
Example 19
Source File: BmiIntrinsicBase.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void test() throws Exception {
    BmiTestCase bmiTestCase = (BmiTestCase) testCase;

    if (!(Platform.isX86() || Platform.isX64())) {
        System.out.println("Unsupported platform, test SKIPPED");
        return;
    }

    if (!Platform.isServer()) {
        System.out.println("Not server VM, test SKIPPED");
        return;
    }

    if (!CPUInfo.hasFeature(bmiTestCase.getCpuFlag())) {
        System.out.println("Unsupported hardware, no required CPU flag " + bmiTestCase.getCpuFlag() + " , test SKIPPED");
        return;
    }

    if (!Boolean.valueOf(getVMOption(bmiTestCase.getVMFlag()))) {
        System.out.println("VM flag " + bmiTestCase.getVMFlag() + " disabled, test SKIPPED");
        return;
    }

    System.out.println(testCase.name());

    switch (MODE) {
        case "compiled mode":
        case "mixed mode":
            if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX) {
                System.out.println("TieredStopAtLevel value (" + TIERED_STOP_AT_LEVEL + ") is too low, test SKIPPED");
                return;
            }
            deoptimize();
            compileAtLevelAndCheck(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
            break;
        case "interpreted mode": // test is not applicable in this mode;
            System.err.println("Warning: This test is not applicable in mode: " + MODE);
            break;
        default:
            throw new AssertionError("Test bug, unknown VM mode: " + MODE);
    }
}
 
Example 20
Source File: TestRangeCheckSmearing.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
void doTest(String name) {
    Method m = tests.get(name);
    tests.remove(name);
    int[] args = m.getAnnotation(Args.class).value();
    int index0 = args[0], index1;
    boolean exceptionRequired = true;
    if (args.length == 2) {
        index1 = args[1];
    } else {
        // no negative test for this one
        assert(args.length == 1);
        assert(name.equals("m13"));
        exceptionRequired = false;
        index1 = index0;
    }
    // Get the method compiled.
    if (!WHITE_BOX.isMethodCompiled(m)) {
        // If not, try to compile it with C2
        if(!WHITE_BOX.enqueueMethodForCompilation(m, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION)) {
            // C2 compiler not available, try to compile with C1
            WHITE_BOX.enqueueMethodForCompilation(m, CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
        }
    }
    if (!WHITE_BOX.isMethodCompiled(m)) {
        throw new RuntimeException(m + " not compiled");
    }

    // valid access
    invokeTest(m, array, index0, true);

    if (!WHITE_BOX.isMethodCompiled(m)) {
        throw new RuntimeException(m + " deoptimized on valid array access");
    }

    exception = false;
    boolean test_success = true;
    try {
        invokeTest(m, array, index1, false);
    } catch(ArrayIndexOutOfBoundsException aioob) {
        exception = true;
        System.out.println("ArrayIndexOutOfBoundsException thrown in "+name);
    }
    if (!exception) {
        System.out.println("ArrayIndexOutOfBoundsException was not thrown in "+name);
    }

    if (Platform.isServer()) {
        if (exceptionRequired == WHITE_BOX.isMethodCompiled(m)) {
            System.out.println((exceptionRequired?"Didn't deoptimized":"deoptimized") + " in "+name);
            test_success = false;
        }
    }

    if (exception != exceptionRequired) {
        System.out.println((exceptionRequired?"exception required but not thrown":"not exception required but thrown") + " in "+name);
        test_success = false;
    }

    if (!test_success) {
        success = false;
        System.out.println("TEST FAILED: "+name);
    }

}