I already worked with -XX:+PrintCompilation
, and I know the basic techniques of the JIT-compiler and why JIT-compilation is used.
Yet I still have not found out how the JVM decides to JIT-compile a method, i.e. "when the right time has come to JIT-compile a method".
Am I right in the assumption that every method starts being interpreted, and as long as it is not categorized as "hot method" it will not be compiled? I have something in the back of my head that I read that a method is considered "hot" when it was executed at least 10.000 times (after interpreting the method 10.000 times, it will be compiled), but I have to admit that I am not sure about this or where I've read this.
So to sum up my question:
(1) Is every method interpreted as long as it not has been categorized as "hot" method (and therefore has been compiled) or are there reasons for methods to get compiled even if they are not "hot"?
(2) How does the JVM categorize methods into "non-hot" and "hot" methods? Number of execution? Anything else?
(3) If there are certain thresholds (like number of executions) for "hot" methods, are there Java flags (-XX:...
) to set this thresholds?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…