8166002: Emulate client build on platforms with reduced virtual address space

The default VM ergonomics on Windows/x86 (32-bit) are changed to client like.

Reviewed-by: kvn, iveresov
This commit is contained in:
Jamsheed Mohammed C M 2017-01-17 21:38:07 -08:00
parent f02cb33818
commit 197ce5bafa
57 changed files with 261 additions and 124 deletions
hotspot
src/share/vm
test

@ -23,6 +23,8 @@
*/
#include "precompiled.hpp"
#include "runtime/globals.hpp"
#include "runtime/globals_extension.hpp"
#include "compiler/compilerDefinitions.hpp"
const char* compilertype2name_tab[compiler_number_of_types] = {
@ -32,3 +34,80 @@ const char* compilertype2name_tab[compiler_number_of_types] = {
"jvmci",
"shark"
};
#if defined(COMPILER2) || defined(SHARK)
CompLevel CompLevel_highest_tier = CompLevel_full_optimization; // pure C2 and tiered or JVMCI and tiered
#elif defined(COMPILER1)
CompLevel CompLevel_highest_tier = CompLevel_simple; // pure C1 or JVMCI
#else
CompLevel CompLevel_highest_tier = CompLevel_none;
#endif
#if defined(TIERED)
CompLevel CompLevel_initial_compile = CompLevel_full_profile; // tiered
#elif defined(COMPILER1) || INCLUDE_JVMCI
CompLevel CompLevel_initial_compile = CompLevel_simple; // pure C1 or JVMCI
#elif defined(COMPILER2) || defined(SHARK)
CompLevel CompLevel_initial_compile = CompLevel_full_optimization; // pure C2
#else
CompLevel CompLevel_initial_compile = CompLevel_none;
#endif
#if defined(COMPILER2)
CompMode Compilation_mode = CompMode_server;
#elif defined(COMPILER1)
CompMode Compilation_mode = CompMode_client;
#else
CompMode Compilation_mode = CompMode_none;
#endif
#ifdef TIERED
void set_client_compilation_mode() {
Compilation_mode = CompMode_client;
CompLevel_highest_tier = CompLevel_simple;
CompLevel_initial_compile = CompLevel_simple;
FLAG_SET_ERGO(bool, TieredCompilation, false);
FLAG_SET_ERGO(bool, ProfileInterpreter, false);
FLAG_SET_ERGO(bool, NeverActAsServerClassMachine, true);
#if INCLUDE_JVMCI
FLAG_SET_ERGO(bool, EnableJVMCI, false);
FLAG_SET_ERGO(bool, UseJVMCICompiler, false);
#endif
#if INCLUDE_AOT
FLAG_SET_ERGO(bool, UseAOT, false);
#endif
if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {
FLAG_SET_ERGO(uintx, InitialCodeCacheSize, 160*K);
}
if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
FLAG_SET_ERGO(uintx, ReservedCodeCacheSize, 32*M);
}
if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, 27*M);
}
if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {
FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, 0);
}
if (FLAG_IS_DEFAULT(NonNMethodCodeHeapSize)) {
FLAG_SET_ERGO(uintx, NonNMethodCodeHeapSize, 5*M);
}
if (FLAG_IS_DEFAULT(CodeCacheExpansionSize)) {
FLAG_SET_ERGO(uintx, CodeCacheExpansionSize, 32*K);
}
if (FLAG_IS_DEFAULT(MetaspaceSize)) {
FLAG_SET_ERGO(size_t, MetaspaceSize, 12*M);
}
if (FLAG_IS_DEFAULT(MaxRAM)) {
FLAG_SET_ERGO(uint64_t, MaxRAM, 1ULL*G);
}
if (FLAG_IS_DEFAULT(CompileThreshold)) {
FLAG_SET_ERGO(intx, CompileThreshold, 1500);
}
if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) {
FLAG_SET_ERGO(intx, OnStackReplacePercentage, 933);
}
if (FLAG_IS_DEFAULT(CICompilerCount)) {
FLAG_SET_ERGO(intx, CICompilerCount, 1);
}
}
#endif // TIERED

