Assembly output from JRuby 'fib'
Christian Thalinger
christian.thalinger at oracle.com
Thu Apr 28 03:33:56 PDT 2011
On Apr 28, 2011, at 12:16 PM, Christian Thalinger wrote:
> On Apr 27, 2011, at 5:54 AM, Charles Oliver Nutter wrote:
>> I prepared this for someone else, but I thought folks here might be
>> interested in it too.
>>
>> This gist contains hotspot x86 (32-bit) assembly output for JRuby's
>> dynopt mode and invokedynamic (on a couple-week-old OS X OpenJDK
>> build). I haven't spent a lot of time investigating.
>
> I took a look at it. I used 64-bit x86 since the code is a bit smaller than with 32-bit.
>
> The code is almost identical but three things popped into my eye (the output is from PrintOptoAssembly):
>
> 1. The obvious one: the method handle call site guard:
>
> 1a4 B32: # B160 B33 <- B31 B149 B123 Freq: 0.499969
> 1a4 movq R10, byte[int:>=0]<ciObject ident=770 PERM address=0xe99088> * # ptr
> 1ae movq R10, [R10 + #1576 (32-bit)] # ptr
> 1b5 movq R11, [R10 + #32 (8-bit)] # ptr
> 1b9 movq R8, java/lang/invoke/AdapterMethodHandle:exact * # ptr
> 1c3 cmpq R11, R8 # ptr
> 1c6 jne,u B160 P=0.000000 C=-1.000000
I did an experiment and hacked a version of HotSpot that does not emit the call site guard. Since the fib benchmark is monomorphic this works and shows that we just need to get rid of the guard to get on a par with dynopt performance. The numbers are 32-bit x86.
-- Christian
$ bin/jruby.sh --server -Xcompile.dynopt=false -J-XX:+UseSerialGC -J-XX:InlineSmallCode=5000 -J-XX:MaxInlineSize=150 -J-XX:MaxInlineLevel=15 bench/bench_fib_recursive.rb 10
0.259000 0.000000 0.259000 ( 0.215000)
0.094000 0.000000 0.094000 ( 0.094000)
0.093000 0.000000 0.093000 ( 0.093000)
0.094000 0.000000 0.094000 ( 0.094000)
0.093000 0.000000 0.093000 ( 0.093000)
0.094000 0.000000 0.094000 ( 0.094000)
0.093000 0.000000 0.093000 ( 0.093000)
0.094000 0.000000 0.094000 ( 0.094000)
0.093000 0.000000 0.093000 ( 0.093000)
0.093000 0.000000 0.093000 ( 0.093000)
$ bin/jruby.sh --server -Xcompile.dynopt=true -J-XX:+UseSerialGC -J-XX:InlineSmallCode=5000 -J-XX:MaxInlineSize=150 -J-XX:MaxInlineLevel=15 bench/bench_fib_recursive.rb 10
0.398000 0.000000 0.398000 ( 0.351000)
0.075000 0.000000 0.075000 ( 0.075000)
0.074000 0.000000 0.074000 ( 0.074000)
0.075000 0.000000 0.075000 ( 0.075000)
0.075000 0.000000 0.075000 ( 0.075000)
0.074000 0.000000 0.074000 ( 0.074000)
0.074000 0.000000 0.074000 ( 0.074000)
0.074000 0.000000 0.074000 ( 0.074000)
0.075000 0.000000 0.075000 ( 0.075000)
0.075000 0.000000 0.075000 ( 0.075000)
$ bin/jruby.sh --server -Xcompile.invokedynamic=true -J-XX:+UseSerialGC -J-XX:InlineSmallCode=5000 -J-XX:MaxInlineSize=150 -J-XX:MaxInlineLevel=15 bench/bench_fib_recursive.rb 10
0.227000 0.000000 0.227000 ( 0.180000)
0.074000 0.000000 0.074000 ( 0.074000)
0.074000 0.000000 0.074000 ( 0.074000)
0.074000 0.000000 0.074000 ( 0.074000)
0.073000 0.000000 0.073000 ( 0.074000)
0.074000 0.000000 0.074000 ( 0.074000)
0.074000 0.000000 0.074000 ( 0.074000)
0.074000 0.000000 0.074000 ( 0.074000)
0.074000 0.000000 0.074000 ( 0.075000)
0.074000 0.000000 0.074000 ( 0.074000)
More information about the mlvm-dev
mailing list