com.oracle.java.testlibrary.Platform Java Examples
The following examples show how to use
com.oracle.java.testlibrary.Platform.
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: TestMutuallyExclusivePlatformPredicates.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Verifies that all predicates defined in * {@link com.oracle.java.testlibrary.Platform} were either tested or * explicitly ignored. */ private static void verifyCoverage() { Set<String> allMethods = new HashSet<>(); for (MethodGroup group : MethodGroup.values()) { allMethods.addAll(group.methodNames); } for (Method m : Platform.class.getMethods()) { if (m.getParameterCount() == 0 && m.getReturnType() == boolean.class) { Asserts.assertTrue(allMethods.contains(m.getName()), "All Platform's methods with signature '():Z' should " + "be tested "); } } }
Example #2
Source File: TestMutuallyExclusivePlatformPredicates.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Verifies that all predicates defined in * {@link com.oracle.java.testlibrary.Platform} were either tested or * explicitly ignored. */ private static void verifyCoverage() { Set<String> allMethods = new HashSet<>(); for (MethodGroup group : MethodGroup.values()) { allMethods.addAll(group.methodNames); } for (Method m : Platform.class.getMethods()) { if (m.getParameterCount() == 0 && m.getReturnType() == boolean.class) { Asserts.assertTrue(allMethods.contains(m.getName()), "All Platform's methods with signature '():Z' should " + "be tested "); } } }
Example #3
Source File: TestMutuallyExclusivePlatformPredicates.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Verifies that all predicates defined in * {@link com.oracle.java.testlibrary.Platform} were either tested or * explicitly ignored. */ private static void verifyCoverage() { Set<String> allMethods = new HashSet<>(); for (MethodGroup group : MethodGroup.values()) { allMethods.addAll(group.methodNames); } for (Method m : Platform.class.getMethods()) { if (m.getParameterCount() == 0 && m.getReturnType() == boolean.class) { Asserts.assertTrue(allMethods.contains(m.getName()), "All Platform's methods with signature '():Z' should " + "be tested "); } } }
Example #4
Source File: DockerTestUtils.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Build a docker image that contains JDK under test. * The jdk will be placed under the "/jdk/" folder inside the docker file system. * * @param imageName name of the image to be created, including version tag * @param dockerfile name of the dockerfile residing in the test source; * we check for a platform specific dockerfile as well * and use this one in case it exists * @param buildDirName name of the docker build/staging directory, which will * be created in the jtreg's scratch folder * @throws Exception */ public static void buildJdkDockerImage(String imageName, String dockerfile, String buildDirName) throws Exception { Path buildDir = Paths.get(".", buildDirName); if (Files.exists(buildDir)) { throw new RuntimeException("The docker build directory already exists: " + buildDir); } // check for the existance of a platform specific docker file as well String platformSpecificDockerfile = dockerfile + "-" + Platform.getOsArch(); if (Files.exists(Paths.get(Utils.TEST_SRC, platformSpecificDockerfile))) { dockerfile = platformSpecificDockerfile; } Path jdkSrcDir = Paths.get(Utils.TEST_JDK); Path jdkDstDir = buildDir.resolve("jdk"); Files.createDirectories(jdkDstDir); // Copy JDK-under-test tree to the docker build directory. // This step is required for building a docker image. Files.walkFileTree(jdkSrcDir, new CopyFileVisitor(jdkSrcDir, jdkDstDir)); buildDockerImage(imageName, Paths.get(Utils.TEST_SRC, dockerfile), buildDir); }
Example #5
Source File: UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU( String optionName) { // execute test case on SPARC CPU that support any sha* instructions, // but does not support sha* instruction required by the tested option. super(optionName, new AndPredicate(Platform::isSparc, new AndPredicate( IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE, new NotPredicate(SHAOptionsBase.getPredicateForOption( optionName))))); }
Example #6
Source File: TestLargePagesFlags.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String [] args) throws Exception { if (!Platform.isLinux()) { System.out.println("Skipping. TestLargePagesFlags has only been implemented for Linux."); return; } testUseTransparentHugePages(); testUseHugeTLBFS(); testUseSHM(); testCombinations(); }
Example #7
Source File: UseSHASpecificTestCaseForUnsupportedSparcCPU.java From hottub with GNU General Public License v2.0 | 5 votes |
public UseSHASpecificTestCaseForUnsupportedSparcCPU(String optionName) { super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(Platform::isSparc, new NotPredicate( IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE))); Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION, "Test case should be used for " + SHAOptionsBase.USE_SHA_OPTION + " option only."); }
Example #8
Source File: SHAOptionsBase.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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 #9
Source File: TestLargePageSizeInBytes.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { if (!Platform.isSolaris()) { // We only use the syscall mencntl on Solaris return; } testLargePageSizeInBytes(4 * M); testLargePageSizeInBytes(256 * M); testLargePageSizeInBytes(512 * M); testLargePageSizeInBytes(2 * G); }
Example #10
Source File: UseSHASpecificTestCaseForSupportedSparcCPU.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public UseSHASpecificTestCaseForSupportedSparcCPU(String optionName) { super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(Platform::isSparc, IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE)); Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION, "Test case should be used for " + SHAOptionsBase.USE_SHA_OPTION + " option only."); }
Example #11
Source File: TestLargePagesFlags.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String [] args) throws Exception { if (!Platform.isLinux()) { System.out.println("Skipping. TestLargePagesFlags has only been implemented for Linux."); return; } testUseTransparentHugePages(); testUseHugeTLBFS(); testUseSHM(); testCombinations(); }
Example #12
Source File: Test8028623.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main (String[] args) { System.out.println(\u00CB); try { if (!Platform.shouldSAAttach()) { System.out.println("SA attach not expected to work - test skipped."); return; } int pid = ProcessTools.getProcessId(); JDKToolLauncher jmap = JDKToolLauncher.create("jmap") .addToolArg("-F") .addToolArg("-dump:live,format=b,file=" + dumpFile) .addToolArg(Integer.toString(pid)); ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); OutputBuffer output = ProcessTools.getOutput(pb); Process p = pb.start(); int e = p.waitFor(); System.out.println("stdout:"); System.out.println(output.getStdout()); System.out.println("stderr:"); System.out.println(output.getStderr()); if (e != 0) { throw new RuntimeException("jmap returns: " + e); } if (! new File(dumpFile).exists()) { throw new RuntimeException("dump file NOT created: '" + dumpFile + "'"); } } catch (Throwable t) { t.printStackTrace(); throw new RuntimeException("Test failed with: " + t); } }
Example #13
Source File: BmiIntrinsicBase.java From hottub with GNU General Public License v2.0 | 5 votes |
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 #14
Source File: TestLargePageSizeInBytes.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { if (!Platform.isSolaris()) { // We only use the syscall mencntl on Solaris return; } testLargePageSizeInBytes(4 * M); testLargePageSizeInBytes(256 * M); testLargePageSizeInBytes(512 * M); testLargePageSizeInBytes(2 * G); }
Example #15
Source File: SHAOptionsBase.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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 #16
Source File: SHAOptionsBase.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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 #17
Source File: TZcntTestL.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected TZcntTestL(Method method) { super(method); isLongOperation = true; if (Platform.isX64()) { instrMask = new byte[]{(byte) 0xFF, (byte) 0x00, (byte) 0xFF, (byte) 0xFF}; instrPattern = new byte[]{(byte) 0xF3, (byte) 0x00, (byte) 0x0F, (byte) 0xBC}; } isLongOperation = true; }
Example #18
Source File: UseSHASpecificTestCaseForSupportedSparcCPU.java From hottub with GNU General Public License v2.0 | 5 votes |
public UseSHASpecificTestCaseForSupportedSparcCPU(String optionName) { super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(Platform::isSparc, IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE)); Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION, "Test case should be used for " + SHAOptionsBase.USE_SHA_OPTION + " option only."); }
Example #19
Source File: TestCapacityUntilGCWrapAround.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { if (Platform.is32bit()) { WhiteBox wb = WhiteBox.getWhiteBox(); long before = wb.metaspaceCapacityUntilGC(); // Now force possible overflow of capacity_until_GC. long after = wb.incMetaspaceCapacityUntilGC(MAX_UINT); Asserts.assertGTE(after, before, "Increasing with MAX_UINT should not cause wrap around: " + after + " < " + before); Asserts.assertLTE(after, MAX_UINT, "Increasing with MAX_UINT should not cause value larger than MAX_UINT:" + after); } }
Example #20
Source File: CorrectnessTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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 #21
Source File: BmiIntrinsicBase.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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 #22
Source File: BmiIntrinsicBase.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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 #23
Source File: LZcntTestL.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected LZcntTestL(Method method) { super(method); isLongOperation = true; if (Platform.isX64()) { instrMask = new byte[]{(byte) 0xFF, (byte) 0x00, (byte) 0xFF, (byte) 0xFF}; instrPattern = new byte[]{(byte) 0xF3, (byte) 0x00, (byte) 0x0F, (byte) 0xBD}; } }
Example #24
Source File: Test8028623.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main (String[] args) { System.out.println(\u00CB); try { if (!Platform.shouldSAAttach()) { System.out.println("SA attach not expected to work - test skipped."); return; } int pid = ProcessTools.getProcessId(); JDKToolLauncher jmap = JDKToolLauncher.create("jmap") .addToolArg("-F") .addToolArg("-dump:live,format=b,file=" + dumpFile) .addToolArg(Integer.toString(pid)); ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); OutputBuffer output = ProcessTools.getOutput(pb); Process p = pb.start(); int e = p.waitFor(); System.out.println("stdout:"); System.out.println(output.getStdout()); System.out.println("stderr:"); System.out.println(output.getStderr()); if (e != 0) { throw new RuntimeException("jmap returns: " + e); } if (! new File(dumpFile).exists()) { throw new RuntimeException("dump file NOT created: '" + dumpFile + "'"); } } catch (Throwable t) { t.printStackTrace(); throw new RuntimeException("Test failed with: " + t); } }
Example #25
Source File: Test8028623.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main (String[] args) { System.out.println(\u00CB); try { if (!Platform.shouldSAAttach()) { System.out.println("SA attach not expected to work - test skipped."); return; } int pid = ProcessTools.getProcessId(); JDKToolLauncher jmap = JDKToolLauncher.create("jmap") .addToolArg("-F") .addToolArg("-dump:live,format=b,file=" + dumpFile) .addToolArg(Integer.toString(pid)); ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); OutputBuffer output = ProcessTools.getOutput(pb); Process p = pb.start(); int e = p.waitFor(); System.out.println("stdout:"); System.out.println(output.getStdout()); System.out.println("stderr:"); System.out.println(output.getStderr()); if (e != 0) { throw new RuntimeException("jmap returns: " + e); } if (! new File(dumpFile).exists()) { throw new RuntimeException("dump file NOT created: '" + dumpFile + "'"); } } catch (Throwable t) { t.printStackTrace(); throw new RuntimeException("Test failed with: " + t); } }
Example #26
Source File: JMapHProfLargeHeapTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { // If we are on MacOSX, test if JMap tool is signed, otherwise return // since test will fail with privilege error. if (Platform.isOSX()) { String jmapToolPath = JDKToolFinder.getTestJDKTool("jmap"); ProcessBuilder codesignProcessBuilder = new ProcessBuilder( "codesign", "-v", jmapToolPath); Process codesignProcess = codesignProcessBuilder.start(); OutputAnalyzer analyser = new OutputAnalyzer(codesignProcess); try { analyser.shouldNotContain("code object is not signed at all"); System.out.println("Signed jmap found at: " + jmapToolPath); } catch (Exception e) { // Abort since we can't know if the test will work System.out .println("Test aborted since we are on MacOSX and the jmap tool is not signed."); return; } } // All heap dumps should create 1.0.2 file format testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_2); /** * This test was deliberately commented out since the test system lacks * support to handle the requirements for this kind of heap size in a * good way. If or when it becomes possible to run this kind of tests in * the test environment the test should be enabled again. * */ // Large heap 2,2 gigabytes, should create 1.0.2 file format // testHProfFileFormat("-Xmx4g", 2 * G + 2 * M, HPROF_HEADER_1_0_2); }
Example #27
Source File: UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU( String optionName) { // execute test case on SPARC CPU that support any sha* instructions, // but does not support sha* instruction required by the tested option. super(optionName, new AndPredicate(Platform::isSparc, new AndPredicate( IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE, new NotPredicate(SHAOptionsBase.getPredicateForOption( optionName))))); }
Example #28
Source File: TestShrinkAuxiliaryData.java From hottub with GNU General Public License v2.0 | 5 votes |
protected void test() throws Exception { ArrayList<String> vmOpts = new ArrayList(); Collections.addAll(vmOpts, initialOpts); int maxCacheSize = Math.max(0, Math.min(31, getMaxCacheSize())); if (maxCacheSize < hotCardTableSize) { System.out.format("Skiping test for %d cache size due max cache size %d", hotCardTableSize, maxCacheSize ); return; } printTestInfo(maxCacheSize); vmOpts.add("-XX:G1ConcRSLogCacheSize=" + hotCardTableSize); vmOpts.addAll(Arrays.asList(Utils.getTestJavaOpts())); // for 32 bits ObjectAlignmentInBytes is not a option if (Platform.is32bit()) { ArrayList<String> vmOptsWithoutAlign = new ArrayList(vmOpts); vmOptsWithoutAlign.add(ShrinkAuxiliaryDataTest.class.getName()); performTest(vmOptsWithoutAlign); return; } for (int alignment = 3; alignment <= 8; alignment++) { ArrayList<String> vmOptsWithAlign = new ArrayList(vmOpts); vmOptsWithAlign.add("-XX:ObjectAlignmentInBytes=" + (int) Math.pow(2, alignment)); vmOptsWithAlign.add(ShrinkAuxiliaryDataTest.class.getName()); performTest(vmOptsWithAlign); } }
Example #29
Source File: UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java From hottub with GNU General Public License v2.0 | 5 votes |
public UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU( String optionName) { // execute test case on SPARC CPU that support any sha* instructions, // but does not support sha* instruction required by the tested option. super(optionName, new AndPredicate(Platform::isSparc, new AndPredicate( IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE, new NotPredicate(SHAOptionsBase.getPredicateForOption( optionName))))); }
Example #30
Source File: SHAOptionsBase.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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."); } }