changeset 24132:42cc0c2dd4a7

support -DjvmciCompiler=null as a way to prevent JVMCI compiler auto-selection
author Doug Simon <doug.simon@oracle.com>
date Fri, 21 Apr 2017 16:49:50 +0200
parents 0e0a4ebf09d7
children 3f81f36d2c99
files jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java
diffstat 2 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java	Wed Apr 19 09:00:56 2017 -0700
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java	Fri Apr 21 16:49:50 2017 +0200
@@ -47,7 +47,7 @@
 
         @Override
         public String getCompilerName() {
-            return "<none>";
+            return "null";
         }
 
         @Override
@@ -73,13 +73,17 @@
             JVMCICompilerFactory factory = null;
             String compilerName = Option.Compiler.getString();
             if (compilerName != null) {
-                for (JVMCICompilerFactory f : JVMCIServiceLocator.getProviders(JVMCICompilerFactory.class)) {
-                    if (f.getCompilerName().equals(compilerName)) {
-                        factory = f;
+                if (compilerName.isEmpty() || compilerName.equals("null")) {
+                    factory = new DummyCompilerFactory();
+                } else {
+                    for (JVMCICompilerFactory f : JVMCIServiceLocator.getProviders(JVMCICompilerFactory.class)) {
+                        if (f.getCompilerName().equals(compilerName)) {
+                            factory = f;
+                        }
                     }
-                }
-                if (factory == null) {
-                    throw new JVMCIError("JVMCI compiler '%s' not found", compilerName);
+                    if (factory == null) {
+                        throw new JVMCIError("JVMCI compiler '%s' not found", compilerName);
+                    }
                 }
             } else {
                 // Auto select a single available compiler
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Wed Apr 19 09:00:56 2017 -0700
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Fri Apr 21 16:49:50 2017 +0200
@@ -88,7 +88,10 @@
      */
     public enum Option {
         // @formatter:off
-        Compiler(String.class, null, "Selects the system compiler."),
+        Compiler(String.class, null, "Selects the system compiler. This must match the getCompilerName() value returned " +
+                        "by a jdk.vm.ci.runtime.JVMCICompilerFactory provider. " +
+                        "An empty string or the value \"null\" selects a compiler " +
+                        "that will raise an exception upon receiving a compilation request."),
         // Note: The following one is not used (see InitTimer.ENABLED). It is added here
         // so that -XX:+JVMCIPrintProperties shows the option.
         InitTimer(Boolean.class, false, "Specifies if initialization timing is enabled."),