# US 2019/0171423 A1 · Reconstructing a High Level Compilable Program from an Instruction Trace

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2019/0171423 A1
- Document ID: US20190171423A1
- Status: Published application
- Kind: A1
- Application number: 16/272,532
- Filed: 2019-02-11
- Published: 2019-06-06
- Earliest claimed: 2017-02-06
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Biplob Mishra; Saritha Vinod
- Web page: https://patentgrep.com/patent/US20190171423A1

## CPC

- G06F 8/30: Creation or generation of source code
- G06F 8/41: Compilation
- G06F 8/53: Decompilation; Disassembly
- G06F 8/75: Structural analysis for program understanding
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Mechanisms are provided for generating a new compilable program from an instruction trace. The mechanisms receive a trace file for an original program whose execution on computing hardware has been traced and perform analysis of the trace file to identify a hot function, symbol information corresponding to the hot function, and initialization parameters for the hot function. The mechanisms generate a trace control flow graph based on the identified hot function and the symbol information corresponding to the hot function. The mechanisms identify, based on the trace control flow graph, pathways in the original program to the hot function, represented in the trace file. The mechanisms generate a reconstructed program based on the trace control flow graph, the pathways to the hot function, and the initialization parameters, and output the reconstructed program.

## Claims

### Claim 1

A method, in a data processing system comprising at least one processor and at least one memory, wherein the at least one memory comprises instructions which are executed by the at least one processor to specifically configure the at least one processor to implement one or more elements of a conversion engine that operates to perform the method, the method comprising:
receiving, by the conversion engine, a trace file for an original program whose execution on computing hardware has been traced;
performing, by the conversion engine, analysis of the trace file to identify a hot function, symbol information corresponding to the hot function, and initialization parameters for the hot function;
generating, by the conversion engine, a trace control flow graph based on the identified hot function and the symbol information corresponding to the hot function;
identifying, by the conversion engine, based on the trace control flow graph, pathways in the original program to the hot function, represented in the trace file;
generating, by the conversion engine, a reconstructed program based on the trace control flow graph, the pathways to the hot function, and the initialization parameters; and
outputting, by the conversion engine, the reconstructed program.

### Claim 2 (depends on 1)

The method of claim 1, wherein performing analysis of the trace file comprises executing a symbol mapper on the trace file to correlate instruction addresses with corresponding symbols and thereby generate symbol information for the trace file.

### Claim 3 (depends on 1)

The method of claim 1, further comprising:
receiving, by the conversion engine from a compiler, a binary code corresponding to the original program;
analyzing, by the conversion engine, the binary code to generate function information corresponding to the binary code; and
generating, by the conversion engine, a program control flow graph of the entire original program based on the function information corresponding to the binary code, wherein identifying pathways to the hot function comprises comparing the program control flow graph to the trace control flow graph to identify at least one portion of the program control flow graph that invokes at least one portion of the trace control flow graph.

### Claim 4 (depends on 1)

The method of claim 1, wherein performing analysis of the trace file to identify a hot function comprises selecting a function, from one or more functions represented in the trace file, based on corresponding hot function metrics associated with the one or more functions, to be the hot function.

### Claim 5 (depends on 4)

The method of claim 4, wherein the hot function metrics comprise, for each function, a percentage of references to the function in the trace file, and wherein selecting the function based on corresponding hot function metrics associated with the one or more functions comprises selecting a function having a highest percentage of references to the selected function when compared to percentages of references of other functions in the one or more functions.

### Claim 6 (depends on 1)

The method of claim 1, wherein generating the reconstructed program comprises:
reconstructing a portion of the original program corresponding to the hot function;
reconstructing portions of the original program that are part of pathways to the hot function; and
generating an initialization function, based on the initialization parameters, to initialize parameters for the hot function.

### Claim 7 (depends on 6)

The method of claim 6, wherein the reconstructed program comprises only the portion of the original program corresponding to the hot function, portions of the original program that are part of the pathways to the hot function, and the initialization function, and other portions of the original program are not included in the reconstructed program.

### Claim 8 (depends on 1)

The method of claim 1, wherein the trace control flow graph is a sub-graph of the program control flow graph.

### Claim 9 (depends on 1)

The method of claim 1, wherein outputting the reconstructed program comprises debugging a hardware architecture used to generate the trace file at least by executing the reconstructed program on the hardware architecture that was used to generate the trace file.

