why doesn't trigger compile when loop 10700 times? (original) (raw)

weatry at gmail.com weatry at gmail.com
Sun Jun 28 04:15:00 UTC 2015


hi, everyone!

I have some question about the jdk 1.7 compiler.

According to the source code of "hotspot\src\share\vm\interpreter\invocationCounter.cpp", the "InterpreterBackwardBranchLimit" is calculated by the following rules:

if (ProfileInterpreter) { InterpreterBackwardBranchLimit = (CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100; } else { InterpreterBackwardBranchLimit = ((CompileThreshold * OnStackReplacePercentage) / 100) << number_of_noncount_bits; }

So if I run a piece of code on a server edition jvm, the InterpreterBackwardBranchLimit should be 10700 (CompileThreshold is 10000, OnStackReplacePercentage is 140, and InterpreterProfilePercentage is 33). But when I added -XX:+PrintCompilation,  a loop with 10700 times would not print anything. When the loop growed up to 14564 times, the compiler began to work.

Could anybody give me some advice?

I use jdk1.7.0_67, and the test code as following:

public class OSRDemo { public static void main(String[] args) { int result = 1; for (int i = 1; i < 10700; i++) {//14564 result+=i; }

System.out.println(result); } }

Thank you very much!

Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20150628/70450bb3/attachment.html>



More information about the hotspot-compiler-dev mailing list