Hybrid Binary Code Stream Folding for Cross-ISA Execution
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing technologies face challenges in efficiently loading and executing hybrid binary images across different instruction set architectures (ISAs) and application binary interfaces (ABIs), leading to performance issues and increased storage requirements due to the need for fat binaries.
Innovation Solution
The development of a method and system that facilitate the loading of hybrid binary images by both legacy and enlightened loaders, utilizing an emulation-compatible (EC) ABI that enables native execution and seamless interoperability with emulated foreign code, while preserving compatibility with incumbent native ABIs.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If fat binaries including both native and foreign code streams are used to support multiple ISAs, then foreign software execution capability is improved, but binary size increases by 100% consuming storage resources
Solution Approach 1:
The patent merges native and foreign code streams into a single hybrid binary image, allowing both code streams to coexist in one file rather than requiring separate binaries. This merging approach enables the system to support multiple ISAs while avoiding the 100% code size increase of traditional fat binaries, as the loader selectively loads only the required code stream based on the target device's ISA.
Solution Approach 2:
The hybrid binary image is segmented into distinct code stream regions, each targeting a specific ISA. The loader identifies and separates the appropriate code stream for the target device, loading only that segment into memory. This segmentation allows the system to maintain support for multiple ISAs while reducing the actual loaded code size to match the specific device requirements.
2Adaptability or versatility
If software-based ISA emulation is used to execute foreign software, then foreign software compatibility is improved, but execution performance deteriorates significantly
Solution Approach 1:
The system dynamically adapts the execution mode based on the target device's capabilities. When a native code stream matching the device's ISA is available in the hybrid binary, the system executes it natively for optimal performance. When only foreign code streams are available, the system falls back to software emulation, providing a dynamic balance between performance and compatibility.
Solution Approach 2:
The loader acts as an intermediary between the hybrid binary image and the execution environment. It analyzes the device's ISA capabilities, selects the appropriate code stream, and facilitates native execution when possible. This intermediary approach eliminates the need for software emulation when native code is available, thereby maintaining high execution performance while ensuring compatibility.
3Productivity
If multiple versions of an application are distributed to target different ABIs/ISAs, then platform-specific optimization is improved, but distribution complexity and user confusion increase
Solution Approach 1:
The hybrid binary image serves multiple functions by containing code streams for multiple ISAs within a single file. This universal approach allows one binary to function across different platforms, eliminating the need for users to select or install different versions for different devices. The loader automatically routes to the appropriate code stream, providing platform-specific optimization without distribution complexity.
4Quantity of substance
If code streams are selectively loaded based on target device ISA, then storage resource usage is improved, but loader complexity increases
Solution Approach 1:
The hybrid binary image is prepared in advance with clearly marked code stream regions and metadata indicating which code streams target which ISAs. This preliminary organization allows the loader to quickly identify and load the appropriate code stream without complex analysis during runtime. The pre-structured format reduces the loader's complexity while enabling efficient selective loading that optimizes storage resource usage.
Data Source
Figure 1
Figure 2
Figure 3A
AI summary
A hybrid binary executable under both native processes and compatibility (e.g., emulated) processes. When the hybrid binary is loaded by a native process, the process executes a native code stream contained in the binary directly on a processor. When the hybrid binary is loaded by a compatibility process, the process executes an emulation-compatible (EC) code stream directly on a processor. When executing in a compatibility process, the EC code stream can interact with a foreign code stream that executes in an emulator. The foreign code stream can be included in the hybrid binary itself, or can be external to the hybrid binary. The hybrid binary format supports folding of code between the native code stream and the EC code stream. The hybrid binary comprises a set of memory transformations which are applied to image data obtained from the binary when the hybrid binary executes under the compatibility process.