### Claim 10 (depends on 1)

The method of claim 1, wherein outputting the reconstructed program comprises at least one of executing the reconstructed program on a new hardware architecture different than that used to generate the trace file or compiling the reconstructed program with a new compiler different than a complier that was used to generate the binary file.

### Claim 11

A computer program product comprising a computer readable storage medium having a computer readable program stored therein, wherein the computer readable program, when executed on a computing device, causes the computing device to be specifically configured to implement one or more elements of a conversion engine that operates to:
receive a trace file for an original program whose execution on computing hardware has been traced;
perform analysis of the trace file to identify a hot function, symbol information corresponding to the hot function, and initialization parameters for the hot function;
generate a trace control flow graph based on the identified hot function and the symbol information corresponding to the hot function;
identify based on the trace control flow graph, pathways in the original program to the hot function, represented in the trace file;
generate a reconstructed program based on the trace control flow graph, the pathways to the hot function, and the initialization parameters; and
output the reconstructed program.

### Claim 12 (depends on 11)

The computer program product of claim 11, wherein performing analysis of the trace file comprises executing a symbol mapper on the trace file to correlate instruction addresses with corresponding symbols and thereby generate symbol information for the trace file.

### Claim 13 (depends on 11)

The computer program product of claim 11, wherein the computer readable program further causes the conversion engine of the computing device to:
receive, from a compiler, a binary code corresponding to the original program;
analyze the binary code to generate function information corresponding to the binary code; and
generate a program control flow graph of the entire original program based on the function information corresponding to the binary code, wherein the computer readable program further causes the conversion engine of the computing device to identify pathways to the hot function at least by comparing the program control flow graph to the trace control flow graph to identify at least one portion of the program control flow graph that invokes at least one portion of the trace control flow graph.

### Claim 14 (depends on 11)

The computer program product of claim 11, wherein the computer readable program further causes the conversion engine of the computing device to perform analysis of the trace file to identify a hot function of the original program at least by selecting a function, from one or more functions represented in the trace file, based on corresponding hot function metrics associated with the one or more functions, to be the hot function.

### Claim 15 (depends on 14)

The computer program product of claim 14, wherein the hot function metrics comprise, for each function, a percentage of references to the function in the trace file, and wherein the computer readable program further causes the conversion engine of the computing device to select the function based on corresponding hot function metrics associated with the one or more functions at least by selecting a function having a highest percentage of references to the selected function when compared to percentages of references of other functions in the one or more functions.

### Claim 16 (depends on 11)

The computer program product of claim 11, wherein the computer readable program further causes the conversion engine of the computing device to generate the reconstructed program at least by:
reconstructing a portion of the original program corresponding to the hot function;
reconstructing portions of the original program that are part of pathways to the hot function; and
generating an initialization function, based on the initialization parameters, to initialize parameters for the hot function.

### Claim 17 (depends on 16)

The computer program product of claim 16, wherein the reconstructed program comprises only the portion of the original program corresponding to the hot function, portions of the original program that are part of the pathways to the hot function, and the initialization function, and other portions of the original program are not included in the reconstructed program.

### Claim 18 (depends on 11)

The computer program product of claim 11, wherein the trace control flow graph is a sub-graph of the program control flow graph.

### Claim 19 (depends on 11)

The computer program product of claim 11, wherein the computer readable program further causes the conversion engine of the computing device to output the reconstructed program comprises at least one of:
debugging a hardware architecture used to generate the trace file at least by executing the reconstructed program on the hardware architecture that was used to generate the trace file;
executing the reconstructed program on a new hardware architecture different than that used to generate the trace file; or
compiling the reconstructed program with a new compiler different than a complier that was used to generate the binary file.

### Claim 20

An apparatus comprising:
a processor; and
a memory coupled to the processor, wherein the memory comprises instructions which, when executed by the processor, cause the processor to:
receive a trace file for an original program whose execution on computing hardware has been traced;
perform analysis of the trace file to identify a hot function, symbol information corresponding to the hot function, and initialization parameters for the hot function;
generate a trace control flow graph based on the identified hot function and the symbol information corresponding to the hot function;
identify based on the trace control flow graph, pathways in the original program to the hot function, represented in the trace file;
generate a reconstructed program based on the trace control flow graph, the pathways to the hot function, and the initialization parameters; and
output the reconstructed program.
