Java Dynamic Language invokedynamic (2)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.