graalvm / graal-js-jdk11-maven-demo

An example project how to run Graal/JavaScript on JDK 11 with Graal as optimizing JIT compiler for best performance.
Universal Permissive License v1.0
177 stars 63 forks source link

fails with jdk12/13/14 #32

Closed urferr closed 4 years ago

urferr commented 4 years ago

the example does not work with JDK12/13/14. It seem that the compiler.jar is not compatible with newer JDK's than 11.

JDK12: [ERROR] testGraalPolyglotSpeed(com.mycompany.app.AppTest) Time elapsed: 0.185 s <<< ERROR! org.graalvm.polyglot.PolyglotException: java.lang.AbstractMethodError: Receiver class org.graalvm.compiler.hotspot.management.HotSpotGraalManagement does not define or inherit an implementation of the resolved method abstract initialize(Lorg/graalvm/compiler/hotspot/HotSpotGraalRuntime;Lorg/graalvm/compiler/hotspot/GraalHotSpotVMConfig;)V of interface org.graalvm.compiler.hotspot.HotSpotGraalManagementRegistration.

JDK13: [ERROR] testGraalPolyglotSpeed(com.mycompany.app.AppTest) Time elapsed: 0.173 s <<< ERROR! org.graalvm.polyglot.PolyglotException: java.lang.AbstractMethodError: Receiver class org.graalvm.compiler.hotspot.management.HotSpotGraalManagement does not define or inherit an implementation of the resolved method 'abstract void initialize(org.graalvm.compiler.hotspot.HotSpotGraalRuntime, org.graalvm.compiler.hotspot.GraalHotSpotVMConfig)' of interface org.graalvm.compiler.hotspot.HotSpotGraalManagementRegistration.

JDK14: [ERROR] testGraalPolyglotSpeed(com.mycompany.app.AppTest) Time elapsed: 0.166 s <<< ERROR! org.graalvm.polyglot.PolyglotException: jdk.vm.ci.common.JVMCIError: expected type markOop but VM field oopDesc::_mark is of type markWord

wirthi commented 4 years ago

Hi,

thanks for your report. Yes, it seems quite challenging currently to get this right for all versions of JDK from 8 to 14.

This has been partly fixed for GraalVM 20.0.1 and 20.1 (https://github.com/graalvm/graaljs/issues/271#issuecomment-614557588). We are currently updating this example to 20.1 (you can easily do that yourself in the pom.xml). There is an additional fix required at least on JDK 11.0.7 that will land in 20.1.1 (and later 20.2): https://github.com/oracle/graal/commit/a6ad2069369c2e1037f655406be86d45c2d256f4.

I have tested the combination of GraalVM 20.1 with JDK 11.0.6, that is working right now - only 11.0.7 is failing with GraalVM 20.1 (it should also work on a recent JDK 14, I have not tested though). For other combinations, you might have to wait for GraalVM 20.1.1.

Best, Christian

urferr commented 4 years ago

I just verified. With JDK14 its working fine.

With JDK12/JDK13 it executes fine but at startup there is the following message:

=== Graal.js via org.graalvm.polyglot.Context === [Use -Dgraal.LogFile= to redirect Graal log output to a file.] Cannot install GraalVM MBean due to Receiver class org.graalvm.compiler.hotspot.management.HotSpotGraalManagement does not define or inherit an implementation of the resolved method abstract initialize(Lorg/graalvm/compiler/hotspot/HotSpotGraalRuntime;Lorg/graalvm/compiler/hotspot/GraalHotSpotVMConfig;)V of interface org.graalvm.compiler.hotspot.HotSpotGraalManagementRegistration. warming up ...

wirthi commented 4 years ago

Hi @urferr

thanks for confirming. The bug you see on 12/13 should be fixed in GraalVM 20.1. already - I suppose you still use the default of this repo (20.0.0)?

Thanks, Christian

tzezula commented 4 years ago

The "Cannot install GraalVM MBean due to..." is only a warning it has no effect on the compilation. It's caused by the outdated jdk.internal.vm.compiler.management module. You can redirect the output using the -Dgraal.LogFile=compiler.log option. The compilation problem is caused by the missing overlay for JDK-12, JDK-13 and JDK-14 in the compiler multi-version jar. The compiler.jar deployed in the maven repository has only 9 and 11 versions.

tzezula commented 4 years ago

GraalVM 20.1 we already have a maven artefact for the ‘jdk.internal.vm.compiler.management’ https://mvnrepository.com/artifact/org.graalvm.compiler/compiler-management/20.1.0. The warning should be resolved by using the ‘jdk.internal.vm.compiler.management’ from the Maven. I will create a PR to update the graal-js-jdk11-maven-demo to do it later today.

wirthi commented 4 years ago

Hi,

I have just checked, it works fine for me with JDK-13.0.2 and JDK-14.0.2 on Linux, both with GraalVM 20.1.0 and the latest update to 20.2.0.

Best, Christian