On Thu, May 19, 2011 at 3:53 PM, John Rose <[email protected]> wrote:
> Your sketch seems good, except that you cannot handle both the return value
> and the thrown exception in one place. (API limitation.) So if your post
> logic wants to see the return value, you have more work to do.
>
> Suggestion: Make the direct MH be a free variable, by doing the fancy
> transform on MethodHandles.exactInvoker(dmh.type()). That is, instead of mh
> = T(dmh); mh.invoke(a*); do inv = T(exactInvoker(dmh.type())); if (?)
> inv.invokeExact(dmh, a*) else { mh = inv.bindTo(dmh); mh.invoke(a*); }.
Ok, I thought I understood this, but I don't. Where is my pre/post
logic supposed to live? Something like this?
static Object invokeWithPrePost(MethodHandle mh, Object arg1, Object arg2) {
pre(arg1, arg2);
try {
return mh.invokeExact(arg1, arg2);
} finally {
post(arg1);
}
}
And then bind that into a handle, currying in the handle to invoke?
Perhaps I'm not following how to use exactInvoker in this case?
- Charlie
_______________________________________________
mlvm-dev mailing list
[email protected]
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev