< prev index next >
src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java
Print this page
rev 12121 : 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
@@ -24,22 +24,24 @@
import jdk.vm.ci.code.CompilationRequest;
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.Option;
import jdk.vm.ci.runtime.JVMCICompiler;
+import jdk.vm.ci.runtime.JVMCICompilerFactory;
import jdk.vm.ci.runtime.JVMCIRuntime;
-import jdk.vm.ci.runtime.services.JVMCICompilerFactory;
+import jdk.vm.ci.services.JVMCIServiceLocator;
+import jdk.vm.ci.services.JVMCIPermission;
import jdk.vm.ci.services.Services;
final class HotSpotJVMCICompilerConfig {
/**
* This factory allows JVMCI initialization to succeed but raises an error if the VM asks JVMCI
* to perform a compilation. This allows the reflective parts of the JVMCI API to be used
* without requiring a compiler implementation to be available.
*/
- private static class DummyCompilerFactory extends JVMCICompilerFactory implements JVMCICompiler {
+ private static class DummyCompilerFactory implements JVMCICompilerFactory, JVMCICompiler {
public HotSpotCompilationRequestResult compileMethod(CompilationRequest request) {
throw new JVMCIError("no JVMCI compiler selected");
}
@@ -61,28 +63,29 @@
/**
* Gets the selected system compiler factory.
*
* @return the selected system compiler factory
+ * @throws SecurityException if a security manager is present and it denies
+ * {@link JVMCIPermission} for any {@link JVMCIServiceLocator} loaded by this method
*/
static JVMCICompilerFactory getCompilerFactory() {
if (compilerFactory == null) {
JVMCICompilerFactory factory = null;
String compilerName = Option.Compiler.getString();
if (compilerName != null) {
- for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
+ for (JVMCICompilerFactory f : JVMCIServiceLocator.getProviders(JVMCICompilerFactory.class)) {
if (f.getCompilerName().equals(compilerName)) {
- Services.exportJVMCITo(f.getClass());
factory = f;
}
}
if (factory == null) {
throw new JVMCIError("JVMCI compiler '%s' not found", compilerName);
}
} else {
// Auto select a single available compiler
- for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
+ for (JVMCICompilerFactory f : JVMCIServiceLocator.getProviders(JVMCICompilerFactory.class)) {
if (factory == null) {
factory = f;
} else {
// Multiple factories seen - cancel auto selection
factory = null;
< prev index next >