Dynamic Binary Translator Native Code Interleaving

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing program code conversion methods face challenges in efficiently translating and executing code across different processor architectures, particularly when using native libraries, as they lose execution control and optimization opportunities, and lead to inaccurate emulated states.

Innovation Solution

A dynamic binary translation method that employs a translator apparatus to convert subject program code into target code, utilizing native binding and reverse binding techniques to interleave execution with native code, while maintaining control and optimizing performance.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If native binding is used to execute native library functions, then execution performance is improved, but execution control is lost and optimization opportunities are reduced

Engineering Contradiction:
Improveexecution performanceVSAvoidexecution control
Core Design Contradiction:
ProductivityVSEase of operation

Solution Approach 1:

The patent introduces an intermediary mechanism (the translation/execution system) that sits between the native code execution and the host environment. This intermediary maintains execution control by intercepting and managing function calls, allowing the system to benefit from native code performance while retaining the ability to monitor, control, and optimize execution flow through the translation layer.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Productivity

If native binding is used to execute native library functions, then execution performance is improved, but optimization opportunities are lost

Engineering Contradiction:
Improveexecution performanceVSAvoidoptimization opportunities
Core Design Contradiction:
ProductivityVSAdaptability or versatility

Solution Approach 1:

The system dynamically adapts its behavior based on execution context. It can switch between executing native functions directly (for performance) and translating/executing through the system (for optimization opportunities). This dynamic approach allows the system to capture optimization opportunities when needed while maintaining high performance when possible, making the execution model flexible and adaptable rather than static.

Inventive Principle:
Principle #15Dynamics

3Productivity

If native binding is used to execute native library functions, then execution performance is improved, but emulated subject state accuracy becomes poor

Engineering Contradiction:
Improveexecution performanceVSAvoidemulated state accuracy
Core Design Contradiction:
ProductivityVSMeasurement precision

Solution Approach 1:

The system implements feedback mechanisms where the execution state is continuously monitored and compared against the expected emulated state. When native functions are executed, their effects on the execution state are tracked and fed back to maintain accuracy of the emulated subject state. This feedback loop ensures that even when using fast native execution paths, the system maintains precise knowledge of the execution state for correct emulation.

Inventive Principle:
Principle #23Feedback

Data Source

PatentEP1889158B1Method and apparatus for combined execution of native code and target code during program code conversion
Publication Date: 2015.04.22 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • EP1889158B1 patent drawingFigure 1~2
  • EP1889158B1 patent drawingFigure 3~4
  • EP1889158B1 patent drawingFigure 5

AI summary

In program code conversion, particularly dynamic binary translation, subject code (17) is translated into target code (21) through a translator (19) for execution on a target processor (13). Selected portions of subject code, such as library functions SFuncA (172), are replaced by instead executing a portion of native code such as a native function NFuncA (282). The native function is native to the target processor (13). The method further includes executing a subject code portion such as a subject function SFuncB (173) in place of a native code portion (282) such library function NFuncB (283). This reverse binding technique substitutes subject code for selected portions of the native code, particularly native library functions in order to keep control within the translator (19). This helps to maintain an accurate subject state in the translator (19), amongst other advantages.