Projects, which use JSR292
Christian Thalinger
christian.thalinger at oracle.com
Fri Feb 18 07:02:03 PST 2011
On Feb 18, 2011, at 2:19 PM, Christian Thalinger wrote:
> On Feb 18, 2011, at 1:28 PM, Charles Oliver Nutter wrote:
>> On Fri, Feb 18, 2011 at 6:17 AM, Christian Thalinger
>> <christian.thalinger at oracle.com> wrote:
>>> Is there a switch to turn direct ruby-to-ruby calls on and off? I'd like to compare inlining trees and maybe code output.
>>
>> Just pushed a couple for you in a4a0802:
>>
>> jruby.compile.invokedynamic.rubyDirect=true|false (Ruby targets
>> directly bind; defaults to true)
>> jruby.compile.invokedynamic.nativeDirect=true|false (Native (Java)
>> targets directly bind; defaults to true)
>>
>> Not to put any pressure on, but I had hoped to see this
>> directly-binding Ruby calls would *improve* perf :) With this in
>> place, the only thing dynopt does that my indy logic doesn't do is
>> dispatch literal fixnums directly through as long values (rather than
>> as RubyFixnum objects...and yes, this is only in place for literals).
>> Ideally, I'd expect optimized invokedynamic to perform as well as
>> dynopt in this situation.
>
>
> What I can tell so far is that setting rubyDirect=true inlines a whole lot more stuff than without. I looks like it wants to inline all recursive calls of fib_ruby into a single method, which doesn't work very well, hitting two limits: NodeCountInliningCutoff and DesiredMethodLimit.
>
> I tried to bump these limits but that is a dead end for the compiler since at one point it skips the compile because it gets too many nodes:
>
> 43 COMPILE SKIPPED: out of nodes parsing method (not retryable)
>
> I don't know why it wants to inline all these recursive calls. Is that something JRuby tries to do?
Here are two (plain) inlining trees with
rubyDirect=false:
@ 51 java.dyn.MethodHandle::invokeExact inline (hot)
@ 8 sun.dyn.MethodHandleImpl$GuardWithTest::invoke_L5 inline (hot)
@ 11 java.dyn.MethodHandle::invokeExact inline (hot)
@ 15 org.jruby.runtime.invokedynamic.InvokeDynamicSupport::test inline (hot)
@ 5 org.jruby.RubyBasicObject::getMetaClass inline (hot)
@ 8 org.jruby.RubyModule::getCacheToken inline (hot)
@ 28 java.dyn.MethodHandle::invokeExact inline (hot)
@ 23 sun.dyn.FilterGeneric$F6::invoke_F6 inline (hot)
@ 17 java.dyn.MethodHandle::invokeExact inline (hot)
@ 20 org.jruby.runtime.invokedynamic.InvokeDynamicSupport::pollAndGetClass inline (hot)
@ 1 org.jruby.runtime.ThreadContext::callThreadPoll inline (hot)
@ 19 org.jruby.runtime.ThreadContext::pollThreadEvents inline (hot)
@ 5 org.jruby.RubyThread::pollThreadEvents inline (hot)
@ 5 org.jruby.RubyBasicObject::getMetaClass inline (hot)
@ 5 org.jruby.RubyBasicObject::getMetaClass inline (hot)
@ 29 java.dyn.MethodHandle::invokeExact inline (hot)
@ 35 sun.dyn.FilterGeneric$F7::invoke_F7 inline (hot)
@ 19 java.dyn.MethodHandle::invokeExact inline (hot)
@ 23 org.jruby.runtime.invokedynamic.InvokeDynamicSupport::getMethod inline (hot)
@ 33 java.dyn.MethodHandle::invokeExact inline (hot)
@ 43 java.dyn.MethodHandle::invokeExact call site not reached
@ 64 org.jruby.ast.executable.AbstractScript::getCallSite2 inline (hot)
rubyDirect=true:
@ 51 java.dyn.MethodHandle::invokeExact inline (hot)
@ 8 sun.dyn.MethodHandleImpl$GuardWithTest::invoke_L5 inline (hot)
@ 11 java.dyn.MethodHandle::invokeExact inline (hot)
@ 15 org.jruby.runtime.invokedynamic.InvokeDynamicSupport::test inline (hot)
@ 5 org.jruby.RubyBasicObject::getMetaClass inline (hot)
@ 8 org.jruby.RubyModule::getCacheToken inline (hot)
@ 28 java.dyn.MethodHandle::invokeExact inline (hot)
@ 20 bench.bench_fib_recursive::method__0$RUBY$fib_ruby inline (hot)
@ 4 org.jruby.ast.executable.AbstractScript::getCallSite0 inline (hot)
@ 14 org.jruby.runtime.callsite.CachingCallSite::call inline (hot)
@ 5 org.jruby.runtime.ThreadContext::getRuntime inline (hot)
@ 10 org.jruby.RubyFixnum::newFixnum inline (hot)
@ 1 org.jruby.RubyFixnum::isInCacheRange inline (hot)
@ 13 org.jruby.runtime.callsite.CachingCallSite::call inline (hot)
@ 2 org.jruby.runtime.callsite.CachingCallSite::pollAndGetClass inline (hot)
@ 1 org.jruby.runtime.ThreadContext::callThreadPoll inline (hot)
@ 19 org.jruby.runtime.ThreadContext::pollThreadEvents executed < MinInliningThreshold times
@ 5 org.jruby.RubyBasicObject::getMetaClass inline (hot)
@ 17 org.jruby.runtime.callsite.CacheEntry::typeOk inline (hot)
@ 5 org.jruby.RubyModule::getCacheToken inline (hot)
@ 38 org.jruby.RubyFixnum$i$1$0$op_minus::call inline (hot)
@ 38 org.jruby.RubyFixnum$i$1$0$op_lt::call inline (hot)
You can see that at @ 28 the inokeExact starts another round of inlining bench.bench_fib_recursive::method__0$RUBY$fib_ruby. And that repeats until the inlining bails out.
-- Christian
More information about the mlvm-dev
mailing list