Does Java 9 include Graal?

不羁的心 提交于 2019-12-17 23:17:32

问题


I'm reading JEP 317. It says that Graal (a new experimental Java-based JIT compiler) will be part of JDK 10, but then it says that is already available in JDK 9. So, what's the point of JEP 317 then? Does Java 9 include Graal or not?


回答1:


From one of my memos, on linux-x64 (out-of-the-box) to use Graal on JDK 9, you can enable it using :

-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler

Source: Tweet from Chris.


If you're explicitly willing to make use of the org.graalvm.* classes, they are not present in the JDK-9 build except for the Linux distribution here and the JEP-317#Experimental Java-Based JIT Compiler's status also reads something similar.

Status    Integrated
Scope JDK
Release   10

Update:- To use Graal on JDK10, one can enable it using:-

-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -Djvmci.Compiler=graal



回答2:


Graal is included in 9 but it used in a different way.

In Java 9 Graal is used as an AOT(Ahead of time) compiler which allows users to use the jaotc tool to create manually compiled .so libraries.

These libraries can then be loaded at JVM startup and directly used.

A detailed description can be found at the related Java 9 JEP: http://openjdk.java.net/jeps/295

In Java 10 Graal, as described in JEP 317, can be used as the JIT compiler instead of HotSpot.

This means that classes will be compiled in the JVM "on the fly" instead of requiring manual compilation beforehand.



来源:https://stackoverflow.com/questions/48252830/does-java-9-include-graal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!