Exception Handling in Native Code Binding
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
During program code conversion, handling exception signals across different processor architectures is challenging due to differences in instruction sets and optimizations, making it difficult to provide an accurate mechanism for exception handling and resuming execution of subject programs after exceptions occur.
Innovation Solution
A computing system with a target processor and memory units that store native and subject code, along with a translator unit for converting subject code, an exception handler unit for handling exceptions by saving and restoring target and subject states, and a recovery unit for resuming execution, allowing accurate exception handling and execution resumption.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If program code conversion is performed to execute subject code on a target processor with a different ISA, then code compatibility and performance optimization are improved, but exception handling accuracy deteriorates due to differences in instruction sets and optimizations
Solution Approach 1:
The patent introduces an intermediary exception handling mechanism that translates exception signals from the target processor back to the subject processor's exception model. This intermediary layer maintains exception handling accuracy by mapping target processor exceptions to equivalent subject processor exceptions, allowing accurate exception handling while enabling code conversion between different ISAs.
Solution Approach 2:
The exception handling process is segmented into distinct stages: exception detection on the target processor, exception translation through the conversion mechanism, and exception handling on the subject processor. This segmentation allows each stage to be optimized independently while maintaining overall exception handling accuracy across the code conversion boundary.
2Productivity
If native code binding is used to improve execution efficiency, then productivity is improved, but exception handling complexity increases due to the need to bridge subject and target states
Solution Approach 1:
The exception handling mechanism is designed with universal functionality that works across both subject code and native code execution paths. By creating a unified exception translation layer that handles both interpreted and native code exceptions consistently, the system maintains execution efficiency through native code binding while managing complexity through a standardized exception handling interface.
3Speed
If code conversion with optimization is applied, then speed is improved, but reliability deteriorates due to difficulties in providing accurate exception handling mechanisms
Solution Approach 1:
The patent implements a feedback mechanism where exception information from the optimized target code execution is continuously monitored and translated back to the subject code's exception model. This feedback loop ensures that even with aggressive optimizations applied to improve execution speed, exception handling reliability is maintained by accurately reporting and handling exceptions through the translation layer.
Data Source
AI summary
A target computing system performs program code conversion from subject code, executable by a subject computing architecture, into target code executable by the target computing system, and then executes the target code. The target system handles exceptions during binding to native code. Native code binding executes a portion of native code in place of translating a portion of the subject code into the target code. Upon an exception during execution of the portion of native code, the target system saves a target state representing a current point of execution for the portion of native code, and creates a subject state representing an emulated point of execution in the subject architecture. A subject exception handler handles the exception with reference to the subject state. Upon resuming execution from the exception using the subject state, the saved target state is restored to resume execution in the section of portion of native code.


