S/390 Binary Decompilation for Efficient x86 Recompilation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for executing mainframe computer programs on modern processors, such as x86 architectures, suffer from inefficiencies due to the interpretation of S/390 binary code, leading to increased processor cycles and inability to maintain or extend the programs, especially for self-modifying or self-interpreting codes.
Innovation Solution
A method and apparatus that decompiles S/390 binary code into an intermediate language by identifying parameterized code patterns, assigning terminal symbols, and converting them to non-terminal symbols using a context-free grammar, allowing for the recovery of program logic independent of the processor architecture, followed by recompilation into efficient machine code for the target architecture.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If S/390 binary code is interpreted on x86 processors, then program execution is possible, but processor cycles increase significantly
Solution Approach 1:
The patent introduces an intermediate representation (IR) as a mediator between the S/390 binary code and the x86 target architecture. The decompiler translates S/390 code into this intermediate representation, which then serves as input for the compiler to generate optimized x86 code. This intermediary layer enables architectural independence and allows for optimization opportunities that direct translation would miss.
Solution Approach 2:
The translation process is segmented into distinct phases: decompilation (binary code to intermediate representation) and recompilation (intermediate representation to target machine code). This segmentation allows each phase to be optimized independently and enables the insertion of optimization steps between the source and target architectures.
2Adaptability or versatility
If S/390 binary code is interpreted, then execution is achieved, but code maintenance and extension become impossible
Solution Approach 1:
The intermediate representation acts as a maintainable intermediary that captures the semantic meaning of the original S/390 code in an architecture-independent form. This allows developers to read, understand, and modify the program logic without dealing with machine-specific instructions, thereby improving maintainability while preserving cross-platform execution capability.
3Ease of manufacture
If direct translation of S/390 code is performed, then translation is simple, but efficiency losses occur due to architectural differences
Solution Approach 1:
The intermediate representation serves as a mediator that enables both simplicity in translation and efficiency in execution. The decompiler provides a systematic approach to translating S/390 code into a standardized intermediate form, while the subsequent compiler can then generate optimized target code leveraging modern x86 architecture features, thus achieving both ease of translation and execution efficiency.
Data Source
AI summary
A decompilation apparatus includes a matcher that divides captured first program code for a processor of a first processor architecture into a sequence of code sections based on a predetermined set of at least partially parameterized code patterns, wherein the first program code implements a program logic and has been generated by compiling a computer program defined in a high-level language by a compiler, and the matcher captures for each code section specific parameter values for each parameter of a corresponding parameterized code pattern and assigns to each code section a terminal symbol of an intermediate language; and a parser that reduces a sequence of terminal symbols assigned to the sequence of code sections to non-terminal symbols of the intermediate language, wherein a totality of the non-terminal symbols generated by the parser by reduction describes the program logic of the computer program in the intermediate language.


