我正在尝试使用JVMCI及其在JDK中的存在using the following from a mailing list -
private static void JVMCIQueries() {
// Check if the JDK used supports JVMCI?
String vm_version = System.getProperty("java.vm.version");
System.out.printf("java.vm.version = %s%n", vm_version);
HotSpotDiagnosticMXBean bean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
// Is JVMCI enabled by default?
VMOption enableJVMCI = bean.getVMOption("EnableJVMCI");
System.out.println(enableJVMCI);
// Is the system using the JVMCI compiler for normal compilations?
VMOption useJVMCICompiler = bean.getVMOption("UseJVMCICompiler");
System.out.println(useJVMCICompiler);
// What compiler is selected?
String compiler = System.getProperty("jvmci.Compiler");
System.out.printf("jvmci.Compiler = %s%n", compiler);
}
(编辑)使用VM参数:
-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler
java.vm.version = 10+46 VM option: EnableJVMCI value: true origin: VM_CREATION (read-only) VM option: UseJVMCICompiler value: true origin: VM_CREATION (read-only) jvmci.Compiler = null
java.vm.version = 9.0.4+11 VM option: EnableJVMCI value: true origin: VM_CREATION (read-only) VM option: UseJVMCICompiler value: true origin: VM_CREATION (read-only) jvmci.Compiler = null
但这伴随着抱怨的日志
jdk.vm.ci.common.JVMCIError: no JVMCI compiler selected at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCICompilerConfig$DummyCompilerFactory.compileMethod(HotSpotJVMCICompilerConfig.java:45) at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCICompilerConfig$DummyCompilerFactory.compileMethod(HotSpotJVMCICompilerConfig.java:42) at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java:433)
当两个版本的 jvmci.Compiler
值为 null
时,没有选择JVMCI编译器的确切内容是什么这里的意思是9.0.4(为什么不在10)?
这可能听起来很愚蠢或无关,但我是否会回到我应该注意Does Java 9 include Graal?的部分?因为我认为,即使9.0.4没有,我也没有在Java10上指定相同的(-Djvmci.Compiler
标志)。任何可能已更改的默认配置?
注意 :使用MacOS(x64)完成上述所有操作。