Hi Jochen, At least with the current tip version of HotSpot, the mh.invokeWithArguments() callsite is not likely to get its actual target inlined into the caller; we depended a lot on being able to prove that the MethodHandle is a (JIT-)compiled-time constant to be able to do inlining across the MethodHandle.invoke/invokeExact boundary.
I'm working on adding profiling support for MethodHandle.invoke/invokeExact (which invokeWithArguments() will call), and it looks at what MethodHandles get passed in. When that work lands in HotSpot, your example will be a source of profile pollution just like the well-known megamorphic callsites in the old days, so I wouldn't suggest doing that. More details on my work-in-progress will be send to this list later. - Kris On 2013/3/21 1:23, Jochen Theodorou wrote: > Hi all, > > assuming I have in Java a method: > > public static Object invoke(MethodHandle mh, Object[] args) { > try { > return mv.invokeWithArguments(args); > } catch (Throwable th) { > ExceptionUtils.sneakyThrow(th); > } > } > > (sneakyThrow is to work around checked exceptions and does basically > just throw the throwable again without declaring it) > > I am wondering if the call site in this method can become megamorphic or > not. And assuming it does not, I further assume the call to this method > cannot become megamorphic as well... so my next question is if that can > be always be potentially inlined then. > > bye blackdrag > _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev