MethodHandles.constant not inlining?
Charles Oliver Nutter
headius at headius.com
Tue Jun 7 22:51:08 PDT 2011
On Wed, Jun 8, 2011 at 12:22 AM, John Rose <john.r.rose at oracle.com> wrote:
> What is the type you pass to MHs.constant? If it's not Object, call it T.
The more direct answer: it's T...in my case, the actual type of the
object given. I expected that to be better than making it Object and
wrapping it in an explicitCast or something...
> In the case of a type other than Object, we have:
> rawRetype(#wellKnownIdentityFn, methodType(T, T)).bindTo(foo)
> where rawRetype is an internal trusted constructor which asserts that the result is trusted to be T, not just Object. This should inline also. There's a potential problem here: The methodHandleWalk module will emit a return of an Object value (from wellKnownIdentityFn, not its real name) from an adapter that returns a value of type T. This bytecode would be rejected by the verifier, but I don't think the verifier runs on MH graphs.
> Maybe the methodHandleWalk modules is tripping over some aspect of this MH graph or the resulting bytecode.
I will be very interested to see what comes out of this :)
More information about the mlvm-dev