To a certain extent, invokedynamic and the methodhandle mechanism are the same, are to solve the original 4 instructions "invoke*" instruction method to fix the allocation rule in the virtual machine problem, How to transfer the decision of the lookup method from the virtual machine to the specific user code. You can think of them as a Java API implementation using the upper layer, and another using the other attributes in bytecode and class, and constants to do so.
The position containing the invokedynamic instruction is called the dynamic call site, and the first parameter of the instruction is no longer the Constant_methodref_info constant that represents the method symbol reference. But the Constant_invokedynamic_info constant in jdk1.7, which has 3 messages:
1. The boot method (Bootstrap), has a fixed parameter, and the return value is the Java.lang.invoke.CallSite object, which represents the actual method call to execute.
2. Method Type (Methodtype)
3. Method name
This allows us to find and execute the Bootstrap method based on the information in the Constant_invokedynamic_info constant, and get a Callsite object that ultimately invokes the method to be executed.
Java Dynamic Language invokedynamic (2)