@ -54,27 +54,30 @@ enum CompLevel {
CompLevel_simple = 1, // C1
CompLevel_limited_profile = 2, // C1, invocation & backedge counters
CompLevel_full_profile = 3, // C1, invocation & backedge counters + mdo
CompLevel_full_optimization = 4, // C2, Shark or JVMCI
#if defined(COMPILER2) || defined(SHARK)
CompLevel_highest_tier = CompLevel_full_optimization, // pure C2 and tiered or JVMCI and tiered
#elif defined(COMPILER1)
CompLevel_highest_tier = CompLevel_simple, // pure C1 or JVMCI
#else
CompLevel_highest_tier = CompLevel_none,
#endif
#if defined(TIERED)
CompLevel_initial_compile = CompLevel_full_profile // tiered
#elif defined(COMPILER1) || INCLUDE_JVMCI
CompLevel_initial_compile = CompLevel_simple // pure C1 or JVMCI
#elif defined(COMPILER2) || defined(SHARK)
CompLevel_initial_compile = CompLevel_full_optimization // pure C2
#else
CompLevel_initial_compile = CompLevel_none
#endif
CompLevel_full_optimization = 4 // C2, Shark or JVMCI
};
extern CompLevel CompLevel_highest_tier;
extern CompLevel CompLevel_initial_compile;
enum CompMode {
CompMode_none = 0,
CompMode_client = 1,
CompMode_server = 2
};
extern CompMode Compilation_mode;
inline bool is_server_compilation_mode_vm() {
return Compilation_mode == CompMode_server;
}
inline bool is_client_compilation_mode_vm() {
return Compilation_mode == CompMode_client;
}
extern void set_client_compilation_mode();
inline bool is_c1_compile(int comp_level) {
return comp_level > CompLevel_none && comp_level < CompLevel_full_optimization;
}

