Hardware-Assisted Autonomic Code Patching via Metadata Pointers
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional methods for optimizing program code performance require modification of the original code, which is not desirable, and do not allow for autonomous patching of branch instructions or other types of instructions to improve execution efficiency without altering the code itself.
Innovation Solution
The use of hardware assistance, specifically metadata and a new flag in the machine status register, enables autonomous patching of code by redirecting execution to alternative or reorganized instructions without modifying the original code, allowing for performance optimization functions like reorganizing code sequences based on access patterns.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If code is reorganized to improve cache performance, then execution efficiency is improved, but the original code is modified
Solution Approach 1:
The patent creates a copy of the original code block and places it in a different memory location with improved cache organization. The patched code pointer redirects execution to this copied version, allowing performance optimization without modifying the original code. This resolves the contradiction by maintaining code integrity while achieving execution efficiency through the copied optimized version.
Solution Approach 2:
The patent introduces a patched code pointer as an intermediary between the original code and the optimized code. This pointer acts as a mediator that redirects execution flow to the optimized version without altering the original code structure. The intermediary enables performance improvement while preserving the original code's integrity and stability.
2Speed
If code patching is implemented to optimize performance, then execution speed is improved, but device complexity increases
Solution Approach 1:
The system performs self-service by autonomously generating patched code and updating pointers without requiring external intervention or complex patch management infrastructure. The performance monitoring application automatically identifies optimization opportunities, generates optimized code blocks, and updates the patched code pointers, reducing overall system complexity while achieving execution speed improvement.
Solution Approach 2:
The patent prepares optimized code blocks in advance and stores them in memory before they are needed during execution. The patched code pointers are pre-configured to point to these prepared optimized blocks, allowing immediate execution speed improvement without requiring complex runtime code generation or transformation mechanisms, thereby reducing system complexity.
3Productivity
If branch instructions are patched to improve performance, then productivity is improved, but the difficulty of detecting and measuring increases
Solution Approach 1:
The patent implements feedback mechanisms where the performance monitoring application continuously monitors execution performance and automatically adjusts patched code pointers based on measured performance metrics. This feedback loop makes patching decisions detectable and measurable by providing explicit performance data that indicates when and how branch instructions are being optimized, resolving the detection difficulty while maintaining productivity improvements.
Data Source
AI summary
A method, apparatus and computer instructions for hardware assist for autonomically patching code. The present invention provides hardware microcode to a new type of metadata to selectively identify instructions to be patched for specific performance optimization functions. The present invention also provides a new flag in the machine status register (MSR) to enable or disable a performance monitoring application or process to perform code-patching functions. If the code patching function is enabled, the application or process may patch code at run time by associating the metadata with the selected instructions. The metadata includes pointers pointing to the patch code block code. The program code may be patched autonomically without modifying original code.


