Architecture Function Pointers with Consistent Addresses and Code Folding
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing solutions for executing foreign software on computing devices incur significant performance penalties through emulation and result in large binary sizes due to the inclusion of both native and foreign code streams, leading to storage issues and user dissatisfaction.
Innovation Solution
The development of an emulation compatible (EC) application binary interface (ABI) that enables native code to interface seamlessly with emulated foreign code, preserving compatibility with both the native and foreign ABIs, allowing for code folding and reducing binary size through efficient interoperability.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If fat binaries including both native and foreign code streams are used, then compatibility with multiple ISAs and ABIs is improved, but binary size increases by 100%
Solution Approach 1:
The patent segments the binary into distinct code streams (native and foreign) that are separated in memory. The foreign code stream is emulated through software translation, allowing the binary to maintain compatibility with multiple ISAs without including all code paths natively. This segmentation enables the system to load and execute only the necessary code stream for the given processor architecture, reducing the active binary size while maintaining adaptability.
Solution Approach 2:
The patent introduces an emulation layer as an intermediary between the foreign code stream and the native processor. This emulator translates foreign ISA instructions into native processor instructions, allowing the system to execute foreign code without including native implementations of all foreign ISAs. This intermediary approach maintains compatibility with multiple ABIs while avoiding the need to bundle all possible code streams.
2Adaptability or versatility
If software-based ISA emulation is used to execute foreign software, then adaptability to run foreign code is improved, but performance deteriorates with significant penalties
Solution Approach 1:
The patent performs preliminary translation of foreign code streams into native code at binary load time or during a warm-up phase. By pre-translating the foreign code into equivalent native instructions, the system eliminates the need for runtime emulation of individual instructions, thereby maintaining adaptability to execute foreign software while significantly improving execution performance through native code execution.
3Adaptability or versatility
If multiple versions of the same application are distributed for different ABIs/ISAs, then compatibility with various devices is improved, but distribution complexity and developer burden increase
Solution Approach 1:
The patent creates a universal binary format that can execute on multiple ABIs and ISAs through a single distribution package. The binary includes both native and foreign code streams along with an emulation layer, allowing the same binary file to adapt to different processor architectures at runtime. This universal approach eliminates the need for developers to create and maintain separate binary versions for different platforms, reducing distribution complexity while maintaining broad device compatibility.
4Ease of operation
If fat binaries are used to hide ISA complexities from end-users, then ease of operation is improved, but storage resources are consumed and user dissatisfaction increases
Solution Approach 1:
The patent implements a dynamic binary loading mechanism that adapts the loaded code streams based on the detected processor architecture. Instead of statically including all possible code streams, the system dynamically determines which code stream is appropriate for the given hardware and loads only that stream into memory. This dynamic approach maintains ease of operation by automatically adapting to the user's device while minimizing storage resource consumption by avoiding the loading of unnecessary code.
Data Source
AI summary
A function is compiled against a first application binary interface (ABI) and a second ABI of a native first instruction set architecture (ISA). The second ABI defines context data not exceeding a size expected by a third ABI of a foreign second ISA, and uses a subset of registers of the first ISA that are mapped to registers of the second ISA. Use of the subset of registers by the second ABI results in some functions being foldable when compiled using both the first and second ABIs. First and second compiled versions of the function are identified as foldable, or not, based on whether the compiled versions match. Both the first and second compiled versions are emitted into a binary file when they are not foldable, and only one of the first or second compiled versions is emitted into the binary file when they are foldable.


