changeset 23404:3ef45d0a6d77

Remove jvmci VM configuration, and backport UseJVMCICompiler flag.
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 24 May 2016 13:51:28 +0200
parents 5342deb9bf53
children 53d9235e99ba
files make/Makefile make/defs.make mx.jvmci/mx_jvmci.py src/cpu/ppc/vm/jvmciGlobals_ppc.hpp src/cpu/sparc/vm/jvmci_globals_sparc.hpp src/cpu/sparc/vm/sharedRuntime_sparc.cpp src/cpu/x86/vm/jvmci_globals_x86.hpp src/cpu/x86/vm/sharedRuntime_x86_64.cpp src/share/vm/compiler/compileBroker.cpp src/share/vm/compiler/compileBroker.hpp src/share/vm/compiler/oopMap.cpp src/share/vm/gc_interface/collectedHeap.hpp src/share/vm/jvmci/jvmciCompiler.cpp src/share/vm/jvmci/jvmciCompiler.hpp src/share/vm/jvmci/jvmciRuntime.cpp src/share/vm/jvmci/jvmci_globals.hpp src/share/vm/prims/jni.cpp src/share/vm/prims/jvm.cpp src/share/vm/runtime/advancedThresholdPolicy.cpp src/share/vm/runtime/arguments.cpp src/share/vm/runtime/compilationPolicy.cpp src/share/vm/runtime/deoptimization.cpp src/share/vm/runtime/deoptimization.hpp src/share/vm/runtime/globals.hpp src/share/vm/runtime/java.cpp src/share/vm/runtime/simpleThresholdPolicy.cpp src/share/vm/runtime/simpleThresholdPolicy.inline.hpp src/share/vm/runtime/thread.cpp src/share/vm/runtime/thread.hpp src/share/vm/runtime/vm_version.cpp src/share/vm/utilities/globalDefinitions.hpp src/share/vm/utilities/macros.hpp
diffstat 32 files changed, 251 insertions(+), 217 deletions(-) [+]
line wrap: on
line diff
--- a/make/Makefile	Fri May 20 15:49:00 2016 +0200
+++ b/make/Makefile	Tue May 24 13:51:28 2016 +0200
@@ -95,7 +95,6 @@
 ZERO_VM_TARGETS=productzero fastdebugzero optimizedzero debugzero
 SHARK_VM_TARGETS=productshark fastdebugshark optimizedshark debugshark
 MINIMAL1_VM_TARGETS=productminimal1 fastdebugminimal1 debugminimal1
-JVMCI_VM_TARGETS=productjvmci fastdebugjvmci optimizedjvmci debugjvmci
 
 COMMON_VM_PRODUCT_TARGETS=product product1 docs export_product
 COMMON_VM_FASTDEBUG_TARGETS=fastdebug fastdebug1 docs export_fastdebug
@@ -150,12 +149,6 @@
 all_debugcore:     debugcore docs export_debug
 all_optimizedcore: optimizedcore docs export_optimized
 
-alljvmci:           all_productjvmci all_fastdebugjvmci
-all_productjvmci:   productjvmci docs export_product
-all_fastdebugjvmci: fastdebugjvmci docs export_fastdebug
-all_debugjvmci:     debugjvmci docs export_debug
-all_optimizedjvmci: optimizedjvmci docs export_optimized
-
 # Do everything
 world:         all create_jdk
 
@@ -205,10 +198,6 @@
 	$(CD) $(GAMMADIR)/make; \
 	$(MAKE) BUILD_DIR=$(MINIMAL1_DIR) BUILD_FLAVOR=$(@:%minimal1=%) VM_TARGET=$@ generic_buildminimal1 $(ALT_OUT)
 
-$(JVMCI_VM_TARGETS):
-	$(CD) $(GAMMADIR)/make; \
-	$(MAKE) BUILD_DIR=$(JVMCI_DIR) BUILD_FLAVOR=$(@:%jvmci=%) VM_TARGET=$@ INCLUDE_JVMCI=true generic_buildjvmci $(ALT_OUT)
-
 # Install hotspot script in build directory
 HOTSPOT_SCRIPT=$(BUILD_DIR)/$(BUILD_FLAVOR)/hotspot
 $(HOTSPOT_SCRIPT): $(GAMMADIR)/make/hotspot.script
--- a/make/defs.make	Fri May 20 15:49:00 2016 +0200
+++ b/make/defs.make	Tue May 24 13:51:28 2016 +0200
@@ -385,15 +385,5 @@
 # done by verify_defs_make in jvmci.make
 EXPORT_LIST += $(CONDITIONAL_EXPORT_LIST)
 
-define jvmci-make
-	cd .. && pwd && \
-	$(MAKE) -f make/jvmci.make \
-		TARGET=build/jvmci.make \
-		HS_COMMON_SRC=$(HS_COMMON_SRC) \
-		ABS_BOOTDIR=$(ABS_BOOTDIR) \
-		SHARED_DIR=$(SHARED_DIR) \
-		MAKE_VERBOSE=$(MAKE_VERBOSE) $(1)
-endef
-
 .PHONY: $(HS_ALT_MAKE)/defs.make
 
--- a/mx.jvmci/mx_jvmci.py	Fri May 20 15:49:00 2016 +0200
+++ b/mx.jvmci/mx_jvmci.py	Tue May 24 13:51:28 2016 +0200
@@ -45,17 +45,23 @@
 """ The VMs that can be built and run along with an optional description. Only VMs with a
     description are listed in the dialogue for setting the default VM (see get_vm()). """
 _vmChoices = {
-    'jvmci' : 'VM triggered compilation is performed with a tiered system (C1 + Graal) and Graal is available for hosted compilation.',
-    'server' : 'Normal compilation is performed with a tiered system (C1 + C2) and Graal is available for hosted compilation.',
+    'server' : 'Normal compilation is performed with a tiered system (C1 + C2 or Graal) and Graal is available for hosted compilation.',
     'client' : None,  # VM compilation with client compiler, hosted compilation with Graal
     'server-nojvmci' : None,  # all compilation with tiered system (i.e., client + server), JVMCI omitted
     'client-nojvmci' : None,  # all compilation with client compiler, JVMCI omitted
     'original' : None,  # default VM copied from bootstrap JDK
 }
 
+_jvmciModes = {
+    'hosted' : ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI'],
+    'jit' : ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI', '-XX:+UseJVMCICompiler'],
+    'disabled' : ['-XX:+UnlockExperimentalVMOptions', '-XX:-EnableJVMCI']
+}
+
 # Aliases for legacy VM names
 _vmAliases = {
-    'graal' : 'jvmci',
+    'jvmci' : 'server',
+    'graal' : 'server',
     'server-nograal' : 'server-nojvmci',
     'client-nograal' : 'client-nograal',
 }
