changeset 9936:0927013db134

fail fast if a non-default value for GraalRuntime was specified and the corresponding factory is not available
author Doug Simon <doug.simon@oracle.com>
date Fri, 07 Jun 2013 15:59:46 +0200
parents 2a091d2987bd
children 4f5e5bb03184
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Fri Jun 07 15:59:09 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Fri Jun 07 15:59:46 2013 +0200
@@ -31,6 +31,7 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.target.*;
+import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.logging.*;
 import com.oracle.graal.hotspot.meta.*;
@@ -87,9 +88,11 @@
         runtime.compilerToVm = toVM;
     }
 
+    private static final String DEFAULT_GRAAL_RUNTIME = "basic";
+
     // @formatter:off
     @Option(help = "The runtime configuration to use")
-    private static final OptionValue<String> GraalRuntime = new OptionValue<>("basic");
+    private static final OptionValue<String> GraalRuntime = new OptionValue<>(DEFAULT_GRAAL_RUNTIME);
     // @formatter:on
 
     protected static HotSpotGraalRuntimeFactory findFactory(String architecture) {
@@ -98,6 +101,11 @@
                 return factory;
             }
         }
+        if (!DEFAULT_GRAAL_RUNTIME.equals(GraalRuntime.getValue())) {
+            // Fail fast if a non-default value for GraalRuntime was specified
+            // and the corresponding factory is not available
+            throw new GraalInternalError("Specified runtime \"%s\" not available for the %s architecture", GraalRuntime.getValue(), architecture);
+        }
         return null;
     }