@ -445,7 +445,9 @@ void DirectivesStack::init() {
_default_directives->_c1_store->EnableOption = true;
#endif
#ifdef COMPILER2
_default_directives->_c2_store->EnableOption = true;
if (is_server_compilation_mode_vm()) {
_default_directives->_c2_store->EnableOption = true;
}
#endif
assert(error_msg == NULL, "Must succeed.");
push(_default_directives);

@ -233,7 +233,7 @@ void CollectedHeap::pre_initialize() {
// Used for ReduceInitialCardMarks (when COMPILER2 is used);
// otherwise remains unused.
#if defined(COMPILER2) || INCLUDE_JVMCI
_defer_initial_card_mark = ReduceInitialCardMarks && can_elide_tlab_store_barriers()
_defer_initial_card_mark = is_server_compilation_mode_vm() && ReduceInitialCardMarks && can_elide_tlab_store_barriers()
&& (DeferInitialCardMark || card_mark_must_follow_store());
#else
assert(_defer_initial_card_mark == false, "Who would set it?");

@ -1209,7 +1209,7 @@ void GenCollectedHeap::gc_epilogue(bool full) {
#if defined(COMPILER2) || INCLUDE_JVMCI
assert(DerivedPointerTable::is_empty(), "derived pointer present");
size_t actual_gap = pointer_delta((HeapWord*) (max_uintx-3), *(end_addr()));
guarantee(actual_gap > (size_t)FastAllocateSizeLimit, "inline allocation wraps");
guarantee(is_client_compilation_mode_vm() || actual_gap > (size_t)FastAllocateSizeLimit, "inline allocation wraps");
#endif /* COMPILER2 || INCLUDE_JVMCI */
resize_all_tlabs();

@ -57,11 +57,11 @@ void ReferenceProcessor::init_statics() {
java_lang_ref_SoftReference::set_clock(_soft_ref_timestamp_clock);
_always_clear_soft_ref_policy = new AlwaysClearPolicy();
#if defined(COMPILER2) || INCLUDE_JVMCI
_default_soft_ref_policy = new LRUMaxHeapPolicy();
#else
_default_soft_ref_policy = new LRUCurrentHeapPolicy();
#endif
if (is_server_compilation_mode_vm()) {
_default_soft_ref_policy = new LRUMaxHeapPolicy();
} else {
_default_soft_ref_policy = new LRUCurrentHeapPolicy();
}
if (_always_clear_soft_ref_policy == NULL || _default_soft_ref_policy == NULL) {
vm_exit_during_initialization("Could not allocate reference policy object");
}

@ -233,9 +233,11 @@ void ThreadLocalAllocBuffer::startup_initialization() {
// If the C2 compiler is not present, no space is reserved.
// +1 for rounding up to next cache line, +1 to be safe
int lines = MAX2(AllocatePrefetchLines, AllocateInstancePrefetchLines) + 2;
_reserve_for_allocation_prefetch = (AllocatePrefetchDistance + AllocatePrefetchStepSize * lines) /
(int)HeapWordSize;
if (is_server_compilation_mode_vm()) {
int lines = MAX2(AllocatePrefetchLines, AllocateInstancePrefetchLines) + 2;
_reserve_for_allocation_prefetch = (AllocatePrefetchDistance + AllocatePrefetchStepSize * lines) /
(int)HeapWordSize;
}
#endif
// During jvm startup, the main (primordial) thread is initialized

@ -717,9 +717,9 @@ MethodData* MethodData::allocate(ClassLoaderData* loader_data, const methodHandl
}
int MethodData::bytecode_cell_count(Bytecodes::Code code) {
#if defined(COMPILER1) && !(defined(COMPILER2) || INCLUDE_JVMCI)
return no_profile_data;
#else
if (is_client_compilation_mode_vm()) {
return no_profile_data;
}
switch (code) {
case Bytecodes::_checkcast:
case Bytecodes::_instanceof:
@ -778,7 +778,6 @@ int MethodData::bytecode_cell_count(Bytecodes::Code code) {
return variable_cell_count;
}
return no_profile_data;
#endif
}
// Compute the size of the profiling information corresponding to
@ -840,7 +839,9 @@ bool MethodData::is_speculative_trap_bytecode(Bytecodes::Code code) {
case Bytecodes::_ifnonnull:
case Bytecodes::_invokestatic:
#ifdef COMPILER2
return UseTypeSpeculation;
if (is_server_compilation_mode_vm()) {
return UseTypeSpeculation;
}
#endif
default:
return false;
@ -942,9 +943,9 @@ int MethodData::compute_allocation_size_in_words(const methodHandle& method) {
// the segment in bytes.
int MethodData::initialize_data(BytecodeStream* stream,
int data_index) {
#if defined(COMPILER1) && !(defined(COMPILER2) || INCLUDE_JVMCI)
return 0;
#else
if (is_client_compilation_mode_vm()) {
return 0;
}
int cell_count = -1;
int tag = DataLayout::no_tag;
DataLayout* data_layout = data_layout_at(data_index);
@ -1061,7 +1062,6 @@ int MethodData::initialize_data(BytecodeStream* stream,
assert(!bytecode_has_profile(c), "agree w/ !BHP");
return 0;
}
#endif
}
// Get the data at an arbitrary (sort of) data index.

@ -659,6 +659,9 @@ WB_ENTRY(jboolean, WB_IsMethodCompiled(JNIEnv* env, jobject o, jobject method, j
WB_END
WB_ENTRY(jboolean, WB_IsMethodCompilable(JNIEnv* env, jobject o, jobject method, jint comp_level, jboolean is_osr))
if (method == NULL || comp_level > MIN2((CompLevel) TieredStopAtLevel, CompLevel_highest_tier)) {
return false;
}
jmethodID jmid = reflected_method_to_jmid(thread, env, method);
CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
MutexLockerEx mu(Compile_lock);

@ -1819,6 +1819,25 @@ bool Arguments::gc_selected() {
#endif // INCLUDE_ALL_GCS
}
#ifdef TIERED
bool Arguments::compilation_mode_selected() {
return !FLAG_IS_DEFAULT(TieredCompilation) || !FLAG_IS_DEFAULT(TieredStopAtLevel) ||
!FLAG_IS_DEFAULT(UseAOT) JVMCI_ONLY(|| !FLAG_IS_DEFAULT(EnableJVMCI) || !FLAG_IS_DEFAULT(UseJVMCICompiler));
}
void Arguments::select_compilation_mode_ergonomically() {
#if defined(_WINDOWS) && !defined(_LP64)
if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) {
NeverActAsServerClassMachine = true;
}
#endif
if (NeverActAsServerClassMachine) {
set_client_compilation_mode();
}
}
#endif //TIERED
void Arguments::select_gc_ergonomically() {
#if INCLUDE_ALL_GCS
if (os::is_server_class_machine()) {
@ -1883,6 +1902,11 @@ void Arguments::set_jvmci_specific_flags() {
#endif
void Arguments::set_ergonomics_flags() {
#ifdef TIERED
if (!compilation_mode_selected()) {
select_compilation_mode_ergonomically();
}
#endif
select_gc();
#if defined(COMPILER2) || INCLUDE_JVMCI
@ -1891,7 +1915,7 @@ void Arguments::set_ergonomics_flags() {
// server performance. When -server is specified, keep the default off
// unless it is asked for. Future work: either add bytecode rewriting
// at link time, or rewrite bytecodes in non-shared methods.
if (!DumpSharedSpaces && !RequireSharedSpaces &&
if (is_server_compilation_mode_vm() && !DumpSharedSpaces && !RequireSharedSpaces &&
(FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) {
no_shared_spaces("COMPILER2 default: -Xshare:auto | off, have to manually setup to on.");
}
@ -3711,6 +3735,12 @@ jint Arguments::finalize_vm_init_args() {
return JNI_ERR;
}
#if INCLUDE_JVMCI
if (UseJVMCICompiler) {
Compilation_mode = CompMode_server;
}
#endif
return JNI_OK;
}
@ -4456,7 +4486,9 @@ jint Arguments::apply_ergo() {
} else {
int max_compilation_policy_choice = 1;
#ifdef COMPILER2
max_compilation_policy_choice = 2;
if (is_server_compilation_mode_vm()) {
max_compilation_policy_choice = 2;
}
#endif
// Check if the policy is valid.
if (CompilationPolicyChoice >= max_compilation_policy_choice) {

@ -455,6 +455,10 @@ class Arguments : AllStatic {
static intx _Tier3InvokeNotifyFreqLog;
static intx _Tier4InvocationThreshold;
// Compilation mode.
static bool compilation_mode_selected();
static void select_compilation_mode_ergonomically();
// Tiered
static void set_tiered_flags();
// CMS/ParNew garbage collectors

@ -238,31 +238,17 @@ void NonTieredCompPolicy::initialize() {
// Note: this policy is used ONLY if TieredCompilation is off.
// compiler_count() behaves the following way:
// - with TIERED build (with both COMPILER1 and COMPILER2 defined) it should return
// zero for the c1 compilation levels, hence the particular ordering of the
// statements.
// - the same should happen when COMPILER2 is defined and COMPILER1 is not
// (server build without TIERED defined).
// - if only COMPILER1 is defined (client build), zero should be returned for
// the c2 level.
// zero for the c1 compilation levels in server compilation mode runs
// and c2 compilation levels in client compilation mode runs.
// - with COMPILER2 not defined it should return zero for c2 compilation levels.
// - with COMPILER1 not defined it should return zero for c1 compilation levels.
// - if neither is defined - always return zero.
int NonTieredCompPolicy::compiler_count(CompLevel comp_level) {
assert(!TieredCompilation, "This policy should not be used with TieredCompilation");
#ifdef COMPILER2
if (is_c2_compile(comp_level)) {
if (COMPILER2_PRESENT(is_server_compilation_mode_vm() && is_c2_compile(comp_level) ||)
is_client_compilation_mode_vm() && is_c1_compile(comp_level)) {
return _compiler_count;
} else {
return 0;
}
#endif
#ifdef COMPILER1
if (is_c1_compile(comp_level)) {
return _compiler_count;
} else {
return 0;
}
#endif
return 0;
}

@ -131,19 +131,32 @@ const char* Abstract_VM_Version::vm_info_string() {
return UseSharedSpaces ? "interpreted mode, sharing" : "interpreted mode";
case Arguments::_mixed:
if (UseSharedSpaces) {
if (UseAOT) {
return "mixed mode, aot, sharing";
} else {
return "mixed mode, sharing";
}
if (UseAOT) {
return "mixed mode, aot, sharing";
#ifdef TIERED
} else if(is_client_compilation_mode_vm()) {
return "mixed mode, emulated-client, sharing";
#endif
} else {
return "mixed mode, sharing";
}
} else {
if (UseAOT) {
return "mixed mode, aot";
#ifdef TIERED
} else if(is_client_compilation_mode_vm()) {
return "mixed mode, emulated-client";
#endif
} else {
return "mixed mode";
}
}
case Arguments::_comp:
#ifdef TIERED
if (is_client_compilation_mode_vm()) {
return UseSharedSpaces ? "compiled mode, emulated-client, sharing" : "compiled mode, emulated-client";
}
#endif
return UseSharedSpaces ? "compiled mode, sharing" : "compiled mode";
};
ShouldNotReachHere();

@ -46,6 +46,7 @@ requires.properties= \
vm.gc.Parallel \
vm.gc.ConcMarkSweep \
vm.jvmci \
vm.emulatedClient \
vm.cpu.features \
vm.debug

@ -25,7 +25,7 @@
* @test
* @bug 8072016
* @summary Infinite deoptimization/recompilation cycles in case of arraycopy with tightly coupled allocation
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
@ -86,8 +86,8 @@ public class TestArrayCopyNoInitDeopt {
}
static public void main(String[] args) throws Exception {
if (!Platform.isServer()) {
throw new Error("TESTBUG: Not server VM");
if (!Platform.isServer() || Platform.isEmulatedClient()) {
throw new Error("TESTBUG: Not server mode");
}
// Only execute if C2 is available
if (TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) {

@ -26,6 +26,7 @@
* @bug 7200264
* @summary 7192963 changes disabled shift vectors
* @requires vm.cpu.features ~= ".*sse2.*" & vm.debug & vm.flavor == "server"
* @requires !vm.emulatedClient
* @library /test/lib /
* @run driver compiler.c2.cr7200264.TestSSE2IntVect
*/

@ -26,6 +26,7 @@
* @bug 7200264
* @summary 7192963 changes disabled shift vectors
* @requires vm.cpu.features ~= ".*sse4\\.1.*" & vm.debug & vm.flavor == "server"
* @requires !vm.emulatedClient
* @library /test/lib /
* @run driver compiler.c2.cr7200264.TestSSE4IntVect
*/

@ -65,9 +65,9 @@ public class OverloadCompileQueueTest implements Runnable {
AVAILABLE_LEVELS = IntStream
.rangeClosed(LEVEL_SIMPLE, TIERED_STOP_AT_LEVEL)
.toArray();
} else if (Platform.isServer()) {
} else if (Platform.isServer() && !Platform.isEmulatedClient()) {
AVAILABLE_LEVELS = new int[] { LEVEL_FULL_OPTIMIZATION };
} else if (Platform.isClient() || Platform.isMinimal()) {
} else if (Platform.isClient() || Platform.isMinimal() || Platform.isEmulatedClient()) {
AVAILABLE_LEVELS = new int[] { LEVEL_SIMPLE };
} else {
throw new Error("TESTBUG: unknown VM: " + Platform.vmName);

@ -75,7 +75,7 @@ public class TestAESIntrinsicsOnSupportedConfig extends AESIntrinsicsBase {
prepareArguments(prepareBooleanFlag(AESIntrinsicsBase
.USE_AES, true)));
final String errorMessage = "Case testUseAES failed";
if (Platform.isServer()) {
if (Platform.isServer() && !Platform.isEmulatedClient()) {
verifyOutput(new String[]{AESIntrinsicsBase.CIPHER_INTRINSIC,
AESIntrinsicsBase.AES_INTRINSIC}, null, errorMessage,
outputAnalyzer);

@ -114,7 +114,7 @@ public class IntrinsicAvailableTest extends CompilerWhiteBoxTest {
public void test() throws Exception {
Executable intrinsicMethod = testCase.getExecutable();
if (Platform.isServer() && (TIERED_STOP_AT_LEVEL == COMP_LEVEL_FULL_OPTIMIZATION)) {
if (Platform.isServer() && !Platform.isEmulatedClient() && (TIERED_STOP_AT_LEVEL == COMP_LEVEL_FULL_OPTIMIZATION)) {
if (TIERED_COMPILATION) {
checkIntrinsicForCompilationLevel(intrinsicMethod, COMP_LEVEL_SIMPLE);
}

@ -197,7 +197,8 @@ public class IntrinsicDisabledTest {
}
public static void main(String args[]) {
if (Platform.isServer() && (TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION)) {
if (Platform.isServer() && !Platform.isEmulatedClient() &&
(TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION)) {
if (TIERED_COMPILATION) {
test(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
}

@ -26,7 +26,7 @@
* @test
* @bug 8130150 8131779 8139907
* @summary Verify that the Montgomery multiply and square intrinsic works and correctly checks their arguments.
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @modules java.base/jdk.internal.misc:open
* @modules java.base/java.math:open
* @library /test/lib /
@ -314,8 +314,8 @@ public class MontgomeryMultiplyTest {
}
public static void main(String args[]) {
if (!Platform.isServer()) {
throw new Error("TESTBUG: Not server VM");
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)) {

@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management

@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management

@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management

@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management

@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management

@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management

@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management

@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management

@ -78,7 +78,7 @@ public class BmiIntrinsicBase extends CompilerWhiteBoxTest {
System.out.println(testCase.name());
if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX) {
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;
}

@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management

@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management

@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management

@ -24,7 +24,7 @@
/*
* @test
* @bug 8031321
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management

@ -25,7 +25,7 @@
* @test NullCheckDroppingsTest
* @bug 8054492
* @summary Casting can result in redundant null checks in generated code
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
@ -84,8 +84,8 @@ public class CastNullCheckDroppingsTest {
int[] asink;
public static void main(String[] args) throws Exception {
if (!Platform.isServer()) {
throw new Error("TESTBUG: Not server VM");
if (!Platform.isServer() || Platform.isEmulatedClient()) {
throw new Error("TESTBUG: Not server mode");
}
// Make sure background compilation is disabled
if (WHITE_BOX.getBooleanVMFlag("BackgroundCompilation")) {

@ -50,7 +50,7 @@ public abstract class IntrinsicBase extends CompilerWhiteBoxTest {
int expectedIntrinsicCount = 0;
if (Platform.isServer()) {
if (Platform.isServer() && !Platform.isEmulatedClient()) {
if (TIERED_COMPILATION) {
int max_level = TIERED_STOP_AT_LEVEL;
expectedIntrinsicCount = (max_level == COMP_LEVEL_MAX) ? 1 : 0;

@ -24,7 +24,7 @@
/**
* @test
* @bug 8161147
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @summary Safepoint on backedge breaks UseCountedLoopSafepoints
* @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+UseCountedLoopSafepoints TestCountedLoopSafepointBackedge
*

@ -28,6 +28,7 @@
* @summary Test that C2 flag UseCountedLoopSafepoints ensures a safepoint is kept in a CountedLoop
* @library /test/lib /
* @requires vm.compMode != "Xint" & vm.flavor == "server" & (vm.opt.TieredStopAtLevel == null | vm.opt.TieredStopAtLevel == 4) & vm.debug == true
* @requires !vm.emulatedClient
* @modules java.base/jdk.internal.misc
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
@ -37,6 +38,7 @@
package compiler.loopopts;
import jdk.test.lib.Platform;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import java.util.List;
@ -51,6 +53,9 @@ import jdk.test.lib.Asserts;
public class UseCountedLoopSafepointsTest {
public static void main (String args[]) {
if (!Platform.isServer() || Platform.isEmulatedClient()) {
throw new Error("TESTBUG: Not server mode");
}
check(true); // check ideal graph with UseCountedLoopSafepoint enabled
check(false); // ... and disabled
}

@ -445,7 +445,7 @@ public class TestExplicitRangeChecks {
success = false;
}
// Only perform these additional checks if C2 is available
if (Platform.isServer() &&
if (Platform.isServer() && !Platform.isEmulatedClient() &&
TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) {
if (deoptimize && WHITE_BOX.isMethodCompiled(m)) {
System.out.println(name + " not deoptimized on invalid access");

@ -53,10 +53,10 @@ public class CompilerUtils {
"TieredStopAtLevel has value out of int capacity");
return IntStream.rangeClosed(1, maxLevel).toArray();
} else {
if (Platform.isServer()) {
if (Platform.isServer() && !Platform.isEmulatedClient()) {
return new int[]{4};
}
if (Platform.isClient() || Platform.isMinimal()) {
if (Platform.isClient() || Platform.isMinimal() || Platform.isEmulatedClient()) {
return new int[]{1};
}
}

@ -55,7 +55,7 @@ public class IntrinsicPredicates {
"TieredStopAtLevel");
boolean maxLevelIsReachable = (tieredMaxLevel
== IntrinsicPredicates.TIERED_MAX_LEVEL);
return Platform.isServer() && (!isTiered || maxLevelIsReachable);
return Platform.isServer() && !Platform.isEmulatedClient() && (!isTiered || maxLevelIsReachable);
};
public static final BooleanSupplier SHA1_INSTRUCTION_AVAILABLE

@ -47,10 +47,10 @@ public class NonTieredLevelsTest extends CompLevelsTest {
private static final int AVAILABLE_COMP_LEVEL;
private static final IntPredicate IS_AVAILABLE_COMPLEVEL;
static {
if (Platform.isServer()) {
if (Platform.isServer() && !Platform.isEmulatedClient()) {
AVAILABLE_COMP_LEVEL = COMP_LEVEL_FULL_OPTIMIZATION;
IS_AVAILABLE_COMPLEVEL = x -> x == COMP_LEVEL_FULL_OPTIMIZATION;
} else if (Platform.isClient() || Platform.isMinimal()) {
} else if (Platform.isClient() || Platform.isMinimal() || Platform.isEmulatedClient()) {
AVAILABLE_COMP_LEVEL = COMP_LEVEL_SIMPLE;
IS_AVAILABLE_COMPLEVEL = x -> x >= COMP_LEVEL_SIMPLE
&& x <= COMP_LEVEL_FULL_PROFILE;

@ -25,7 +25,7 @@
* @test CorrectnessTest
* @bug 8038418
* @summary Tests correctness of type usage with type profiling and speculations
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
@ -88,8 +88,8 @@ public class CorrectnessTest {
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
public static void main(String[] args) {
if (!Platform.isServer()) {
throw new Error("TESTBUG: Not server VM");
if (!Platform.isServer() || Platform.isEmulatedClient()) {
throw new Error("TESTBUG: Not server mode");
}
Asserts.assertGTE(args.length, 1);
ProfilingType profilingType = ProfilingType.valueOf(args[0]);

@ -206,7 +206,7 @@ public class TestUnstableIfTrap {
boolean isMethodCompiledAtMaxTier
= WB.getMethodCompilationLevel(m) == MAX_TIER;
return Platform.isServer() && isMethodCompiled
return Platform.isServer() && !Platform.isEmulatedClient() && isMethodCompiled
&& (!isTiered || isMethodCompiledAtMaxTier);
}

@ -28,7 +28,7 @@
* @summary tests on constant folding of unsafe get operations
* @library /test/lib
*
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
*
* @modules java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.vm.annotation
@ -93,8 +93,8 @@ public class UnsafeGetConstantField {
static final Unsafe U = Unsafe.getUnsafe();
public static void main(String[] args) {
if (!Platform.isServer()) {
throw new Error("TESTBUG: Not server VM");
if (!Platform.isServer() || Platform.isEmulatedClient()) {
throw new Error("TESTBUG: Not server mode");
}
testUnsafeGetAddress();
testUnsafeGetField();

@ -28,7 +28,7 @@
* @summary tests on constant folding of unsafe get operations from stable arrays
* @library /test/lib
*
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
*
* @modules java.base/jdk.internal.vm.annotation
* java.base/jdk.internal.misc
@ -332,8 +332,8 @@ public class UnsafeGetStableArrayElement {
}
public static void main(String[] args) throws Exception {
if (!Platform.isServer()) {
throw new Error("TESTBUG: Not server VM");
if (!Platform.isServer() || Platform.isEmulatedClient()) {
throw new Error("TESTBUG: Not server mode");
}
testUnsafeAccess();
System.out.println("TEST PASSED");

@ -25,7 +25,8 @@
* @test IsMethodCompilableTest
* @bug 8007270 8006683 8007288 8022832
* @summary testing of WB::isMethodCompilable()
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & (vm.opt.TieredStopAtLevel == null | vm.opt.TieredStopAtLevel == 4)
* @requires !vm.emulatedClient
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
@ -82,8 +83,8 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
protected void test() throws Exception {
// Only c2 compilations can be disabled through PerMethodRecompilationCutoff
if (!Platform.isServer()) {
throw new Error("TESTBUG: Not server VM");
if (!Platform.isServer() || Platform.isEmulatedClient()) {
throw new Error("TESTBUG: Not server mode");
}
if (skipXcompOSR()) {

@ -29,7 +29,7 @@ import java.io.IOException;
* @key gc
* @key stress
* @requires vm.gc.ConcMarkSweep
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @summary Stress the CMS GC by trying to make old objects more likely to be garbage than young objects.
* @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx256m -server -XX:+UseConcMarkSweepGC TestGCBasherWithCMS 120000
*/

@ -29,7 +29,7 @@ import java.io.IOException;
* @key gc
* @key stress
* @requires vm.gc.G1
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @summary Stress the G1 GC by trying to make old objects more likely to be garbage than young objects.
* @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx256m -server -XX:+UseG1GC TestGCBasherWithG1 120000
*/

@ -29,7 +29,7 @@ import java.io.IOException;
* @key gc
* @key stress
* @requires vm.gc.Parallel
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @summary Stress the Parallel GC by trying to make old objects more likely to be garbage than young objects.
* @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx256m -server -XX:+UseParallelGC -XX:-UseGCOverheadLimit TestGCBasherWithParallel 120000
*/

@ -29,7 +29,7 @@ import java.io.IOException;
* @key gc
* @key stress
* @requires vm.gc.Serial
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @summary Stress the Serial GC by trying to make old objects more likely to be garbage than young objects.
* @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx256m -server -XX:+UseSerialGC TestGCBasherWithSerial 120000
*/

@ -48,8 +48,9 @@ public class XShareAuto {
"-server", "-XX:+UnlockDiagnosticVMOptions",
"-XX:SharedArchiveFile=./XShareAuto.jsa", "-version");
output = new OutputAnalyzer(pb.start());
String outputString = output.getOutput();
// We asked for server but it could be aliased to something else
if (output.getOutput().contains("Server VM")) {
if (outputString.contains("Server VM") && !outputString.contains("emulated-client")) {
// In server case we don't expect to see sharing flag
output.shouldNotContain("sharing");
output.shouldHaveExitValue(0);

@ -24,7 +24,7 @@
/*
* @test ReservedStackTestCompiler
* @summary Run ReservedStackTest with dedicated compilers C1 and C2.
* @requires vm.flavor == "server"
* @requires vm.flavor == "server" & !vm.emulatedClient
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules java.base/jdk.internal.vm.annotation

@ -49,7 +49,7 @@ public class CompilerDirectivesDCMDTest {
public void run(CommandExecutor executor) {
if (Platform.isServer()) {
if (Platform.isServer() && !Platform.isEmulatedClient()) {
filename = System.getProperty("test.src", ".") + File.separator + "control2.txt";
} else {
filename = System.getProperty("test.src", ".") + File.separator + "control1.txt";

@ -101,10 +101,12 @@ public class Utils {
INITIAL_COMP_LEVEL = 1;
} else {
String vmName = System.getProperty("java.vm.name");
if (Utils.endsWithIgnoreCase(vmName, " Server VM")) {
String vmInfo = System.getProperty("java.vm.info");
boolean isEmulatedClient = (vmInfo != null) && vmInfo.contains("emulated-client");
if (Utils.endsWithIgnoreCase(vmName, " Server VM") && !isEmulatedClient) {
INITIAL_COMP_LEVEL = 4;
} else if (Utils.endsWithIgnoreCase(vmName, " Client VM")
|| Utils.endsWithIgnoreCase(vmName, " Minimal VM")) {
|| Utils.endsWithIgnoreCase(vmName, " Minimal VM") || isEmulatedClient) {
INITIAL_COMP_LEVEL = 1;
} else {
throw new RuntimeException("Unknown VM: " + vmName);

@ -50,7 +50,7 @@ public class TestMutuallyExclusivePlatformPredicates {
OS("isAix", "isLinux", "isOSX", "isSolaris", "isWindows"),
VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero", "isEmbedded"),
MODE("isInt", "isMixed", "isComp"),
IGNORED("isDebugBuild", "isFastDebugBuild", "isSlowDebugBuild",
IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild", "isSlowDebugBuild",
"shouldSAAttach", "canPtraceAttachLinux", "canAttachOSX",
"isTieredSupported");