@@ -67,6 +73,25 @@
     It can also be temporarily set by using of a VM context manager object in a 'with' statement. """
 _vm = None
 
+class JVMCIMode:
+    def __init__(self, jvmciMode):
+        self.jvmciMode = jvmciMode
+        self.vmArgs = _jvmciModes[jvmciMode]
+
+    def __enter__(self):
+        global _jvmciMode
+        self.previousMode = _jvmciMode
+        _jvmciMode = self
+
+    def __exit__(self, exc_type, exc_value, traceback):
+        global _jvmciMode
+        _jvmciMode = self.previousMode
+
+""" The JVMCI mode that will be used by the 'vm' command. This can be set with the global '-M' option.
+    It can also be temporarily set using the JVMCIMode context manager object in a 'with' statement.
+    Defaults to 'hosted'. """
+_jvmciMode = JVMCIMode('hosted')
+
 """ The VM builds that will be run by the 'vm' command - default is first in list """
 _vmbuildChoices = ['product', 'fastdebug', 'debug', 'optimized']
 
@@ -248,9 +273,16 @@
     If 'vm' is an alias, returns the aliased name otherwise returns 'vm'.
     """
     if vm and vm in _vmAliases:
+        if vm == 'jvmci' or vm == 'graal':
+            mx.log('"--vm ' + vm + '" is deprecated, using "--vm server -Mjit" instead')
+            global _jvmciMode
+            _jvmciMode = JVMCIMode('jit')
         return _vmAliases[vm]
     return vm
 
+def get_jvmci_mode_args():
+    return _jvmciMode.vmArgs
+
 def get_vm():
     """
     Gets the configured VM, presenting a dialogue if there is no currently configured VM.
@@ -267,13 +299,16 @@
                     mx.log('Please update the DEFAULT_VM value in ' + envPath + ' to replace "' + vm + '" with "' + _vmAliases[vm] + '"')
         vm = _vmAliases[vm]
     if vm is None:
-        if not mx.is_interactive():
-            mx.abort('Need to specify VM with --vm option or DEFAULT_VM environment variable')
-        mx.log('Please select the VM to be executed from the following: ')
         items = [k for k in _vmChoices.keys() if _vmChoices[k] is not None]
-        descriptions = [_vmChoices[k] for k in _vmChoices.keys() if _vmChoices[k] is not None]
-        vm = mx.select_items(items, descriptions, allowMultiple=False)
-        mx.ask_persist_env('DEFAULT_VM', vm)
+        if len(items) > 1:
+            if not mx.is_interactive():
+                mx.abort('Need to specify VM with --vm option or DEFAULT_VM environment variable')
+            mx.log('Please select the VM to be executed from the following: ')
+            descriptions = [_vmChoices[k] for k in _vmChoices.keys() if _vmChoices[k] is not None]
+            vm = mx.select_items(items, descriptions, allowMultiple=False)
+            mx.ask_persist_env('DEFAULT_VM', vm)
+        else:
+            vm = items[0]
     _vm = vm
     return vm
 
@@ -286,10 +321,16 @@
 """
 class VM:
     def __init__(self, vm=None, build=None):
-        assert vm is None or vm in _vmChoices.keys()
         assert build is None or build in _vmbuildChoices
-        self.vm = vm if vm else _vm
         self.build = build if build else _vmbuild
+        if vm == 'jvmci':
+            mx.log('WARNING: jvmci VM is deprecated, using server VM with -Mjit instead')
+            self.vm = 'server'
+            self.jvmciMode = JVMCIMode('jit')
+        else:
+            assert vm is None or vm in _vmChoices.keys()
+            self.vm = vm if vm else _vm
+            self.jvmciMode = None
 
     def __enter__(self):
         global _vm, _vmbuild
@@ -298,12 +339,16 @@
         mx.reInstantiateDistribution('JVM_<vmbuild>_<vm>', dict(vm=self.previousVm, vmbuild=self.previousBuild), dict(vm=self.vm, vmbuild=self.build))
         _vm = self.vm
         _vmbuild = self.build
+        if self.jvmciMode is not None:
+            self.jvmciMode.__enter__()
 
     def __exit__(self, exc_type, exc_value, traceback):
         global _vm, _vmbuild
         mx.reInstantiateDistribution('JVM_<vmbuild>_<vm>', dict(vm=self.vm, vmbuild=self.build), dict(vm=self.previousVm, vmbuild=self.previousBuild))
         _vm = self.previousVm
         _vmbuild = self.previousBuild
+        if self.jvmciMode is not None:
+            self.jvmciMode.__exit__(exc_type, exc_value, traceback)
 
 def chmodRecursive(dirname, chmodFlagsDir):
     if mx.get_os() == 'windows':
@@ -930,11 +975,9 @@
 
         if self.vm.startswith('server'):
             buildSuffix = ''
-        elif self.vm.startswith('client'):
+        else:
+            assert self.vm.startswith('client'), self.vm
             buildSuffix = '1'
-        else:
-            assert self.vm == 'jvmci', self.vm
-            buildSuffix = 'jvmci'
 
         if isWindows:
             t_compilelogfile = mx._cygpathU2W(os.path.join(_suite.dir, "jvmciCompile.log"))
@@ -1303,8 +1346,6 @@
                     build([])
             if not args.no_check:
                 vmargs = ['-version']
-                if vm == 'jvmci':
-                    vmargs.insert(0, '-XX:-BootstrapJVMCI')
                 run_vm(vmargs, vm=vm, vmbuild=vmbuild)
     allDuration = datetime.timedelta(seconds=time.time() - allStart)
     mx.log('TOTAL TIME:   ' + '[' + str(allDuration) + ']')
@@ -1318,18 +1359,19 @@
                 if mx_jvmci_makefile.build_makefile(['-o', jvmciMake]) != 0:
                     t.abort('Rerun "mx makefile -o ' + jvmciMake + ' and check-in the modified ' + jvmciMake)
 
-    # Build server-hosted-jvmci now so we can run the unit tests
-    with Task('BuildHotSpotJVMCIHosted: product', tasks) as t:
+    # Build server-jvmci now so we can run the unit tests
+    with Task('BuildHotSpotJVMCI: product', tasks) as t:
         if t: buildvms(['--vms', 'server', '--builds', 'product'])
 
     # Run unit tests on server-hosted-jvmci
     with VM('server', 'product'):
-        with Task('JVMCI UnitTests: hosted-product', tasks) as t:
-            if t: unittest(['--suite', 'jvmci', '--enable-timing', '--verbose', '--fail-fast'])
+        with JVMCIMode('hosted'):
+            with Task('JVMCI UnitTests: hosted-product', tasks) as t:
+                if t: unittest(['--suite', 'jvmci', '--enable-timing', '--verbose', '--fail-fast'])
 
-    # Build the other VM flavors
-    with Task('BuildHotSpotJVMCIOthers: fastdebug,product', tasks) as t:
-        if t: buildvms(['--vms', 'jvmci,server', '--builds', 'fastdebug,product'])
+    # Build the fastdebug VM
+    with Task('BuildHotSpotJVMCI: fastdebug', tasks) as t:
+        if t: buildvms(['--vms', 'server', '--builds', 'fastdebug'])
 
     with Task('CleanAndBuildIdealGraphVisualizer', tasks, disableJacoco=True) as t:
         if t and platform.processor() != 'sparc':
@@ -1557,7 +1599,7 @@
 
 def deploy_binary(args):
     for vmbuild in ['product', 'fastdebug']:
-        for vm in ['jvmci', 'server']:
+        for vm in ['server']:
             if vmbuild != _vmbuild or vm != get_vm():
                 mx.instantiateDistribution('JVM_<vmbuild>_<vm>', dict(vmbuild=vmbuild, vm=vm))
     mx.deploy_binary(args)
