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

The following examples show how to use com.oracle.java.testlibrary.Platform#isX86() . 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: BmiIntrinsicBase.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public boolean verifyPositive(byte[] nativeCode) {
    final int cnt = countCpuInstructions(nativeCode);
    if (Platform.isX86()) {
        return cnt >= (isLongOperation ? 2 : 1);
    } else {
        return Platform.isX64() && cnt >= 1;
    }
}
 
Example 2
Source File: SHAOptionsBase.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns warning message that should occur in VM output if an option with
 * the name {@code optionName} was turned on and CPU does not support
 * required instructions.
 *
 * @param optionName The name of the option for which warning message should
 *                   be returned.
 * @return A warning message that will be printed out to VM output if CPU
 *         instructions required by the option are not supported.
 */
protected static String getWarningForUnsupportedCPU(String optionName) {
    if (Platform.isSparc()) {
        switch (optionName) {
            case SHAOptionsBase.USE_SHA_OPTION:
                return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA1_INSTRUCTION_IS_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA256_INSTRUCTION_IS_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA512_INSTRUCTION_IS_NOT_AVAILABLE;
            default:
                throw new Error("Unexpected option " + optionName);
        }
    } else if (Platform.isX64() || Platform.isX86()) {
        switch (optionName) {
            case SHAOptionsBase.USE_SHA_OPTION:
                return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
            case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
            case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA_INTRINSICS_ARE_NOT_AVAILABLE;
            default:
                throw new Error("Unexpected option " + optionName);
        }
    } else {
        throw new Error("Support for CPUs other then X86 or SPARC is not "
                + "implemented.");
    }
}
 
Example 3
Source File: BmiIntrinsicBase.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public boolean verifyPositive(byte[] nativeCode) {
    final int cnt = countCpuInstructions(nativeCode);
    if (Platform.isX86()) {
        return cnt >= (isLongOperation ? 2 : 1);
    } else {
        return Platform.isX64() && cnt >= 1;
    }
}
 
Example 4
Source File: SHAOptionsBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns warning message that should occur in VM output if an option with
 * the name {@code optionName} was turned on and CPU does not support
 * required instructions.
 *
 * @param optionName The name of the option for which warning message should
 *                   be returned.
 * @return A warning message that will be printed out to VM output if CPU
 *         instructions required by the option are not supported.
 */
protected static String getWarningForUnsupportedCPU(String optionName) {
    if (Platform.isSparc()) {
        switch (optionName) {
            case SHAOptionsBase.USE_SHA_OPTION:
                return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA1_INSTRUCTION_IS_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA256_INSTRUCTION_IS_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA512_INSTRUCTION_IS_NOT_AVAILABLE;
            default:
                throw new Error("Unexpected option " + optionName);
        }
    } else if (Platform.isX64() || Platform.isX86()) {
        switch (optionName) {
            case SHAOptionsBase.USE_SHA_OPTION:
                return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
            case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
            case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA_INTRINSICS_ARE_NOT_AVAILABLE;
            default:
                throw new Error("Unexpected option " + optionName);
        }
    } else {
        throw new Error("Support for CPUs other then X86 or SPARC is not "
                + "implemented.");
    }
}
 
Example 5
Source File: BmiIntrinsicBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public boolean verifyPositive(byte[] nativeCode) {
    final int cnt = countCpuInstructions(nativeCode);
    if (Platform.isX86()) {
        return cnt >= (isLongOperation ? 2 : 1);
    } else {
        return Platform.isX64() && cnt >= 1;
    }
}
 
Example 6
Source File: SHAOptionsBase.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns warning message that should occur in VM output if an option with
 * the name {@code optionName} was turned on and CPU does not support
 * required instructions.
 *
 * @param optionName The name of the option for which warning message should
 *                   be returned.
 * @return A warning message that will be printed out to VM output if CPU
 *         instructions required by the option are not supported.
 */
protected static String getWarningForUnsupportedCPU(String optionName) {
    if (Platform.isSparc()) {
        switch (optionName) {
            case SHAOptionsBase.USE_SHA_OPTION:
                return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA1_INSTRUCTION_IS_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA256_INSTRUCTION_IS_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA512_INSTRUCTION_IS_NOT_AVAILABLE;
            default:
                throw new Error("Unexpected option " + optionName);
        }
    } else if (Platform.isX64() || Platform.isX86()) {
        switch (optionName) {
            case SHAOptionsBase.USE_SHA_OPTION:
                return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
            case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
            case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA_INTRINSICS_ARE_NOT_AVAILABLE;
            default:
                throw new Error("Unexpected option " + optionName);
        }
    } else {
        throw new Error("Support for CPUs other then X86 or SPARC is not "
                + "implemented.");
    }
}
 
