changeset 43455:96560cffef4d

8166002: Emulate client build on platforms with reduced virtual address space Summary: The default VM ergonomics on Windows/x86 (32-bit) are changed to client like. Reviewed-by: kvn, iveresov
author jcm
date Tue, 17 Jan 2017 21:38:07 -0800
parents c11ebe3f754c
children 617ed26c48d2
files hotspot/src/share/vm/compiler/compilerDefinitions.cpp hotspot/src/share/vm/compiler/compilerDefinitions.hpp hotspot/src/share/vm/compiler/compilerDirectives.cpp hotspot/src/share/vm/gc/shared/collectedHeap.cpp hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp hotspot/src/share/vm/gc/shared/referenceProcessor.cpp hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.cpp hotspot/src/share/vm/oops/methodData.cpp hotspot/src/share/vm/prims/whitebox.cpp hotspot/src/share/vm/runtime/arguments.cpp hotspot/src/share/vm/runtime/arguments.hpp hotspot/src/share/vm/runtime/compilationPolicy.cpp hotspot/src/share/vm/runtime/vm_version.cpp hotspot/test/TEST.ROOT hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java hotspot/test/compiler/c2/cr7200264/TestSSE2IntVect.java hotspot/test/compiler/c2/cr7200264/TestSSE4IntVect.java hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java hotspot/test/compiler/loopopts/UseCountedLoopSafepointsTest.java hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java hotspot/test/compiler/testlibrary/CompilerUtils.java hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java hotspot/test/compiler/tiered/NonTieredLevelsTest.java hotspot/test/compiler/types/correctness/CorrectnessTest.java hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java hotspot/test/compiler/unsafe/UnsafeGetConstantField.java hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java hotspot/test/compiler/whitebox/IsMethodCompilableTest.java hotspot/test/gc/stress/gcbasher/TestGCBasherWithCMS.java hotspot/test/gc/stress/gcbasher/TestGCBasherWithG1.java hotspot/test/gc/stress/gcbasher/TestGCBasherWithParallel.java hotspot/test/gc/stress/gcbasher/TestGCBasherWithSerial.java hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java hotspot/test/runtime/ReservedStack/ReservedStackTestCompiler.java hotspot/test/serviceability/dcmd/compiler/CompilerDirectivesDCMDTest.java hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
diffstat 57 files changed, 259 insertions(+), 122 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/compiler/compilerDefinitions.cpp	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/src/share/vm/compiler/compilerDefinitions.cpp	Tue Jan 17 21:38:07 2017 -0800
@@ -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 @@
   "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
--- a/hotspot/src/share/vm/compiler/compilerDefinitions.hpp	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/src/share/vm/compiler/compilerDefinitions.hpp	Tue Jan 17 21:38:07 2017 -0800
@@ -54,27 +54,30 @@
   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
+  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
+extern CompLevel CompLevel_highest_tier;
+extern CompLevel CompLevel_initial_compile;
 
-#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
+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;
 }
--- a/hotspot/src/share/vm/compiler/compilerDirectives.cpp	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/src/share/vm/compiler/compilerDirectives.cpp	Tue Jan 17 21:38:07 2017 -0800
@@ -445,7 +445,9 @@
   _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);
--- a/hotspot/src/share/vm/gc/shared/collectedHeap.cpp	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/src/share/vm/gc/shared/collectedHeap.cpp	Tue Jan 17 21:38:07 2017 -0800
@@ -233,7 +233,7 @@
   // 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?");
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Tue Jan 17 21:38:07 2017 -0800
@@ -1209,7 +1209,7 @@
 #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();
--- a/hotspot/src/share/vm/gc/shared/referenceProcessor.cpp	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/src/share/vm/gc/shared/referenceProcessor.cpp	Tue Jan 17 21:38:07 2017 -0800
@@ -57,11 +57,11 @@
   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");
   }
--- a/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.cpp	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.cpp	Tue Jan 17 21:38:07 2017 -0800
@@ -233,9 +233,11 @@
   // 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
--- a/hotspot/src/share/vm/oops/methodData.cpp	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/src/share/vm/oops/methodData.cpp	Tue Jan 17 21:38:07 2017 -0800
@@ -717,9 +717,9 @@
 }
 
 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 @@
     return variable_cell_count;
   }
   return no_profile_data;
-#endif
 }
 
 // Compute the size of the profiling information corresponding to
@@ -840,7 +839,9 @@
   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 @@
 // 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 @@
     assert(!bytecode_has_profile(c), "agree w/ !BHP");
     return 0;
   }
-#endif
 }
 
 // Get the data at an arbitrary (sort of) data index.
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Tue Jan 17 21:38:07 2017 -0800
@@ -659,6 +659,9 @@
 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);
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Tue Jan 17 21:38:07 2017 -0800
@@ -1819,6 +1819,25 @@
 #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 @@
 #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 @@
   // 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 @@
     return JNI_ERR;
   }
 
+#if INCLUDE_JVMCI
+  if (UseJVMCICompiler) {
+    Compilation_mode = CompMode_server;
+  }
+#endif
+
   return JNI_OK;
 }
 
@@ -4456,7 +4486,9 @@
   } 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) {
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Tue Jan 17 21:38:07 2017 -0800
@@ -455,6 +455,10 @@
   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
--- a/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Tue Jan 17 21:38:07 2017 -0800
@@ -238,31 +238,17 @@
 // 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;
 }
 
