Mercurial > hg > truffle
comparison graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java @ 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 | 84890660eefb |
children | 3df534c97af1 |
comparison
equal
deleted
inserted
replaced
9935:2a091d2987bd | 9936:0927013db134 |
---|---|
29 | 29 |
30 import com.oracle.graal.api.code.*; | 30 import com.oracle.graal.api.code.*; |
31 import com.oracle.graal.api.meta.*; | 31 import com.oracle.graal.api.meta.*; |
32 import com.oracle.graal.api.runtime.*; | 32 import com.oracle.graal.api.runtime.*; |
33 import com.oracle.graal.compiler.target.*; | 33 import com.oracle.graal.compiler.target.*; |
34 import com.oracle.graal.graph.*; | |
34 import com.oracle.graal.hotspot.bridge.*; | 35 import com.oracle.graal.hotspot.bridge.*; |
35 import com.oracle.graal.hotspot.logging.*; | 36 import com.oracle.graal.hotspot.logging.*; |
36 import com.oracle.graal.hotspot.meta.*; | 37 import com.oracle.graal.hotspot.meta.*; |
37 import com.oracle.graal.nodes.spi.*; | 38 import com.oracle.graal.nodes.spi.*; |
38 import com.oracle.graal.options.*; | 39 import com.oracle.graal.options.*; |
85 | 86 |
86 runtime.vmToCompiler = toCompiler; | 87 runtime.vmToCompiler = toCompiler; |
87 runtime.compilerToVm = toVM; | 88 runtime.compilerToVm = toVM; |
88 } | 89 } |
89 | 90 |
91 private static final String DEFAULT_GRAAL_RUNTIME = "basic"; | |
92 | |
90 // @formatter:off | 93 // @formatter:off |
91 @Option(help = "The runtime configuration to use") | 94 @Option(help = "The runtime configuration to use") |
92 private static final OptionValue<String> GraalRuntime = new OptionValue<>("basic"); | 95 private static final OptionValue<String> GraalRuntime = new OptionValue<>(DEFAULT_GRAAL_RUNTIME); |
93 // @formatter:on | 96 // @formatter:on |
94 | 97 |
95 protected static HotSpotGraalRuntimeFactory findFactory(String architecture) { | 98 protected static HotSpotGraalRuntimeFactory findFactory(String architecture) { |
96 for (HotSpotGraalRuntimeFactory factory : ServiceLoader.loadInstalled(HotSpotGraalRuntimeFactory.class)) { | 99 for (HotSpotGraalRuntimeFactory factory : ServiceLoader.loadInstalled(HotSpotGraalRuntimeFactory.class)) { |
97 if (factory.getArchitecture().equals(architecture) && factory.getName().equals(GraalRuntime.getValue())) { | 100 if (factory.getArchitecture().equals(architecture) && factory.getName().equals(GraalRuntime.getValue())) { |
98 return factory; | 101 return factory; |
99 } | 102 } |
103 } | |
104 if (!DEFAULT_GRAAL_RUNTIME.equals(GraalRuntime.getValue())) { | |
105 // Fail fast if a non-default value for GraalRuntime was specified | |
106 // and the corresponding factory is not available | |
107 throw new GraalInternalError("Specified runtime \"%s\" not available for the %s architecture", GraalRuntime.getValue(), architecture); | |
100 } | 108 } |
101 return null; | 109 return null; |
102 } | 110 } |
103 | 111 |
104 private static Kind wordKind; | 112 private static Kind wordKind; |