While trying to get upstream Graal working again with JDK 9, I'm having 
problems with service loading. Graal uses a LayoutFactory service defined by 
Truffle where the latter also includes a provider. The relevant parts of the 
module-info descriptors are:

module com.oracle.truffle.truffle_api {

    exports com.oracle.truffle.object;
    exports com.oracle.truffle.object.basic;

    uses com.oracle.truffle.api.object.LayoutFactory;
    provides com.oracle.truffle.api.object.LayoutFactory with 
com.oracle.truffle.object.basic.DefaultLayoutFactory;

}

module jdk.internal.vm.compiler {
    
    requires transitive com.oracle.truffle.truffle_api;
    uses com.oracle.truffle.api.object.LayoutFactory;

}

However, looking up a provider in Graal[1] returns no providers. As far as I 
understand service loading with modules, this is  because 
jdk.internal.vm.compiler is loaded via the platform class loader while truffle 
is loaded via the app class loader as shown by the output of trace statements I 
added:

GraalTruffleRuntime.class.getClassLoader() -> 
jdk.internal.loader.ClassLoaders$PlatformClassLoader@366e2eef
LayoutFactory.class.getClassLoader() -> 
jdk.internal.loader.ClassLoaders$AppClassLoader@6df97b55

This ability of a platform loaded class to depend on an app loaded class is 
probably due to the soon-to-be-disabled mechanism[2] we use for overriding the 
version of Graal bundled with JDK 9.

Is there some command line magic I can use to make this case work now or do I 
have to wait until [2] is addressed? If the latter, how will it work then?

-Doug

[1] 
https://github.com/graalvm/graal-core/blob/1efc1c543acd7ed447c59788aeabc223be13e774/graal/org.graalvm.compiler.truffle/src/org/graalvm/compiler/truffle/GraalTruffleRuntime.java#L693
[2] http://mail.openjdk.java.net/pipermail/graal-dev/2017-February/004889.html

Reply via email to