hotspot inlining decision seems to be random
Ulf.Zibis at gmx.de
Mon Dec 14 03:22:10 PST 2009
Christian Thalinger schrieb:
> On Sat, 2009-12-12 at 18:01 +0100, Ulf Zibis wrote:
>> Please refer to:
>> I have run  the same code  3 times.
>> On 1st run, method highSurrogate(int)  was inlined in Decoder$decode(...)  as hot ( line
>> 276-293), but not on 2nd run ( line 332-358).
>> Can someone explain this, because method highSurrogate() was executed 26,314,402 times ( line 1932) ?
>> In  (line 125, 215) hotspot log says:
>> @ 479 sun.nio.cs.ext.EUC_TW_C_d_b_reverse1$Decoder::decode never executed
>> @ 95 java.lang.Character::highSurrogate executed < MinInliningThreshold
>> On 3rd run, method highSurrogate(char,char)  was inlined in Decoder$decode(...)  as hot (
>> line 832-846), but not in 1st ( line 1012-1034) or 2nd run ( line 992-1014).
>> So I can see that hotspot inlining decision was different in each 3 runs:
>>   
>> highSurrogate(int) 276-293 332-358 473-490
>>  line 277 inline call inline
>> highSurrogate(char,char) 1012-1034 992-1014 832-846
>>  line 277 call call inline
> I don't know what to do with all this information. "I've run the same
> code 3 times" is not very informative. How did you run it 3 times?
As you maybe know, I run my code under NetBeans IDE.
'run it 3 times' just means, that I hit the "Run Project" button 3 times
consecutively (here using configuration ).
> It's true that the logs look different but without being able to
> reproduce I can't tell what's going on.
I you have NetBeans 6.8 installed, just checkout the project and run it
several times from configuration .
If not, use:
java -server -Xbootclasspath/p:build/classes \
-XX:+UnlockDiagnosticVMOptions -XX:-DisplayVMOutput \
sun.nio.cs.ext.EUC_TWBenchmark EUC_TW_C_d_b_reverse1 EUC_TW_C_d_b_reverse2
The Problem I have is, how to reliably see the effect of my code changes
on the resulting performance.
For example, in  (at the end) you can see, that
highSurrogate(char,char) is much faster than highSurrogate(int), if
inlined. If not inlined ,, it's opposite.
So how can I reliably force the inlining of method highSurrogate(...) as
too as of decode(...) for my benchmark testing?
-XX:MaxInlineSize=250 seems not reliable
More information about the hotspot-compiler-dev