couple questions on method handle combinators

Paul Sandoz paul.sandoz at
Wed Jun 14 16:57:11 UTC 2017

> On 14 Jun 2017, at 06:53, Roland Westrelin <rwestrel at> wrote:
>> The is due to the call to invoke, which performs an asType
>> transformation and thus the receiver is not constant.
> So it's effectively constant but the compiler can't see it?

It’s “effectively” constant from the perspective of the invoke call site (since the signature at the call site does not change). However, from the perspective of the method handle instance it is not constant, since the invoker or anyone else goes through an asType call and thus updates the “memoized" field for the last cached transformed MH.

Thinking some more about this. For the MH invokers (generic lambda form invoker) there might be something we can associate with the call site and use a stable lazy calculation. I wonder if we can adjust the appendix parameter to be a holder containing the call site method sig and stable field for the asTyped MH.


> I had a
> patch that added profiling of that receiver value. It didn't seem to
> show any benefit at the time. I wonder it would make sense to experiment
> with something similar again.
> Roland.

More information about the valhalla-dev mailing list