Example 7
Source File: SHAOptionsBase.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns warning message that should occur in VM output if an option with
 * the name {@code optionName} was turned on and CPU does not support
 * required instructions.
 *
 * @param optionName The name of the option for which warning message should
 *                   be returned.
 * @return A warning message that will be printed out to VM output if CPU
 *         instructions required by the option are not supported.
 */
protected static String getWarningForUnsupportedCPU(String optionName) {
    if (Platform.isSparc()) {
        switch (optionName) {
            case SHAOptionsBase.USE_SHA_OPTION:
                return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA1_INSTRUCTION_IS_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA256_INSTRUCTION_IS_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA512_INSTRUCTION_IS_NOT_AVAILABLE;
            default:
                throw new Error("Unexpected option " + optionName);
        }
    } else if (Platform.isX64() || Platform.isX86()) {
        switch (optionName) {
            case SHAOptionsBase.USE_SHA_OPTION:
                return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
            case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
            case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA_INTRINSICS_ARE_NOT_AVAILABLE;
            default:
                throw new Error("Unexpected option " + optionName);
        }
    } else {
        throw new Error("Support for CPUs other then X86 or SPARC is not "
                + "implemented.");
    }
}
 
Example 8
Source File: BmiIntrinsicBase.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public boolean verifyPositive(byte[] nativeCode) {
    final int cnt = countCpuInstructions(nativeCode);
    if (Platform.isX86()) {
        return cnt >= (isLongOperation ? 2 : 1);
    } else {
        return Platform.isX64() && cnt >= 1;
    }
}
 
Example 9
Source File: SHAOptionsBase.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns warning message that should occur in VM output if an option with
 * the name {@code optionName} was turned on and CPU does not support
 * required instructions.
 *
 * @param optionName The name of the option for which warning message should
 *                   be returned.
 * @return A warning message that will be printed out to VM output if CPU
 *         instructions required by the option are not supported.
 */
protected static String getWarningForUnsupportedCPU(String optionName) {
    if (Platform.isSparc()) {
        switch (optionName) {
            case SHAOptionsBase.USE_SHA_OPTION:
                return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA1_INSTRUCTION_IS_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA256_INSTRUCTION_IS_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA512_INSTRUCTION_IS_NOT_AVAILABLE;
            default:
                throw new Error("Unexpected option " + optionName);
        }
    } else if (Platform.isX64() || Platform.isX86()) {
        switch (optionName) {
            case SHAOptionsBase.USE_SHA_OPTION:
                return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
            case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
            case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
            case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
                return SHAOptionsBase.SHA_INTRINSICS_ARE_NOT_AVAILABLE;
            default:
                throw new Error("Unexpected option " + optionName);
        }
    } else {
        throw new Error("Support for CPUs other then X86 or SPARC is not "
                + "implemented.");
    }
}
 
Example 10
Source File: BmiIntrinsicBase.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean verifyPositive(byte[] nativeCode) {
    final int cnt = countCpuInstructions(nativeCode);
    if (Platform.isX86()) {
        return cnt >= (isLongOperation ? 2 : 1);
    } else {
        return Platform.isX64() && cnt >= 1;
    }
}
 
Example 11
Source File: IntrinsicBase.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected boolean isIntrinsicSupported() {
    return isServerVM() && Boolean.valueOf(useMathExactIntrinsics) && (Platform.isX86() || Platform.isX64());
}
 
Example 12
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 13
Source File: IntrinsicBase.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected boolean isIntrinsicSupported() {
    return isServerVM() && Boolean.valueOf(useMathExactIntrinsics) && (Platform.isX86() || Platform.isX64());
}
 
Example 14
Source File: BmiIntrinsicBase.java    From jdk8u60 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 15
Source File: IntrinsicBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected boolean isIntrinsicSupported() {
    return isServerVM() && Boolean.valueOf(useMathExactIntrinsics) && (Platform.isX86() || Platform.isX64());
}
 
Example 16
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 17
Source File: IntrinsicBase.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected boolean isIntrinsicSupported() {
    return isServerVM() && Boolean.valueOf(useMathExactIntrinsics) && (Platform.isX86() || Platform.isX64());
}
 
Example 18
Source File: IntrinsicBase.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected boolean isIntrinsicSupported() {
    return isServerVM() && Boolean.valueOf(useMathExactIntrinsics) && (Platform.isX86() || Platform.isX64());
}
 
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: 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);
    }
}