How to learn the JITed method or interpreted

As I understand it, there is no clear rule to determine whether the Java method will be JITed or interpreted during a call. So somehow tell the JVM that I need a specific JITed method. And is there any way to know exactly which method will be JITed and which will not.

+3
source share
5 answers

As far as I know, you don’t know (from within the JVM) and cannot use the JITed method or not, but using the -XX:+PrintCompilationJVM argument , you can watch how the JIT compiler works and checks if the method gets JITed in this particular program run or not.

+5
source

So, somehow tell the JVM that I need a specific method for JITed.

, "JITed", , , - JITed. JVM.

+1

JITed .

Sun JVM (Oracle) Sun HotSpot, , , , "", . . , , . -XX:CompileThreshold=10000 VM, , "".

I do not know how to check if the current code is working in interpreted or compiled mode. VM crash logs show which methods in the stack trace are interpreted or compiled, maybe there is a way to get it at runtime.

0
source

There is a way to ask jvm to compile the class, it does not guarantee anything, but should work on any jvm that has jit.

Compiler.compileClass(MyClass.class);
0
source

You cannot say, and there is no way for him to make any distinctions prohibiting errors in HotSpot. The term "JIT" has been deprecated for at least ten years.

0
source

All Articles