@@ -1586,6 +1628,7 @@
                 'The VM selected by --vm and --vmbuild options is under this directory (i.e., ' +
                 join('<path>', '<jdk-version>', '<vmbuild>', 'jre', 'lib', '<vm>', mx.add_lib_prefix(mx.add_lib_suffix('jvm'))) + ')', default=None, metavar='<path>')
 
+mx.add_argument('-M', '--jvmci-mode', action='store', dest='jvmci_mode', choices=_jvmciModes.keys(), help='the JVMCI mode to use (default: ' + _jvmciMode.jvmciMode + ')')
 mx.add_argument('--vm', action='store', dest='vm', choices=_vmChoices.keys() + _vmAliases.keys(), help='the VM type to build/run')
 mx.add_argument('--vmbuild', action='store', dest='vmbuild', choices=_vmbuildChoices, help='the VM build to build/run (default: ' + _vmbuildChoices[0] + ')')
 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse')
@@ -1694,6 +1737,8 @@
             mx.make_eclipse_launch(_suite, args, _suite.name + '-' + build, name=None, deps=mx.dependencies())
 
         pfx = _vm_prefix.split() if _vm_prefix is not None else []
+        if not vm.endswith('nojvmci'):
+            args = get_jvmci_mode_args() + args
         cmd = pfx + [self.java] + ['-' + vm] + args
         return mx.run(cmd, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
 
@@ -1738,6 +1783,9 @@
         _vm = dealiased_vm(opts.vm)
         if jdkTag and jdkTag != _JVMCI_JDK_TAG:
             mx.warn('Ignoring "--vm" option as "--jdk" tag is not "' + _JVMCI_JDK_TAG + '"')
+    if opts.jvmci_mode is not None:
+        global _jvmciMode
+        _jvmciMode = JVMCIMode(opts.jvmci_mode)
     if hasattr(opts, 'vmbuild') and opts.vmbuild is not None:
         global _vmbuild
         _vmbuild = opts.vmbuild
--- a/src/cpu/ppc/vm/jvmciGlobals_ppc.hpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/cpu/ppc/vm/jvmciGlobals_ppc.hpp	Tue May 24 13:51:28 2016 +0200
@@ -31,8 +31,8 @@
 // Sets the default values for platform dependent flags used by the JVMCI compiler.
 // (see jvmciGlobals.hpp)
 
-#ifdef COMPILERJVMCI
+#if INCLUDE_JVMCI
 #error Unimplemented
-#endif // COMPILERJVMCI
+#endif // INCLUDE_JVMCI
 
 #endif // CPU_PPC_VM_JVMCIGLOBALS_PPC_HPP
--- a/src/cpu/sparc/vm/jvmci_globals_sparc.hpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/cpu/sparc/vm/jvmci_globals_sparc.hpp	Tue May 24 13:51:28 2016 +0200
@@ -31,7 +31,7 @@
 // Sets the default values for platform dependent flags used by the JVMCI compiler.
 // (see jvmci_globals.hpp)
 
-#ifdef COMPILERJVMCI
+#ifndef COMPILER2
 define_pd_global(bool, BackgroundCompilation,        true );
 define_pd_global(bool, UseTLAB,                      true );
 define_pd_global(bool, ResizeTLAB,                   true );
@@ -58,7 +58,7 @@
 define_pd_global(uintx, CodeCacheMinimumUseSpace,    400*K);
 define_pd_global(intx, TypeProfileWidth,             8);
 define_pd_global(intx, MethodProfileWidth,           0);
-#endif // COMPILERJVMCI
+#endif
 
 define_pd_global(intx, MaxVectorSize,                8);
 
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Tue May 24 13:51:28 2016 +0200
@@ -3625,9 +3625,11 @@
   // Reexecute entry, similar to c2 uncommon trap
   //
   int reexecute_offset = __ offset() - start;
-#if defined(COMPILERJVMCI) && !defined(COMPILER1)
-  // JVMCI does not use this kind of deoptimization
-  __ should_not_reach_here();
+#if INCLUDE_JVMCI && !defined(COMPILER1)
+  if (UseJVMCICompiler) {
+    // JVMCI does not use this kind of deoptimization
+    __ should_not_reach_here();
+  }
 #endif
   // No need to update oop_map  as each call to save_live_registers will produce identical oopmap
   (void) RegisterSaver::save_live_registers(masm, 0, &frame_size_words);
--- a/src/cpu/x86/vm/jvmci_globals_x86.hpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/cpu/x86/vm/jvmci_globals_x86.hpp	Tue May 24 13:51:28 2016 +0200
@@ -31,7 +31,7 @@
 // Sets the default values for platform dependent flags used by the JVMCI compiler.
 // (see jvmci_globals.hpp)
 
-#ifdef COMPILERJVMCI
+#ifndef COMPILER2
 define_pd_global(bool, BackgroundCompilation,        true );
 define_pd_global(bool, UseTLAB,                      true );
 define_pd_global(bool, ResizeTLAB,                   true );
@@ -58,7 +58,7 @@
 define_pd_global(uintx, CodeCacheMinimumUseSpace,    400*K);
 define_pd_global(intx, TypeProfileWidth,             8);
 define_pd_global(intx, MethodProfileWidth,           0);
-#endif // COMPILERJVMCI
+#endif
 
 define_pd_global(intx, MaxVectorSize,                32);
 
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Tue May 24 13:51:28 2016 +0200
@@ -3379,9 +3379,11 @@
   __ jmp(cont);
 
   int reexecute_offset = __ pc() - start;
-#if defined(COMPILERJVMCI) && !defined(COMPILER1)
-  // JVMCI does not use this kind of deoptimization
-  __ should_not_reach_here();
+#if INCLUDE_JVMCI && !defined(COMPILER1)
+  if (UseJVMCICompiler) {
+    // JVMCI does not use this kind of deoptimization
+    __ should_not_reach_here();
+  }
 #endif
 
   // Reexecute case
--- a/src/share/vm/compiler/compileBroker.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/compiler/compileBroker.cpp	Tue May 24 13:51:28 2016 +0200
@@ -51,11 +51,9 @@
 #endif
 #if INCLUDE_JVMCI
 #include "jvmci/jvmciJavaClasses.hpp"
-#ifdef COMPILERJVMCI
 #include "jvmci/jvmciRuntime.hpp"
 #include "runtime/vframe.hpp"
 #endif
-#endif
 #ifdef COMPILER2
 #include "opto/c2compiler.hpp"
 #endif
@@ -237,7 +235,7 @@
 CompileTaskWrapper::CompileTaskWrapper(CompileTask* task) {
   CompilerThread* thread = CompilerThread::current();
   thread->set_task(task);
-#ifdef COMPILERJVMCI
+#if INCLUDE_JVMCI
   if (task->is_blocking() && CompileBroker::compiler(task->comp_level())->is_jvmci()) {
     task->set_jvmci_compiler_thread(thread);
   }
@@ -259,7 +257,7 @@
     {
       MutexLocker notifier(task->lock(), thread);
       task->mark_complete();
-#ifdef COMPILERJVMCI
+#if INCLUDE_JVMCI
       if (CompileBroker::compiler(task->comp_level())->is_jvmci()) {
         if (!task->has_waiter()) {
           // The waiting thread timed out and thus did not free the task.
@@ -305,7 +303,7 @@
   } else {
     task = new CompileTask();
     DEBUG_ONLY(_num_allocated_tasks++;)
-    NOT_COMPILERJVMCI(assert (_num_allocated_tasks < 10000, "Leaking compilation tasks?");)
+    NOT_JVMCI(assert (_num_allocated_tasks < 10000, "Leaking compilation tasks?");)
     task->set_next(NULL);
     task->set_is_free(true);
   }
@@ -347,8 +345,10 @@
   _method_holder = JNIHandles::make_global(method->method_holder()->klass_holder());
   _osr_bci = osr_bci;
   _is_blocking = is_blocking;
-  COMPILERJVMCI_PRESENT(_has_waiter = CompileBroker::compiler(comp_level)->is_jvmci();)
-  COMPILERJVMCI_PRESENT(_jvmci_compiler_thread = NULL;)
+#if INCLUDE_JVMCI
+  _has_waiter = CompileBroker::compiler(comp_level)->is_jvmci();
+  _jvmci_compiler_thread = NULL;
+#endif
   _comp_level = comp_level;
   _num_inlined_bytecodes = 0;
 
@@ -943,34 +943,38 @@
   int c2_count = CompilationPolicy::policy()->compiler_count(CompLevel_full_optimization);
 #if INCLUDE_JVMCI
   JVMCICompiler* jvmci = new JVMCICompiler();
-#endif
-
-#if defined(COMPILERJVMCI)
-  _compilers[1] = jvmci;
-  if (FLAG_IS_DEFAULT(JVMCIThreads)) {
-    if (BootstrapJVMCI) {
-      // JVMCI will bootstrap so give it more threads
-      c2_count = MIN2(32, os::active_processor_count());
+  if (UseJVMCICompiler) {
+    _compilers[1] = jvmci;
+    if (FLAG_IS_DEFAULT(JVMCIThreads)) {
+      if (BootstrapJVMCI) {
+        // JVMCI will bootstrap so give it more threads
+        c2_count = MIN2(32, os::active_processor_count());
+      }
+    } else {
+      c2_count = JVMCIThreads;
     }
-  } else {
-    c2_count = JVMCIThreads;
+    if (FLAG_IS_DEFAULT(JVMCIHostThreads)) {
+    } else {
+      c1_count = JVMCIHostThreads;
+    }
+    if (!UseInterpreter || !BackgroundCompilation) {
+      // Force initialization of JVMCI compiler otherwise JVMCI
+      // compilations will not block until JVMCI is initialized
+      JVMCIRuntime::ensure_jvmci_class_loader_is_initialized();
+      ResourceMark rm;
+      TempNewSymbol getCompiler = SymbolTable::new_symbol("getCompiler", CHECK);
+      TempNewSymbol sig = SymbolTable::new_symbol("()Ljdk/vm/ci/runtime/JVMCICompiler;", CHECK);
+      Handle jvmciRuntime = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK);
+      JavaValue result(T_OBJECT);
+      JavaCalls::call_virtual(&result, jvmciRuntime, HotSpotJVMCIRuntime::klass(), getCompiler, sig, CHECK);
+    }
   }
-  if (FLAG_IS_DEFAULT(JVMCIHostThreads)) {
-  } else {
-    c1_count = JVMCIHostThreads;
+#ifndef COMPILER2
+  else {
+    c2_count = 0;
   }
-  if (!UseInterpreter || !BackgroundCompilation) {
-    // Force initialization of JVMCI compiler otherwise JVMCI
-    // compilations will not block until JVMCI is initialized
-    JVMCIRuntime::ensure_jvmci_class_loader_is_initialized();
-    ResourceMark rm;
-    TempNewSymbol getCompiler = SymbolTable::new_symbol("getCompiler", CHECK);
-    TempNewSymbol sig = SymbolTable::new_symbol("()Ljdk/vm/ci/runtime/JVMCICompiler;", CHECK);
-    Handle jvmciRuntime = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK);
-    JavaValue result(T_OBJECT);
-    JavaCalls::call_virtual(&result, jvmciRuntime, HotSpotJVMCIRuntime::klass(), getCompiler, sig, CHECK);
-  }
-#endif // COMPILERJVMCI
+#endif
+#endif // INCLUDE_JVMCI
 
 #ifdef COMPILER1
   if (c1_count > 0) {
@@ -979,8 +983,10 @@
 #endif // COMPILER1
 
 #ifdef COMPILER2
-  if (c2_count > 0) {
-    _compilers[1] = new C2Compiler();
+  if (true JVMCI_ONLY( && !UseJVMCICompiler)) {
+    if (c2_count > 0) {
+      _compilers[1] = new C2Compiler();
+    }
   }
 #endif // COMPILER2
 
@@ -1178,9 +1184,9 @@
 
 void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) {
   EXCEPTION_MARK;
-#if !defined(ZERO) && !defined(SHARK) && !defined(COMPILERJVMCI)
-  assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?");
-#endif // !ZERO && !SHARK && !COMPILERJVMCI
+#if !defined(ZERO) && !defined(SHARK)
+  assert(c2_compiler_count > 0 || c1_compiler_count > 0 JVMCI_ONLY(|| UseJVMCICompiler), "No compilers?");
+#endif // !ZERO && !SHARK
   // Initialize the compilation queue
   if (c2_compiler_count > 0) {
     _c2_compile_queue  = new CompileQueue("C2 CompileQueue",  MethodCompileQueue_lock);
@@ -1358,8 +1364,8 @@
     // Should this thread wait for completion of the compile?
     blocking = is_compile_blocking();
 
-#ifdef COMPILERJVMCI
-    if (blocking) {
+#if INCLUDE_JVMCI
+    if (UseJVMCICompiler && blocking) {
       // Don't allow blocking compiles for requests triggered by JVMCI.
       if (thread->is_Compiler_thread()) {
         blocking = false;
@@ -1722,7 +1728,7 @@
   return new_task;
 }
 
-#ifdef COMPILERJVMCI
+#if INCLUDE_JVMCI
 // The number of milliseconds to wait before checking if
 // JVMCI compilation has made progress.
 static const long JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE = 500;
@@ -1795,7 +1801,7 @@
 
   methodHandle method(thread, task->method());
   bool free_task = true;
-#ifdef COMPILERJVMCI
+#if INCLUDE_JVMCI
   AbstractCompiler* comp = compiler(task->comp_level());
   if (comp->is_jvmci()) {
     free_task = wait_for_jvmci_completion((JVMCICompiler*) comp, task, thread);
@@ -2183,7 +2189,7 @@
     MutexLocker locker(Compile_lock, thread);
     system_dictionary_modification_counter = SystemDictionary::number_of_modifications();
   }
-#ifdef COMPILERJVMCI
+#if INCLUDE_JVMCI
   if (comp != NULL && comp->is_jvmci()) {
     JVMCICompiler* jvmci = (JVMCICompiler*) comp;
 
@@ -2203,7 +2209,7 @@
     }
 
   } else
-#endif // COMPILERJVMCI
+#endif // INCLUDE_JVMCI
   {
     NoHandleMark  nhm;
     ThreadToNativeFromVM ttn(thread);
@@ -2650,10 +2656,10 @@
   total_compilation.add(osr_compilation);
   total_compilation.add(standard_compilation);
 
-#ifndef COMPILERJVMCI
-  // In hosted mode, print the JVMCI compiler specific counters manually.
-  JVMCICompiler::print_compilation_timers();
-#endif
+  if (!UseJVMCICompiler) {
+    // In hosted mode, print the JVMCI compiler specific counters manually.
+    JVMCICompiler::print_compilation_timers();
+  }
 #else
   elapsedTimer standard_compilation = CompileBroker::_t_standard_compilation;
   elapsedTimer osr_compilation = CompileBroker::_t_osr_compilation;
--- a/src/share/vm/compiler/compileBroker.hpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/compiler/compileBroker.hpp	Tue May 24 13:51:28 2016 +0200
@@ -57,7 +57,7 @@
   bool         _is_complete;
   bool         _is_success;
   bool         _is_blocking;
-#ifdef COMPILERJVMCI
+#if INCLUDE_JVMCI
   bool         _has_waiter;
   // Compiler thread for a blocking JVMCI compilation
   CompilerThread* _jvmci_compiler_thread;
@@ -93,7 +93,7 @@
   bool         is_complete() const               { return _is_complete; }
   bool         is_blocking() const               { return _is_blocking; }
   bool         is_success() const                { return _is_success; }
-#ifdef COMPILERJVMCI
+#if INCLUDE_JVMCI
   bool         has_waiter() const                { return _has_waiter; }
   void         clear_waiter()                    { _has_waiter = false; }
   CompilerThread* jvmci_compiler_thread() const  { return _jvmci_compiler_thread; }
@@ -374,7 +374,7 @@
                                           const char*   comment,
                                           bool          blocking);
   static void wait_for_completion(CompileTask* task);
-#ifdef COMPILERJVMCI
+#if INCLUDE_JVMCI
   static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread);
 #endif
 
--- a/src/share/vm/compiler/oopMap.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/compiler/oopMap.cpp	Tue May 24 13:51:28 2016 +0200
@@ -320,7 +320,6 @@
 static void add_derived_oop(oop* base, oop* derived) {
 #ifndef TIERED
   COMPILER1_PRESENT(ShouldNotReachHere();)
-  COMPILERJVMCI_PRESENT(ShouldNotReachHere();)
 #endif // TIERED
 #if defined(COMPILER2) || INCLUDE_JVMCI
   DerivedPointerTable::add(derived, base);
@@ -382,7 +381,6 @@
     if (!oms.is_done()) {
 #ifndef TIERED
       COMPILER1_PRESENT(ShouldNotReachHere();)
-      COMPILERJVMCI_PRESENT(ShouldNotReachHere();)
 #endif // !TIERED
       // Protect the operation on the derived pointers.  This
       // protects the addition of derived pointers to the shared
@@ -512,7 +510,6 @@
 bool OopMap::has_derived_pointer() const {
 #ifndef TIERED
   COMPILER1_PRESENT(return false);
-  COMPILERJVMCI_PRESENT(return false);
 #endif // !TIERED
 #if defined(COMPILER2) || INCLUDE_JVMCI
   OopMapStream oms((OopMap*)this,OopMapValue::derived_oop_value);
--- a/src/share/vm/gc_interface/collectedHeap.hpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/gc_interface/collectedHeap.hpp	Tue May 24 13:51:28 2016 +0200
@@ -95,7 +95,7 @@
   GCHeapLog* _gc_heap_log;
 
   // Used in support of ReduceInitialCardMarks; only consulted if COMPILER2
-  // or COMPILERJVMCI is being used
+  // or INCLUDE_JVMCI is being used
   bool _defer_initial_card_mark;
 
  protected:
--- a/src/share/vm/jvmci/jvmciCompiler.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/jvmci/jvmciCompiler.cpp	Tue May 24 13:51:28 2016 +0200
@@ -35,19 +35,16 @@
 elapsedTimer JVMCICompiler::_codeInstallTimer;
 
 JVMCICompiler::JVMCICompiler() : AbstractCompiler(jvmci) {
-#ifdef COMPILERJVMCI
   _bootstrapping = false;
   _bootstrap_compilation_request_handled = false;
   _methods_compiled = 0;
-#endif
   assert(_instance == NULL, "only one instance allowed");
   _instance = this;
 }
 
 // Initialization
 void JVMCICompiler::initialize() {
-#ifdef COMPILERJVMCI
-  if (!UseCompiler || !should_perform_init()) {
+  if (!UseCompiler || !UseJVMCICompiler || !should_perform_init()) {
     return;
   }
 
@@ -56,10 +53,8 @@
   // JVMCI is considered as application code so we need to
   // stop the VM deferring compilation now.
   CompilationPolicy::completed_vm_startup();
-#endif // COMPILERJVMCI
 }
 
-#ifdef COMPILERJVMCI
 void JVMCICompiler::bootstrap(TRAPS) {
   if (Arguments::mode() == Arguments::_int) {
     // Nothing to do in -Xint mode
@@ -203,8 +198,6 @@
   print_compilation_timers();
 }
 
-#endif // COMPILERJVMCI
-
 // Print compilation timers and statistics
 void JVMCICompiler::print_compilation_timers() {
   TRACE_jvmci_1("JVMCICompiler::print_timers");
--- a/src/share/vm/jvmci/jvmciCompiler.hpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/jvmci/jvmciCompiler.hpp	Tue May 24 13:51:28 2016 +0200
@@ -31,7 +31,6 @@
 
 private:
 
-#ifdef COMPILERJVMCI
   bool _bootstrapping;
 
   /**
@@ -45,8 +44,6 @@
    */
   volatile int  _methods_compiled;
 
-#endif
-
   static JVMCICompiler* _instance;
  
   static elapsedTimer _codeInstallTimer;
@@ -71,8 +68,6 @@
   // Initialization
   virtual void initialize();
 
-#ifdef COMPILERJVMCI
-
   /**
    * Initialize the compile queue with the methods in java.lang.Object and
    * then wait until the queue is empty.
@@ -97,8 +92,6 @@
    */
   int methods_compiled() { return _methods_compiled; }
 
-#endif // COMPILERJVMCI
-
   // Print compilation timers and statistics
   static void print_compilation_timers();
 
--- a/src/share/vm/jvmci/jvmciRuntime.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/jvmci/jvmciRuntime.cpp	Tue May 24 13:51:28 2016 +0200
@@ -954,12 +954,10 @@
 }
 
 CompLevel JVMCIRuntime::adjust_comp_level_inner(methodHandle method, bool is_osr, CompLevel level, JavaThread* thread) {
-#ifdef COMPILERJVMCI
   JVMCICompiler* compiler = JVMCICompiler::instance(thread);
   if (compiler != NULL && compiler->is_bootstrapping()) {
     return level;
   }
-#endif
   if (!is_HotSpotJVMCIRuntime_initialized() || !_comp_level_adjustment) {
     // JVMCI cannot participate in compilation scheduling until
     // JVMCI is initialized and indicates it wants to participate.
--- a/src/share/vm/jvmci/jvmci_globals.hpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/jvmci/jvmci_globals.hpp	Tue May 24 13:51:28 2016 +0200
@@ -46,23 +46,29 @@
 //
 #define JVMCI_FLAGS(develop, develop_pd, product, product_pd, notproduct)   \
                                                                             \
+  product(bool, EnableJVMCI, true,                                          \
+          "Enable JVMCI")                                                   \
+                                                                            \
+  product(bool, UseJVMCICompiler, false,                                    \
+          "Use JVMCI as the default compiler")                              \
+                                                                            \
   product(bool, UseJVMCIClassLoader, true,                                  \
           "Load JVMCI classes with separate class loader")                  \
                                                                             \
   product(ccstr, JVMCIServicesDir, NULL,                                    \
           "Alternate directory to use for JVMCI services")                  \
                                                                             \
-  COMPILERJVMCI_PRESENT(product(bool, BootstrapJVMCI, false,                \
-          "Bootstrap JVMCI before running Java main method"))               \
+  product(bool, BootstrapJVMCI, false,                                      \
+          "Bootstrap JVMCI before running Java main method")                \
                                                                             \
-  COMPILERJVMCI_PRESENT(product(bool, PrintBootstrap, true,                 \
-          "Print JVMCI bootstrap progress and summary"))                    \
+  product(bool, PrintBootstrap, true,                                       \
+          "Print JVMCI bootstrap progress and summary")                     \
                                                                             \
-  COMPILERJVMCI_PRESENT(product(intx, JVMCIThreads, 1,                      \
-          "Force number of JVMCI compiler threads to use"))                 \
+  product(intx, JVMCIThreads, 1,                                            \
+          "Force number of JVMCI compiler threads to use")                  \
                                                                             \
-  COMPILERJVMCI_PRESENT(product(intx, JVMCIHostThreads, 1,                  \
-          "Force number of compiler threads for JVMCI host compiler"))      \
+  product(intx, JVMCIHostThreads, 1,                                        \
+          "Force number of compiler threads for JVMCI host compiler")       \
                                                                             \
   JVMCI_ONLY(product(bool, CodeInstallSafepointChecks, true,                \
           "Perform explicit safepoint checks while installing code"))       \
--- a/src/share/vm/prims/jni.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/prims/jni.cpp	Tue May 24 13:51:28 2016 +0200
@@ -5204,15 +5204,17 @@
     *vm = (JavaVM *)(&main_vm);
     *(JNIEnv**)penv = thread->jni_environment();
 
-#ifdef COMPILERJVMCI
-    // JVMCI is initialized on a CompilerThread
-    if (BootstrapJVMCI) {
-      JavaThread* THREAD = thread;
-      JVMCICompiler* compiler = JVMCICompiler::instance(CATCH);
-      compiler->bootstrap(THREAD);
-      if (HAS_PENDING_EXCEPTION) {
-        HandleMark hm;
-        vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));
+#if INCLUDE_JVMCI
+    if (UseJVMCICompiler) {
+      // JVMCI is initialized on a CompilerThread
+      if (BootstrapJVMCI) {
+        JavaThread* THREAD = thread;
+        JVMCICompiler* compiler = JVMCICompiler::instance(CATCH);
+        compiler->bootstrap(THREAD);
+        if (HAS_PENDING_EXCEPTION) {
+          HandleMark hm;
+          vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));
+        }
       }
     }
 #endif
--- a/src/share/vm/prims/jvm.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/prims/jvm.cpp	Tue May 24 13:51:28 2016 +0200
@@ -383,7 +383,7 @@
     const char* compiler_name = "HotSpot " CSIZE "Client Compiler";
 #elif defined(COMPILER2)
     const char* compiler_name = "HotSpot " CSIZE "Server Compiler";
-#elif defined(COMPILERJVMCI)
+#elif defined(INCLUDE_JVMCI)
     const char* compiler_name = "HotSpot " CSIZE "JVMCI Compiler";
 #else
     const char* compiler_name = "";
--- a/src/share/vm/runtime/advancedThresholdPolicy.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp	Tue May 24 13:51:28 2016 +0200
@@ -25,7 +25,7 @@
 #include "precompiled.hpp"
 #include "runtime/advancedThresholdPolicy.hpp"
 #include "runtime/simpleThresholdPolicy.inline.hpp"
-#ifdef COMPILERJVMCI
+#if INCLUDE_JVMCI
 #include "jvmci/jvmciRuntime.hpp"
 #endif
 
@@ -164,9 +164,7 @@
 
 // Called with the queue locked and with at least one element
 CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) {
-#ifdef COMPILERJVMCI
   CompileTask *max_blocking_task = NULL;
-#endif
   CompileTask *max_task = NULL;
   Method* max_method = NULL;
   jlong t = os::javaTimeMillis();
@@ -197,17 +195,14 @@
         max_method = method;
       }
     }
-#ifdef COMPILERJVMCI
     if (task->is_blocking()) {
       if (max_blocking_task == NULL || compare_methods(method, max_blocking_task->method())) {
         max_blocking_task = task;
       }
     }
-#endif
     task = next_task;
   }
 
-#ifdef COMPILERJVMCI
   if (max_blocking_task != NULL) {
     // In blocking compilation mode, the CompileBroker will make
     // compilations submitted by a JVMCI compiler thread non-blocking. These
@@ -217,7 +212,6 @@
     max_task = max_blocking_task;
     max_method = max_task->method();
   }
-#endif
 
   if (max_task->comp_level() == CompLevel_full_profile && TieredStopAtLevel > CompLevel_full_profile
       && is_method_profiled(max_method)) {
@@ -374,11 +368,14 @@
       if (common(p, method, CompLevel_full_profile, disable_feedback) == CompLevel_full_optimization) {
         next_level = CompLevel_full_optimization;
       } else if ((this->*p)(i, b, cur_level)) {
-#ifdef COMPILERJVMCI
-        // Since JVMCI takes a while to warm up, its queue inevitably backs up during
-        // early VM execution.
-        next_level = CompLevel_full_profile;
-#else
+#if INCLUDE_JVMCI
+        if (UseJVMCICompiler) {
+          // Since JVMCI takes a while to warm up, its queue inevitably backs up during
+          // early VM execution.
+          next_level = CompLevel_full_profile;
+          break;
+        }
+#endif
         // C1-generated fully profiled code is about 30% slower than the limited profile
         // code that has only invocation and backedge counters. The observation is that
         // if C2 queue is large enough we can spend too much time in the fully profiled code
@@ -392,7 +389,6 @@
         } else {
           next_level = CompLevel_full_profile;
         }
-#endif
       }
       break;
     case CompLevel_limited_profile:
@@ -453,7 +449,11 @@
   } else {
     next_level = MAX2(osr_level, next_level);
   }
-  COMPILERJVMCI_PRESENT(next_level = JVMCIRuntime::adjust_comp_level(method, false, next_level, thread);)
+#if INCLUDE_JVMCI
+  if (UseJVMCICompiler) {
+    next_level = JVMCIRuntime::adjust_comp_level(method, false, next_level, thread);
+  }
+#endif
   return next_level;
 }
 
@@ -468,7 +468,11 @@
       return osr_level;
     }
   }
-  COMPILERJVMCI_PRESENT(next_level = JVMCIRuntime::adjust_comp_level(method, true, next_level, thread);)
+#if INCLUDE_JVMCI
+  if (UseJVMCICompiler) {
+    next_level = JVMCIRuntime::adjust_comp_level(method, true, next_level, thread);
+  }
+#endif
   return next_level;
 }
 
--- a/src/share/vm/runtime/arguments.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/runtime/arguments.cpp	Tue May 24 13:51:28 2016 +0200
@@ -1168,7 +1168,7 @@
  *    the minimum number of compiler threads is 2.
  */
 int Arguments::get_min_number_of_compiler_threads() {
-#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) && !defined(COMPILERJVMCI)
+#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) && !INCLUDE_JVMCI
   return 0;   // case 1
 #else
   if (!TieredCompilation || (TieredStopAtLevel < CompLevel_full_optimization)) {
@@ -2444,9 +2444,15 @@
 #endif
   }
 #if INCLUDE_JVMCI
+  if (!EnableJVMCI) {
+    warning("ignoring flag -EnableJVMCI, JVMCI can not be disabled in this VM");
+  }
+  if (BootstrapJVMCI && !UseJVMCICompiler) {
+    warning("BootstrapJVMCI has no effect if UseJVMCICompiler is disabled");
+  }
   if (!ScavengeRootsInCode) {
-      warning("forcing ScavengeRootsInCode non-zero because JVMCI is enabled");
-      ScavengeRootsInCode = 1;
+    warning("forcing ScavengeRootsInCode non-zero because JVMCI is enabled");
+    ScavengeRootsInCode = 1;
   }
 #endif
 
@@ -2513,9 +2519,11 @@
   // Check the minimum number of compiler threads
   status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount");
 
-#if (INCLUDE_JVMCI && defined(COMPILERJVMCI))
-  // Check the minimum number of JVMCI compiler threads
-  status &=verify_min_value(JVMCIThreads, 1, "JVMCIThreads");
+#if INCLUDE_JVMCI
+  if (UseJVMCICompiler) {
+    // Check the minimum number of JVMCI compiler threads
+    status &=verify_min_value(JVMCIThreads, 1, "JVMCIThreads");
+  }
 #endif
 
   return status;
@@ -3633,7 +3641,7 @@
     FLAG_SET_ERGO(uintx, InitialTenuringThreshold, MaxTenuringThreshold);
   }
 
-#if !defined(COMPILER2) && !defined(COMPILERJVMCI)
+#if !defined(COMPILER2) && !INCLUDE_JVMCI
   // Don't degrade server performance for footprint
   if (FLAG_IS_DEFAULT(UseLargePages) &&
       MaxHeapSize < LargePageHeapSizeThreshold) {
--- a/src/share/vm/runtime/compilationPolicy.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/runtime/compilationPolicy.cpp	Tue May 24 13:51:28 2016 +0200
@@ -188,8 +188,8 @@
 }
 
 CompileTask* CompilationPolicy::select_task_helper(CompileQueue* compile_queue) {
-#ifdef COMPILERJVMCI
-  if (!BackgroundCompilation) {
+#if INCLUDE_JVMCI
+  if (UseJVMCICompiler && !BackgroundCompilation) {
     /*
      * In blocking compilation mode, the CompileBroker will make
      * compilations submitted by a JVMCI compiler thread non-blocking. These
@@ -247,7 +247,7 @@
 // - if neither is defined - always return zero.
 int NonTieredCompPolicy::compiler_count(CompLevel comp_level) {
   assert(!TieredCompilation, "This policy should not be used with TieredCompilation");
-#if defined(COMPILER2) || defined(COMPILERJVMCI)
+#ifdef COMPILER2
   if (is_c2_compile(comp_level)) {
     return _compiler_count;
   } else {
--- a/src/share/vm/runtime/deoptimization.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/runtime/deoptimization.cpp	Tue May 24 13:51:28 2016 +0200
@@ -519,7 +519,7 @@
   assert(CodeCache::find_blob_unsafe(frame_pcs[0]) != NULL, "bad pc");
 #endif // SHARK
 
-#ifdef INCLUDE_JVMCI
+#if INCLUDE_JVMCI
   if (exceptionObject() != NULL) {
     thread->set_exception_oop(exceptionObject());
     exec_mode = Unpack_exception;
--- a/src/share/vm/runtime/deoptimization.hpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/runtime/deoptimization.hpp	Tue May 24 13:51:28 2016 +0200
@@ -315,10 +315,6 @@
   }
   static int make_trap_request(DeoptReason reason, DeoptAction action,
                                int index = -1) {
-#if defined(COMPILERJVMCI) && !defined(COMPILER1) && !defined(COMPILER2)
-    assert(index == -1, "JVMCI does not use index");
-#endif
-
     assert((1 << _reason_bits) >= Reason_LIMIT, "enough bits");
     assert((1 << _action_bits) >= Action_LIMIT, "enough bits");
     int trap_request;
--- a/src/share/vm/runtime/globals.hpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/runtime/globals.hpp	Tue May 24 13:51:28 2016 +0200
@@ -129,7 +129,7 @@
 # include "c1_globals_bsd.hpp"
 #endif
 #endif
-#ifdef COMPILERJVMCI 
+#if INCLUDE_JVMCI
 #ifdef TARGET_ARCH_x86
 # include "jvmci_globals_x86.hpp"
 #endif
@@ -142,7 +142,7 @@
 #ifdef TARGET_ARCH_ppc
 # include "jvmci_globals_ppc.hpp"
 #endif
-#endif // COMPILERJVMCI
+#endif // INCLUDE_JVMCI
 #ifdef COMPILER2
 #ifdef TARGET_ARCH_x86
 # include "c2_globals_x86.hpp"
@@ -178,7 +178,7 @@
 #endif
 #endif
 
-#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) && !defined(COMPILERJVMCI)
+#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) && !INCLUDE_JVMCI
 define_pd_global(bool, BackgroundCompilation,        false);
 define_pd_global(bool, UseTLAB,                      false);
 define_pd_global(bool, CICompileOSR,                 false);
@@ -210,7 +210,7 @@
 #define CI_COMPILER_COUNT 0
 #else
 
-#if defined(COMPILER2) || defined(COMPILERJVMCI)
+#if defined(COMPILER2) || INCLUDE_JVMCI
 #define CI_COMPILER_COUNT 2
 #else
 #define CI_COMPILER_COUNT 1
--- a/src/share/vm/runtime/java.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/runtime/java.cpp	Tue May 24 13:51:28 2016 +0200
@@ -283,7 +283,7 @@
   }
 #endif // ASSERT
 #else
-#ifdef INCLUDE_JVMCI
+#if INCLUDE_JVMCI
 #ifndef COMPILER1
   if ((TraceDeoptimization || LogVMOutput || LogCompilation) && UseCompiler) {
     FlagSetting fs(DisplayVMOutput, DisplayVMOutput && TraceDeoptimization);
--- a/src/share/vm/runtime/simpleThresholdPolicy.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp	Tue May 24 13:51:28 2016 +0200
@@ -29,7 +29,7 @@
 #include "runtime/simpleThresholdPolicy.hpp"
 #include "runtime/simpleThresholdPolicy.inline.hpp"
 #include "code/scopeDesc.hpp"
-#ifdef COMPILERJVMCI
+#if INCLUDE_JVMCI
 #include "jvmci/jvmciRuntime.hpp"
 #endif
 
@@ -360,7 +360,11 @@
   } else {
     next_level = MAX2(osr_level, next_level);
   }
-  COMPILERJVMCI_PRESENT(next_level = JVMCIRuntime::adjust_comp_level(method, false, next_level, thread);)
+#if INCLUDE_JVMCI
+  if (UseJVMCICompiler) {
+    next_level = JVMCIRuntime::adjust_comp_level(method, false, next_level, thread);
+  }
+#endif
   return next_level;
 }
 
@@ -375,7 +379,11 @@
       return osr_level;
     }
   }
-  COMPILERJVMCI_PRESENT(next_level = JVMCIRuntime::adjust_comp_level(method, true, next_level, thread);)
+#if INCLUDE_JVMCI
+  if (UseJVMCICompiler) {
+    next_level = JVMCIRuntime::adjust_comp_level(method, true, next_level, thread);
+  }
+#endif
   return next_level;
 }
 
--- a/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp	Tue May 24 13:51:28 2016 +0200
@@ -58,10 +58,12 @@
       method->is_constant_getter()) {
     return true;
   }
-#ifdef COMPILERJVMCI
-  if (TieredCompilation && CompileBroker::compiler(CompLevel_full_optimization) != NULL &&
-      CompileBroker::compiler(CompLevel_full_optimization)->is_trivial(method)) {
-    return true;
+#if INCLUDE_JVMCI
+  if (UseJVMCICompiler) {
+    if (TieredCompilation && CompileBroker::compiler(CompLevel_full_optimization) != NULL &&
+        CompileBroker::compiler(CompLevel_full_optimization)->is_trivial(method)) {
+      return true;
+    }
   }
 #endif
   if (method->has_loops() || method->code_size() >= 15) {
--- a/src/share/vm/runtime/thread.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/runtime/thread.cpp	Tue May 24 13:51:28 2016 +0200
@@ -3308,11 +3308,11 @@
 #endif
 }
 
-#ifdef COMPILERJVMCI
+#if INCLUDE_JVMCI
 bool CompilerThread::can_call_java() const {
   return _compiler != NULL && _compiler->is_jvmci();
 }
-#endif
+#endif // INCLUDE_JVMCI
 
 void CompilerThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) {
   JavaThread::oops_do(f, cld_f, cf);
@@ -3710,7 +3710,7 @@
   }
 
   // initialize compiler(s)
-#if defined(COMPILER1) || defined(COMPILER2) || defined(SHARK) || defined(COMPILERJVMCI)
+#if defined(COMPILER1) || defined(COMPILER2) || defined(SHARK) || INCLUDE_JVMCI
   CompileBroker::compilation_init(THREAD);
   if (HAS_PENDING_EXCEPTION) {
     vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));
--- a/src/share/vm/runtime/thread.hpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/runtime/thread.hpp	Tue May 24 13:51:28 2016 +0200
@@ -1917,7 +1917,7 @@
 
   bool is_Compiler_thread() const                { return true; }
 
-#ifdef COMPILERJVMCI
+#if INCLUDE_JVMCI
   virtual bool can_call_java() const;
 #else
   virtual bool can_call_java() const             { return false; }
--- a/src/share/vm/runtime/vm_version.cpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/runtime/vm_version.cpp	Tue May 24 13:51:28 2016 +0200
@@ -112,11 +112,7 @@
 
 #ifndef VMTYPE
   #ifdef TIERED
-    #ifdef COMPILERJVMCI
-      #define VMTYPE "JVMCI"
-    #else // COMPILERJVMCI
-      #define VMTYPE "Server"
-    #endif // COMPILERJVMCI
+    #define VMTYPE "Server"
   #else // TIERED
     #ifdef ZERO
       #ifdef SHARK
@@ -126,8 +122,7 @@
       #endif // SHARK
     #else // ZERO
       #define VMTYPE COMPILER1_PRESENT("Client")   \
-                     COMPILER2_PRESENT("Server")   \
-                     COMPILERJVMCI_PRESENT("JVMCI")
+                     COMPILER2_PRESENT("Server")
     #endif // ZERO
   #endif // TIERED
 #endif
--- a/src/share/vm/utilities/globalDefinitions.hpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/utilities/globalDefinitions.hpp	Tue May 24 13:51:28 2016 +0200
@@ -896,7 +896,7 @@
   CompLevel_full_profile      = 3,         // C1, invocation & backedge counters + mdo
   CompLevel_full_optimization = 4,         // C2, Shark or JVMCI
 
-#if defined(COMPILER2) || defined(SHARK) || defined(COMPILERJVMCI)
+#if defined(COMPILER2) || defined(SHARK) || INCLUDE_JVMCI
   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
@@ -906,7 +906,7 @@
 
 #if defined(TIERED)
   CompLevel_initial_compile   = CompLevel_full_profile        // tiered
-#elif defined(COMPILER1) || defined(COMPILERJVMCI)
+#elif defined(COMPILER1)
   CompLevel_initial_compile   = CompLevel_simple              // pure C1 or JVMCI
 #elif defined(COMPILER2) || defined(SHARK)
   CompLevel_initial_compile   = CompLevel_full_optimization   // pure C2
--- a/src/share/vm/utilities/macros.hpp	Fri May 20 15:49:00 2016 +0200
+++ b/src/share/vm/utilities/macros.hpp	Tue May 24 13:51:28 2016 +0200
@@ -180,7 +180,7 @@
 
 // COMPILER1 variant
 #ifdef COMPILER1
-#if defined(COMPILER2) || defined(COMPILERJVMCI)
+#if defined(COMPILER2) || INCLUDE_JVMCI
   #define TIERED
 #endif
 #define COMPILER1_PRESENT(code) code
@@ -197,20 +197,15 @@
 #define NOT_COMPILER2(code) code
 #endif // COMPILER2
 
-#ifdef COMPILERJVMCI
-#define COMPILERJVMCI_PRESENT(code) code
-#define NOT_COMPILERJVMCI(code)
-#else // COMPILERJVMCI
-#define COMPILERJVMCI_PRESENT(code)
-#define NOT_COMPILERJVMCI(code) code
-#endif // COMPILERJVMCI
-
-#if defined(COMPILERJVMCI) && !INCLUDE_JVMCI
-#error "COMPILERJVMCI needs INCLUDE_JVMCI=1"
-#endif
-
-#if defined(COMPILERJVMCI) && defined(COMPILER2)
-#error "COMPILERJVMCI is mutually exclusive with COMPILER2"
+// COMPILER2 or JVMCI
+#if defined(COMPILER2) || INCLUDE_JVMCI
+#define COMPILER2_OR_JVMCI 1
+#define COMPILER2_OR_JVMCI_PRESENT(code) code
+#define NOT_COMPILER2_OR_JVMCI(code)
+#else
+#define COMPILER2_OR_JVMCI 0
+#define COMPILER2_OR_JVMCI_PRESENT(code)
+#define NOT_COMPILER2_OR_JVMCI(code) code
 #endif
 
 #ifdef TIERED