MethodHandles.constant not inlining?

Christian Thalinger christian.thalinger at oracle.com
Thu Jun 9 10:50:57 PDT 2011


On Jun 7, 2011, at 10:44 PM, Charles Oliver Nutter wrote:
> That's pretty much it. The test I ran looks like this:
> 
> def foo
>  1
> end
> 
> 100_000.times {
> foo
> }
> 
> 
> The body of the block passed to "times" jits (in Hotspot) and appears
> to inline the "foo" method just fine, but the body of the inlined
> "foo" logic contains that call I gisted in my earlier post.
> 
> Looking at the PrintAssemblyOutput at the point of that suspicious callq:

<snip>

> Note that the output all indicates this is happening on line 2, which
> is the invokedynamic-based "getFixnum" logic for the literal "1".
> 
> Is there something I'm doing wrong here?

Sorry I'm a bit behind but is this still a problem or have you fixed it already?

It looks like it works:

                                      @ 24   java.lang.invoke.MethodHandle::invokeExact (32 bytes)   inline (hot)
                                        @ 28   constant::method__0$RUBY$foo (7 bytes)   inline (hot)
                                         \-> discounting inline depth
                                        @ 1   java.lang.invoke.MethodHandle::invokeExact (9 bytes)   inline (hot)
                                          @ 2   sun.invoke.util.ValueConversions::identity (2 bytes)   inline (hot)
                                           \-> discounting inline depth

-- Christian


More information about the mlvm-dev mailing list