why doesn't trigger compile when loop 10700 times? (original) (raw)
Kirk Pepperdine kirk.pepperdine at gmail.com
Sun Jun 28 08:30:06 UTC 2015
- Previous message: why doesn't trigger compile when loop 10700 times?
- Next message: [9] RFR(S): 8129937: compiler/codecache/jmx/UsageThresholdIncreasedTest.java fails with "Usage threshold was hit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I believe with loops you should see an OSR but only after a count of 14000. I don’t believe this will be precise though.
Kind regards, Kirk Pepperdine
On Jun 28, 2015, at 6:36 AM, Vladimir Kozlov <vladimir.kozlov at oracle.com> wrote:
Add -Xbatch (or -XX:-BackgroundCompilation) otherwise code continue execution after requesting compilation and may finish before compilation starts. Also counters are not precise so you may not see exact 10700.
Regards, Vladimir On 6/27/15 9:15 PM, weatry at gmail.com wrote: 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) << numberofnoncountbits; } 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.067, 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
- Previous message: why doesn't trigger compile when loop 10700 times?
- Next message: [9] RFR(S): 8129937: compiler/codecache/jmx/UsageThresholdIncreasedTest.java fails with "Usage threshold was hit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the hotspot-compiler-dev mailing list