Tip of Graal broken with tip of OpenJDK?
Doug Simon
doug.simon at oracle.com
Wed Mar 21 15:01:21 UTC 2018
Sorry, that was my fault.
A fix is making its way through our internal gates. Here's the patch if you want to apply it locally:
diff --git a/compiler/src/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/GraalServices.java b/compiler/src/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/GraalServices.java
index 175db95863..1268f4a429 100644
--- a/compiler/src/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/GraalServices.java
+++ b/compiler/src/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/GraalServices.java
@@ -24,6 +24,7 @@ package org.graalvm.compiler.serviceprovider;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.ServiceConfigurationError;
@@ -63,11 +64,25 @@ public final class GraalServices {
* @throws SecurityException if on JDK8 and a security manager is present and it denies
* {@link JVMCIPermission}
*/
+ @SuppressWarnings("unchecked")
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();
- return Services.load(service);
+ try {
+ if (loadMethod == null) {
+ loadMethod = Services.class.getMethod("load", Class.class);
+ }
+ return (Iterable<S>) loadMethod.invoke(null, service);
+ } catch (Exception e) {
+ throw new InternalError(e);
+ }
}
+ /**
+ * {@code Services.load(Class)} is only defined in JVMCI-8 so we use reflection to simplify
+ * compiling with javac on JDK 9 or later.
+ */
+ private static volatile Method loadMethod;
+
/**
* Gets the provider for a given service for which at most one provider must be available.
*
> On 21 Mar 2018, at 15:42, stewartd.qdt <stewartd.qdt at qualcommdatacenter.com> wrote:
>
> After sync'ing to the tip of both Graal and OpenJDK, I get an error building Graal. I get the following error:
>
> Compiling com.oracle.truffle.api.dsl with javac-daemon... [/home/stewartd/openjdk/stewartd-graal/truffle/mxbuild/src/com.oracle.truffle.api.dsl/bin/META-INF/upgrade/truffle.api.dsl.Specialization.hint[2018-03-19 14:49:11] is older than /home/stewartd/openjdk/stewartd-graal/truffle/mxbuild/src/com.oracle.truffle.api/bin/com/oracle/truffle/api/nodes/NodeUtil.class[2018-03-21 14:23:27]]
> /home/stewartd/openjdk/stewartd-graal/compiler/src/org.graalvm.compiler.serviceprovider/src/org/graalvm/compiler/serviceprovider/GraalServices.java:68: error: cannot find symbol
> return Services.load(service);
> ^
> symbol: method load(Class<S>)
> location: class Services
> where S is a type-variable:
> S extends Object declared in method <S>load(Class<S>)
> 1 error
>
> I believe it was caused by this commit: https://github.com/oracle/graal/commit/a0a2d08f84ca5b78a8b880313a1082cc392c167a
>
> Is this supposed to work with the tip of OpenJDK or only OpenJDK 8?
>
> Thanks,
> Daniel
More information about the graal-dev
mailing list