Java Code Examples for jdk.test.lib.Platform#isServer()
The following examples show how to use
jdk.test.lib.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: TestAESIntrinsicsOnSupportedConfig.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Test checks following situation: <br/> * UseAES flag is set to true, TestAESMain is executed <br/> * Expected result: UseAESIntrinsics flag is set to true <br/> * If vm type is server then output should contain intrinsics usage <br/> * * @throws Throwable */ private void testUseAES() throws Throwable { OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm( prepareArguments(prepareBooleanFlag(AESIntrinsicsBase .USE_AES, true))); final String errorMessage = "Case testUseAES failed"; if (Platform.isServer() && !Platform.isEmulatedClient()) { verifyOutput(new String[]{AESIntrinsicsBase.CIPHER_INTRINSIC, AESIntrinsicsBase.AES_INTRINSIC}, null, errorMessage, outputAnalyzer); } else { verifyOutput(null, new String[]{AESIntrinsicsBase.CIPHER_INTRINSIC, AESIntrinsicsBase.AES_INTRINSIC}, errorMessage, outputAnalyzer); } verifyOptionValue(AESIntrinsicsBase.USE_AES, "true", errorMessage, outputAnalyzer); verifyOptionValue(AESIntrinsicsBase.USE_AES_INTRINSICS, "true", errorMessage, outputAnalyzer); }
Example 2
Source File: TestJFRIntrinsic.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Returns available compilation levels * * @return int array with compilation levels */ public static int[] getAvailableCompilationLevels() { if (!WhiteBox.getWhiteBox().getBooleanVMFlag("UseCompiler")) { return new int[0]; } if (WhiteBox.getWhiteBox().getBooleanVMFlag("TieredCompilation")) { Long flagValue = WhiteBox.getWhiteBox() .getIntxVMFlag("TieredStopAtLevel"); int maxLevel = flagValue.intValue(); return IntStream.rangeClosed(1, maxLevel).toArray(); } else { if (Platform.isServer() && !Platform.isEmulatedClient()) { return new int[]{4}; } if (Platform.isClient() || Platform.isMinimal() || Platform.isEmulatedClient()) { return new int[]{1}; } } return new int[0]; }
Example 3
Source File: CompilerDirectivesDCMDTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void run(CommandExecutor executor) { if (Platform.isServer() && !Platform.isEmulatedClient()) { filename = System.getProperty("test.src", ".") + File.separator + "control2.txt"; } else { filename = System.getProperty("test.src", ".") + File.separator + "control1.txt"; } testPrintCommand(executor); testAddAndRemoveCommand(executor); }
Example 4
Source File: TestPrintPreciseRTMLockingStatisticsBase.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override protected void verifyOptionValues() throws Throwable { if (Platform.isServer()) { // Verify default value CommandLineOptionTest.verifyOptionValueForSameVM(optionName, TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE, String.format("Option '%s' should have '%s' default value", optionName, TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE), CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS); } }
Example 5
Source File: RTMGenericCommandLineOptionTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void runTestCases() throws Throwable { if (Platform.isX86() || Platform.isX64() || Platform.isPPC()) { if (Platform.isServer()) { runX86SupportedVMTestCases(); } else { runX86UnsupportedVMTestCases(); } } else { runNonX86TestCases(); } }
Example 6
Source File: UnsafeGetStableArrayElement.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { if (!Platform.isServer() || Platform.isEmulatedClient()) { throw new Error("TESTBUG: Not server mode"); } testUnsafeAccess(); System.out.println("TEST PASSED"); }
Example 7
Source File: TestUnstableIfTrap.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static boolean isMethodCompiledByC2(Method m) { boolean isTiered = WB.getBooleanVMFlag("TieredCompilation"); boolean isMethodCompiled = WB.isMethodCompiled(m); boolean isMethodCompiledAtMaxTier = WB.getMethodCompilationLevel(m) == MAX_TIER; return Platform.isServer() && !Platform.isEmulatedClient() && isMethodCompiled && (!isTiered || isMethodCompiledAtMaxTier); }
Example 8
Source File: BmiIntrinsicBase.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@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()) { throw new Error("TESTBUG: Not server VM"); } if (Platform.isInt()) { throw new Error("TESTBUG: test can not be run in interpreter"); } 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()); if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX || Platform.isEmulatedClient()) { System.out.println("TieredStopAtLevel value (" + TIERED_STOP_AT_LEVEL + ") is too low, test SKIPPED"); return; } deoptimize(); compileAtLevelAndCheck(CompilerWhiteBoxTest.COMP_LEVEL_MAX); }
Example 9
Source File: CommandLineOptionTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * @return addtional VMoptions(Emulated related) required to start a new VM with the same type as current. */ private static String getVMTypeOptionForEmulated() { if (Platform.isServer() && !Platform.isEmulatedClient()) { return "-XX:-NeverActAsServerClassMachine"; } else if (Platform.isEmulatedClient()) { return "-XX:+NeverActAsServerClassMachine"; } return null; }
Example 10
Source File: CommandLineOptionTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * @return option required to start a new VM with the same type as current. * @throws RuntimeException when VM type is unknown. */ private static String getVMTypeOption() { if (Platform.isServer()) { return "-server"; } else if (Platform.isClient()) { return "-client"; } else if (Platform.isMinimal()) { return "-minimal"; } else if (Platform.isGraal()) { return "-graal"; } throw new RuntimeException("Unknown VM mode."); }
Example 11
Source File: TestCompilerInlining.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static int[] determineAvailableLevels() { if (WHITE_BOX.getBooleanVMFlag("TieredCompilation")) { return IntStream.rangeClosed(LEVEL_SIMPLE, WHITE_BOX.getIntxVMFlag("TieredStopAtLevel").intValue()).toArray(); } if (Platform.isServer() && !Platform.isEmulatedClient()) { return new int[] { LEVEL_FULL_OPTIMIZATION }; } if (Platform.isClient() || Platform.isEmulatedClient()) { return new int[] { LEVEL_SIMPLE }; } throw new Error("TESTBUG: unknown VM"); }
Example 12
Source File: TestThrowableInstrumentation.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { // Compile Throwable::<clinit> with C1 (if available) if (!WHITE_BOX.enqueueInitializerForCompilation(java.lang.Throwable.class, COMP_LEVEL_SIMPLE)) { if (!Platform.isServer() || isTieredCompilationEnabled() || Platform.isEmulatedClient()) { throw new RuntimeException("Unable to compile Throwable::<clinit> with C1"); } } }
Example 13
Source File: MontgomeryMultiplyTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String args[]) { if (!Platform.isServer() || Platform.isEmulatedClient()) { throw new Error("TESTBUG: Not server mode"); } if (wb.isIntrinsicAvailable(getExecutable(true), CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) && wb.isIntrinsicAvailable(getExecutable(false), CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION)) { try { new MontgomeryMultiplyTest().testMontgomeryMultiplyChecks(); new MontgomeryMultiplyTest().testResultValues(); } catch (Throwable ex) { throw new RuntimeException(ex); } } }
Example 14
Source File: CommandLineOptionTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * @return addtional VMoptions(Emulated related) required to start a new VM with the same type as current. */ private static String getVMTypeOptionForEmulated() { if (Platform.isServer() && !Platform.isEmulatedClient()) { return "-XX:-NeverActAsServerClassMachine"; } else if (Platform.isEmulatedClient()) { return "-XX:+NeverActAsServerClassMachine"; } return null; }
Example 15
Source File: CommandLineOptionTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * @return option required to start a new VM with the same type as current. * @throws RuntimeException when VM type is unknown. */ private static String getVMTypeOption() { if (Platform.isServer()) { return "-server"; } else if (Platform.isClient()) { return "-client"; } else if (Platform.isMinimal()) { return "-minimal"; } else if (Platform.isGraal()) { return "-graal"; } throw new RuntimeException("Unknown VM mode."); }
Example 16
Source File: TestCompilerInlining.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static int[] determineAvailableLevels() { if (WHITE_BOX.getBooleanVMFlag("TieredCompilation")) { return IntStream.rangeClosed(LEVEL_SIMPLE, WHITE_BOX.getIntxVMFlag("TieredStopAtLevel").intValue()).toArray(); } if (Platform.isServer() && !Platform.isEmulatedClient()) { return new int[] { LEVEL_FULL_OPTIMIZATION }; } if (Platform.isClient() || Platform.isEmulatedClient()) { return new int[] { LEVEL_SIMPLE }; } throw new Error("TESTBUG: unknown VM"); }
Example 17
Source File: TestThrowableInstrumentation.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { // Compile Throwable::<clinit> with C1 (if available) if (!WHITE_BOX.enqueueInitializerForCompilation(java.lang.Throwable.class, COMP_LEVEL_SIMPLE)) { if (!Platform.isServer() || isTieredCompilationEnabled() || Platform.isEmulatedClient()) { throw new RuntimeException("Unable to compile Throwable::<clinit> with C1"); } } }
Example 18
Source File: IsMethodCompilableTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * 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() || Platform.isEmulatedClient()) { throw new Error("TESTBUG: Not server mode"); } 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 19
Source File: CastNullCheckDroppingsTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { if (!Platform.isServer() || Platform.isEmulatedClient()) { throw new Error("TESTBUG: Not server mode"); } // Make sure background compilation is disabled if (WHITE_BOX.getBooleanVMFlag("BackgroundCompilation")) { throw new Error("TESTBUG: Background compilation enabled"); } // Make sure Tiered compilation is disabled if (WHITE_BOX.getBooleanVMFlag("TieredCompilation")) { throw new Error("TESTBUG: Tiered compilation enabled"); } Method methodClassCast = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCast", String.class); Method methodMHCast = CastNullCheckDroppingsTest.class.getDeclaredMethod("testMHCast", String.class); Method methodMHSetter = CastNullCheckDroppingsTest.class.getDeclaredMethod("testMHSetter", String.class); Method methodFunction = CastNullCheckDroppingsTest.class.getDeclaredMethod("testFunction", String.class); CastNullCheckDroppingsTest t = new CastNullCheckDroppingsTest(); t.runTest(methodClassCast, false); t.runTest(methodMHCast, false); t.runTest(methodMHSetter, false); t.runTest(methodFunction, false); // Edge cases Method methodClassCastNull = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCastNull", String.class); Method methodNullClassCast = CastNullCheckDroppingsTest.class.getDeclaredMethod("testNullClassCast", String.class); Method methodClassCastObj = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCastObj", Object.class); Method methodObjClassCast = CastNullCheckDroppingsTest.class.getDeclaredMethod("testObjClassCast", String.class); Method methodVarClassCast = CastNullCheckDroppingsTest.class.getDeclaredMethod("testVarClassCast", String.class); Method methodClassCastInt = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCastInt", Object.class); Method methodIntClassCast = CastNullCheckDroppingsTest.class.getDeclaredMethod("testIntClassCast", Object.class); Method methodClassCastint = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCastint", Object.class); Method methodintClassCast = CastNullCheckDroppingsTest.class.getDeclaredMethod("testintClassCast", Object.class); Method methodClassCastPrim = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCastPrim", Object.class); Method methodPrimClassCast = CastNullCheckDroppingsTest.class.getDeclaredMethod("testPrimClassCast", Object.class); t.runTest(methodClassCastNull, false); t.runTest(methodNullClassCast, false); t.runTest(methodClassCastObj, false); t.runTest(methodObjClassCast, true); t.runTest(methodVarClassCast, true); t.runTest(methodClassCastInt, false); t.runTest(methodIntClassCast, true); t.runTest(methodClassCastint, false); t.runTest(methodintClassCast, false); t.runTest(methodClassCastPrim, false); t.runTest(methodPrimClassCast, true); }
Example 20
Source File: TestSegmentedCodeCacheOption.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public boolean isApplicable() { return Platform.isServer() && Platform.isTieredSupported(); }