Patch-Based Method Invocation for JVM Pipeline Efficiency
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The current Java Virtual Machine (JVM) approaches cause processor pipeline flushes and resource wastage due to uncertainty in target method addresses during method invocations, leading to slowdowns and inefficiencies, particularly when target methods change state from compiled to uncompiled, necessitating costly forced decompilation of calling methods.
Innovation Solution
The technique modifies the parameters of instructions in compiled calling methods to reflect the current state of target methods, allowing direct method calls without decompilation, using branch-and-link instructions to patch calls to both non-virtual and virtual target methods, ensuring correct execution addresses are maintained regardless of state changes.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If indirect referencing is used to invoke target methods at runtime, then the correct runtime address can be determined, but processor pipeline flushes occur causing execution slowdown
Solution Approach 1:
The patent pre-determines possible target method addresses at compile time and stores them in a lookup table. When a method invocation occurs, the pre-computed addresses are directly used without runtime lookup, eliminating pipeline flushes while ensuring correct address determination through preliminary preparation of all possible target addresses
Solution Approach 2:
The patent dynamically selects among multiple pre-determined target addresses based on runtime conditions. The system maintains a list of possible target addresses and dynamically chooses the correct one during execution, allowing the calling method to adapt to different compilation states of target methods without requiring indirect referencing
2Productivity
If direct method calls are used to speed up execution, then processor pipeline efficiency improves, but calling methods must be decompiled when target method state changes
Solution Approach 1:
The patent pre-computes and stores multiple possible target addresses in a lookup table at compile time. When target method state changes occur, the system preliminarily prepares alternative addresses that can be quickly swapped in without decompiling the calling method, thus maintaining direct calls while adapting to state changes
Solution Approach 2:
The patent changes the address parameter of method invocation instructions from a single fixed address to a selectable set of addresses. By modifying which address from the pre-computed list is used (rather than changing the instruction itself), the system adapts to target method state changes without requiring decompilation
3Reliability
If forced decompilation is performed when target methods change state, then correct addressing is maintained, but significant memory and processor resources are consumed
Solution Approach 1:
The patent pre-computes all possible target addresses and stores them in a lookup table during compilation. When target method state changes occur, the system simply swaps to a different pre-computed address from the list rather than decompiling and recompiling, dramatically reducing memory and processor resource consumption while maintaining address correctness
Solution Approach 2:
The patent creates a copy of the calling method's instruction with a different target address when state changes occur, rather than modifying the original compiled code. This copying approach allows quick address changes without the resource-intensive decompilation and recompilation process
Data Source
AI summary
A patch-based mechanism is disclosed for providing fast invocations of a target method from a compiled calling method. The code for the calling method is stored into a storage. The code for the calling method comprises an instruction for invoking the target method, where the instruction comprises a parameter. In response to a state change from a current state to a new state that is experienced by the target method, the parameter is modified from a first value to a second value, where the second value indicates the correct address for facilitating the execution of the target method in its new state. Thus, the parameter in the instruction for invoking the target method always reflects the correct state of the target method, which provides for a fast invocation of the target method when the instruction is executed.