--- a/hotspot/src/share/vm/runtime/vm_version.cpp	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp	Tue Jan 17 21:38:07 2017 -0800
@@ -131,19 +131,32 @@
       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();
--- a/hotspot/test/TEST.ROOT	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/TEST.ROOT	Tue Jan 17 21:38:07 2017 -0800
@@ -46,6 +46,7 @@
     vm.gc.Parallel \
     vm.gc.ConcMarkSweep \
     vm.jvmci \
+    vm.emulatedClient \
     vm.cpu.features \
     vm.debug
 
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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 @@
     }
 
     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) {
--- a/hotspot/test/compiler/c2/cr7200264/TestSSE2IntVect.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/c2/cr7200264/TestSSE2IntVect.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
  */
--- a/hotspot/test/compiler/c2/cr7200264/TestSSE4IntVect.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/c2/cr7200264/TestSSE4IntVect.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
  */
--- a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Tue Jan 17 21:38:07 2017 -0800
@@ -65,9 +65,9 @@
             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);
--- a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java	Tue Jan 17 21:38:07 2017 -0800
@@ -75,7 +75,7 @@
                 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);
--- a/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java	Tue Jan 17 21:38:07 2017 -0800
@@ -114,7 +114,7 @@
 
     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);
             }
--- a/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java	Tue Jan 17 21:38:07 2017 -0800
@@ -197,7 +197,8 @@
     }
 
     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);
             }
--- a/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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 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)) {
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java	Tue Jan 17 21:38:07 2017 -0800
@@ -78,7 +78,7 @@
 
         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;
         }
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
--- a/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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 @@
     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")) {
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java	Tue Jan 17 21:38:07 2017 -0800
@@ -50,7 +50,7 @@
 
         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;
--- a/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
  *
--- a/hotspot/test/compiler/loopopts/UseCountedLoopSafepointsTest.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/loopopts/UseCountedLoopSafepointsTest.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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 @@
 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
     }
--- a/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java	Tue Jan 17 21:38:07 2017 -0800
@@ -445,7 +445,7 @@
                 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");
--- a/hotspot/test/compiler/testlibrary/CompilerUtils.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/testlibrary/CompilerUtils.java	Tue Jan 17 21:38:07 2017 -0800
@@ -53,10 +53,10 @@
                     "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};
             }
         }
--- a/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java	Tue Jan 17 21:38:07 2017 -0800
@@ -55,7 +55,7 @@
                 "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
--- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java	Tue Jan 17 21:38:07 2017 -0800
@@ -47,10 +47,10 @@
     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;
--- a/hotspot/test/compiler/types/correctness/CorrectnessTest.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/types/correctness/CorrectnessTest.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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 @@
     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]);
--- a/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java	Tue Jan 17 21:38:07 2017 -0800
@@ -206,7 +206,7 @@
         boolean isMethodCompiledAtMaxTier
                 = WB.getMethodCompilationLevel(m) == MAX_TIER;
 
-        return Platform.isServer() && isMethodCompiled
+        return Platform.isServer() && !Platform.isEmulatedClient() && isMethodCompiled
                 && (!isTiered || isMethodCompiledAtMaxTier);
     }
 
--- a/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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 @@
     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();
--- a/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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 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");
--- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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 @@
     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()) {
--- a/hotspot/test/gc/stress/gcbasher/TestGCBasherWithCMS.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/gc/stress/gcbasher/TestGCBasherWithCMS.java	Tue Jan 17 21:38:07 2017 -0800
@@ -29,7 +29,7 @@
  * @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
  */
--- a/hotspot/test/gc/stress/gcbasher/TestGCBasherWithG1.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/gc/stress/gcbasher/TestGCBasherWithG1.java	Tue Jan 17 21:38:07 2017 -0800
@@ -29,7 +29,7 @@
  * @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
  */
--- a/hotspot/test/gc/stress/gcbasher/TestGCBasherWithParallel.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/gc/stress/gcbasher/TestGCBasherWithParallel.java	Tue Jan 17 21:38:07 2017 -0800
@@ -29,7 +29,7 @@
  * @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
  */
--- a/hotspot/test/gc/stress/gcbasher/TestGCBasherWithSerial.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/gc/stress/gcbasher/TestGCBasherWithSerial.java	Tue Jan 17 21:38:07 2017 -0800
@@ -29,7 +29,7 @@
  * @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
  */
--- a/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java	Tue Jan 17 21:38:07 2017 -0800
@@ -48,8 +48,9 @@
             "-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);
--- a/hotspot/test/runtime/ReservedStack/ReservedStackTestCompiler.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/runtime/ReservedStack/ReservedStackTestCompiler.java	Tue Jan 17 21:38:07 2017 -0800
@@ -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
--- a/hotspot/test/serviceability/dcmd/compiler/CompilerDirectivesDCMDTest.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/serviceability/dcmd/compiler/CompilerDirectivesDCMDTest.java	Tue Jan 17 21:38:07 2017 -0800
@@ -49,7 +49,7 @@
 
     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";
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java	Tue Jan 17 21:38:07 2017 -0800
@@ -101,10 +101,12 @@
             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);
--- a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Tue Jan 17 17:00:22 2017 +0100
+++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Tue Jan 17 21:38:07 2017 -0800
@@ -50,7 +50,7 @@
         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");