This is a tracking issue for calls to non-constant method handles to and from "hot" compiled code.
Internally to the JVM, method handle argument list transformations are implemented on the interpreter stack. This means that when compiled code invokes a method handle with argument transforms, it goes through a C2I adapter, transforms the argument list in interpreted format, and then (presumably) goes through an I2C adapter.
At least the most important transforms should go through customized code. These include:
- direct access (no transforms)
- receiver binding (the bindTo transformation)
- trivial asType transformations
- invokeGeneric (argument and return value conversions to and from Object)
Probably all of the core transforms on MethodHandle virtual methods (not necessarily MethodHandles static methods) should get favorable treatment for compiled-to-compiled calls.
An important customer is Project Lambda, which should be using method handles in preference to anonymous classes. Getting the above paths right for compiled code will enable this choice.
Note that this bug does not apply to users invokedynamic, since method handles at invokedynamic call sites are routinely inlined into optimized code.