< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/GraalServices.java
Print this page
rev 52509 : [mq]: graal
@@ -32,10 +32,11 @@
import java.util.List;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.concurrent.atomic.AtomicLong;
+import jdk.vm.ci.runtime.JVMCI;
import jdk.vm.ci.services.JVMCIPermission;
import jdk.vm.ci.services.Services;
/**
* Interface to functionality that abstracts over which JDK version Graal is running on.
@@ -74,11 +75,10 @@
*
* @throws SecurityException if on JDK8 and a security manager is present and it denies
* {@link JVMCIPermission}
*/
public static <S> Iterable<S> load(Class<S> service) {
- assert !service.getName().startsWith("jdk.vm.ci") : "JVMCI services must be loaded via " + Services.class.getName();
Iterable<S> iterable = ServiceLoader.load(service);
return new Iterable<>() {
@Override
public Iterator<S> iterator() {
Iterator<S> iterator = iterable.iterator();
@@ -115,10 +115,15 @@
Module jvmciModule = JVMCI_MODULE;
Module otherModule = other.getModule();
if (jvmciModule != otherModule) {
for (String pkg : jvmciModule.getPackages()) {
if (!jvmciModule.isOpen(pkg, otherModule)) {
+ // JVMCI initialization opens all JVMCI packages
+ // to Graal which is a prerequisite for Graal to
+ // open JVMCI packages to other modules.
+ JVMCI.initialize();
+
jvmciModule.addOpens(pkg, otherModule);
}
}
}
}
< prev index next >