摘要 |
A system and method for efficient compilation and invocation of function type calls in a virtual machine (VM), or other runtime environment, and particularly for use in a system that includes a Java Virtual Machine (JVM). While current techniques in Java for implementing function types using interface calls are neither efficient nor flexible, embodiments of the present invention address this problem by providing a system and method for creating function references (MethodHandles) to a target function, invoking efficiently on such a MethodHandle from a callsite, and reusing the existing generics infrastructure within the Java language to carry the types during javac compile time from the target function to the callsite. In accordance with an embodiment, the system comprises a virtual machine for executing a software application; a memory space for the application byte code comprising callsites generated using a function type carrier; a bytecode to machine code compiler which performs MethodHandle invocation optimizations; a memory space for the compiled machine code; and a memory space for storing software objects as part of the software application. The system enables carrying the function type from the original MethodHandle to a callsite in the generated bytecode, including maintaining generics information for a function type acquired from a target function, and generating a callsite based on the generics information for the function object invocation. |