Graal and JDK11

Bob McWhirter bmcwhirt at redhat.com
Fri Apr 19 09:42:58 UTC 2019


Yah I’ve been using jdk11 and “my native-image” on aarch64. This push has
been to produce a JDK11 based distro with a binary bin/native-image etc.

Hit a few things including the server issue. But just trying to work out
the mx changes etc to produce a latest_graal_home and such.

I’ll keep trucking.

Bob

On Fri, Apr 19, 2019 at 4:52 AM Paul Woegerer <paul.woegerer at oracle.com>
wrote:

> A while back I added support for Java 11 based image building into native
> image.
>
>
> https://github.com/oracle/graal/commit/ed5f5f82d2962e5f65b3ee784a0cd62c489c41c5
>
> Since then we build images on Java 11 as part of our regular gate tasks.
> E.g. See:
>
>     https://travis-ci.org/oracle/graal/jobs/521993959
>
> If you checkout master and run:
>
>     [master $%=] ~/OLabs/git/svm-master/graal/substratevm> cat Hello.java
>     public class Hello {
>         public static void main(String[] args) {
>             var javaVersion = System.getProperty("java.version");
>             System.out.println("Hello Java " + javaVersion);
>         }
>     }
>
>     [master $%=] ~/OLabs/git/svm-master/graal/substratevm> java --version
>     openjdk 11.0.2 2019-01-15
>     OpenJDK Runtime Environment 18.9 (build 11.0.2+7)
>     OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+7, mixed mode, sharing)
>
>     [master $%=] ~/OLabs/git/svm-master/graal/substratevm> javac Hello.java
>
>     [master $%=] ~/OLabs/git/svm-master/graal/substratevm> mx native-image
> Hello
>     [hello:19205]    classlist:   1,607.95 ms
>     WARNING: An illegal reflective access operation has occurred
>     WARNING: Illegal reflective access by
> com.oracle.svm.core.jdk.FileTypeDetectorFeature
> (file:/home/pwoegere/OLabs/git/svm-master/graal/substratevm/mxbuild/dists/jdk9/svm.jar)
> to field java.nio.file.Files$FileTypeDetectors.installedDetectors
>     WARNING: Please consider reporting this to the maintainers of
> com.oracle.svm.core.jdk.FileTypeDetectorFeature
>     WARNING: Use --illegal-access=warn to enable warnings of further
> illegal reflective access operations
>     WARNING: All illegal access operations will be denied in a future
> release
>     [hello:19205]        (cap):     854.96 ms
>     [hello:19205]        setup:   1,985.61 ms
>     Warning: RecomputeFieldValue.FieldOffset automatic substitution
> failed. The automatic substitution registration was attempted because a
> call to jdk.internal.misc.Unsafe.objectFieldOffset(Class, String) was
> detected in the static initializer of jdk.internal.misc.InnocuousThread.
> Detailed failure reason(s): Could not determine the field where the value
> produced by the call to jdk.internal.misc.Unsafe.objectFieldOffset(Class,
> String) for the field offset computation is stored. The call is not
> directly followed by a field store or by a sign extend node followed
> directly by a field store.
>     Warning: RecomputeFieldValue.FieldOffset automatic substitution
> failed. The automatic substitution registration was attempted because a
> call to jdk.internal.misc.Unsafe.objectFieldOffset(Class, String) was
> detected in the static initializer of jdk.internal.misc.InnocuousThread.
> Detailed failure reason(s): Could not determine the field where the value
> produced by the call to jdk.internal.misc.Unsafe.objectFieldOffset(Class,
> String) for the field offset computation is stored. The call is not
> directly followed by a field store or by a sign extend node followed
> directly by a field store.
>     [hello:19205]   (typeflow):   6,324.79 ms
>     [hello:19205]    (objects):   6,154.23 ms
>     [hello:19205]   (features):     245.79 ms
>     [hello:19205]     analysis:  12,930.88 ms
>     [hello:19205]     universe:     318.56 ms
>     [hello:19205]      (parse):     970.05 ms
>     [hello:19205]     (inline):   1,849.87 ms
>     [hello:19205]    (compile):   8,515.67 ms
>     [hello:19205]      compile:  11,999.75 ms
>     [hello:19205]        image:   1,248.74 ms
>     [hello:19205]        write:     155.05 ms
>     [hello:19205]      [total]:  30,392.57 ms
>
>     [master $%=] ~/OLabs/git/svm-master/graal/substratevm> ./hello
>     Hello Java 11.0.2
>
> You can see that overall native-image works reasonably well for Java 11
> already.
>
> But there is still work to do.
>
> E.g. currently when you build the "native-image" image on Java 11:
>
>     [master $%=] ~/OLabs/git/svm-master/graal/substratevm> mkdir -p
> svmbuild/native-image-root-11/bin
>
>     [master $%=] ~/OLabs/git/svm-master/graal/substratevm> mx native-image
> --tool:native-image -H:Path=svmbuild/native-image-root-11/bin
>     [native-image:20223]    classlist:   1,238.58 ms
>     ...
>     [native-image:20223]        write:     224.72 ms
>     [native-image:20223]      [total]:  40,393.15 ms
>
> And you try to use it you get:
>
>     [master $%=] ~/OLabs/git/svm-master/graal/substratevm>
> svmbuild/native-image-root-11/bin/native-image --tool:native-image
> -H:Path=svmbuild/native-image-root-11/bin
>     Error: Starting image-build server instance failed
>     Caused by: com.oracle.svm.driver.NativeImage$NativeImageError: Could
> not determine port for sending image-build requests.
>     Server stdout/stderr:
>     Exception in thread "main"
> com.oracle.svm.core.util.VMError$HostedError: Static field
> processReaperExecutor of class java.lang.UNIXProcess can't be reset.
> Underlying exception: java.lang.UNIXProcess
>
> (Though, if you use that "native-image" image with --no-server it works
> as expected)
>
> If someone wants to work on Java 11 support while I'm busy with other
> things I suggest looking at the changes brought in by merge commit
>
>
> https://github.com/oracle/graal/commit/ed5f5f82d2962e5f65b3ee784a0cd62c489c41c5
>
> and start improving on that.
>
> HTH,
> Paul
>


More information about the graal-dev mailing list