Inserting pre and post-call logic around a handle?

John Rose john.r.rose at oracle.com
Thu May 19 14:55:55 PDT 2011


On May 19, 2011, at 2:08 PM, Charles Oliver Nutter wrote:

> Basically, I want the MH chain to contain all pre/post logic in a
> try/finally form wrapped around the eventual direct handle, since
> ping-ponging through a generalized piece of code for many different
> targets would produce a polymorphic MethodHandle#invoke*
> call...wouldn't it?

I'm not certain.

The last MH.invoke in my sketch could also be the indy instruction, with the preceding stuff executed in the BSM.

The basic idea is to package the wrapping logic in a target-independent form, and bind it (pre-packaged) to each call site's unwrapped target MH, as return new MutableCallSite(invoker.bindTo(targetMH)).

I *think* this would inline OK.  And it might be a somewhat more modular way to express your problem, since you wouldn't need to introduce the final target MH until the last moment.

-- John


More information about the mlvm-dev mailing list