CompileThreshold & BackEdgeThreshold question(s)
Krystal Mok
rednaxelafx at gmail.com
Fri Aug 3 11:53:34 PDT 2012
On Sat, Aug 4, 2012 at 2:38 AM, Kirk Pepperdine <kirk at kodewerk.com> wrote:
>
> On 2012-08-03, at 8:34 PM, Igor Veresov <iggy.veresov at gmail.com> wrote:
>
> > Each method has two counters in a methodOop. One that counts invocations
> (method entries), the other one counts the number of backward branches
> taken within this method (loop iterations).
>
> what happens if the method contains two (or more) loops? They both use the
> same counter? I guess for an OSR it doesn't matter which loop is holding
> things up.
>
> > For non-tiered policy a method is compiled if the inv_count >
> CompileThreshold, an OSR will happen if inv_count + bb_count >
> BackEdgeThreshold on a backward branch. Profiling will start at 33% of
> these values (InterpreterProfilePercentage).
> >
>
Just a nitpick: Actually for non-tiered policy, a standad compilation is
triggered on method entry when inv_count + bb_count >= CompileThreshold
(the inv_count is incremented first before checking the sum of the two
counters against CompileThreshold).
And an OSR is triggered when inv_count + bb_count >=
InterpreterBackwardBranchLimit. On non-tiered Server VM, this threshold is
calculated from:
InterpreterBackwardBranchLimit = (CompileThreshold *
(OnStackReplacePercentage - InterpreterProfilePercentage)) / 100;
> > Also keep in mind that for non-tiered policy all these counters are
> decayed at each safepoint. So there's an invocation frequency limit below
> which a method will never get compiled.
> >
>
Yes. But the only real-world cases I've seen that get affected by this
behavior are microbenchmarks, especially ones that delibrately trigger GCs
(by excessive allocation or by System.gc()).
> > For tiered it's a bit more complicated. ;)
>
> oh then don't stop there.... :-)
>
It's going to involve a lot of details to explain tiered...can't stay on
10,000 ft for that one :-)
Perhaps this would help a little:
http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/file/b72784e722ff/src/share/vm/runtime/advancedThresholdPolicy.cpp
,
line 282.
- Kris
>
> Kirk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20120804/dbe52af2/attachment-0001.html
More information about the hotspot-compiler-dev
mailing list