US7757221B2 - Apparatus and method for dynamic binary translator to support precise exceptions with minimal optimization constraints - Google Patents

Apparatus and method for dynamic binary translator to support precise exceptions with minimal optimization constraints Download PDF

Info

Publication number
US7757221B2
US7757221B2 US11/241,610 US24161005A US7757221B2 US 7757221 B2 US7757221 B2 US 7757221B2 US 24161005 A US24161005 A US 24161005A US 7757221 B2 US7757221 B2 US 7757221B2
Authority
US
United States
Prior art keywords
instruction
exception
source
identified
instructions
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active, expires
Application number
US11/241,610
Other versions
US20070079304A1 (en
Inventor
Bixia Zheng
Cheng C. Wang
Ho-Seop Kim
Mauricio Breternitz, Jr.
Youfeng Wu
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Intel Corp
Original Assignee
Intel Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Intel Corp filed Critical Intel Corp
Priority to US11/241,610 priority Critical patent/US7757221B2/en
Assigned to INTEL CORPORATION reassignment INTEL CORPORATION ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: KIM, HO-SEOP, WANG, CHENG C., WU, YOUFENG, BRETERNITZ, MAURICIO, JR., ZHENG, BIXIA
Publication of US20070079304A1 publication Critical patent/US20070079304A1/en
Application granted granted Critical
Publication of US7757221B2 publication Critical patent/US7757221B2/en
Active legal-status Critical Current
Adjusted expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45516Runtime code conversion or optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation

Definitions

  • One or more embodiments relate generally to the field of binary application translation. More particularly, one or more of the embodiments relate to a method and apparatus for dynamic binary translator to support precise exceptions with minimal optimization constraints.
  • ISA instruction set architecture
  • Computer program statements that have been decoded into machine instructions for a source ISA may undergo a binary translation in order to be executed at a target ISA, such as a reduced instruction set computer (RISC) architecture, or a very long instruction word (VLIW) architecture.
  • RISC reduced instruction set computer
  • VLIW very long instruction word
  • the translation may be performed by a dynamic translator, typically stored in memory.
  • instructions are typically translated one basic block of instructions (BB) at a time and stored in memory.
  • BB basic block of instructions
  • each basic block of instructions may include a contiguous sequence of non-branch instructions (i.e., do not change order of executing instructions) which typically ends with a branch instruction.
  • translated executable (binary) applications are generally not optimized in order to take advantage of the various optimization techniques provided by the target ISA.
  • the performance of the target ISA is often a function of how well the processor manipulates and controls the flow of data within the system.
  • a target ISA can generally provide increased speed and throughput of instructions executed by the processor, as a result of several decades of engineering and research for optimizing instruction execution and data throughput as compared to a legacy (source) ISA.
  • the processors of the target ISAs achieve increased performance by executing instructions out of their original program order. By scheduling instructions according to availability of machine resources the processor is allowed to take advantage of parallelism inherent in the code.
  • FIG. 1 is a block diagram illustrating a computer system including a dynamic binary translator to support precise exceptions with minimal optimization constraints, in accordance with one embodiment.
  • FIG. 2 is a block diagram further illustrating translation of a source program into an optimized translated code, in accordance with one embodiment.
  • FIG. 3 illustrates an intermediate representation (IR) of a source binary application modified to include identified exception instructions (EI), irreversible instructions (II) and inserted, pseudo II instructions, in accordance with one embodiment.
  • EI identified exception instructions
  • II irreversible instructions
  • pseudo II pseudo II instructions
  • FIG. 4 illustrates an IR representation of a source binary application modified to represent a source mapping of registers and code motion, in accordance with one embodiment.
  • FIG. 5 is a flowchart illustrating an IR representation of a source binary application to illustrate binding of EI instructions and II instructions in addition to optimization and register allocation, in accordance with one embodiment.
  • FIG. 6 illustrates an optimized translated binary application from a source instruction set architecture (ISA) to a target ISA, in accordance with one embodiment.
  • ISA source instruction set architecture
  • FIG. 7 is a block diagram illustrating dynamic binary translation to support precise exceptions, in accordance with one embodiment.
  • FIG. 8 is a flowchart illustrating a method for dynamic binary translation to support precise exceptions with minimal optimization constraints, in accordance with one embodiment.
  • FIG. 9 is a flowchart illustrating a method for populating a data structure to track recovery point instructions corresponding to detected EI instructions, in accordance with one embodiment.
  • FIG. 10 is a flowchart for inserting pseudo recovery point instructions within a translated binary application, in accordance with one embodiment.
  • FIG. 11 is a flowchart illustrating a method for inserting pseudo recovery point instructions at control flow joints of a translated region, in accordance with one embodiment.
  • FIG. 12 is a flowchart illustrating a method for generating a state mapping table to enable recovery of a source ISA state at a predetermined recovery point instruction.
  • FIG. 13 is a flowchart illustrating a method for optimizing a sequential intermediate representation of a source binary application, in accordance with one embodiment.
  • FIG. 14 is a flowchart illustrating a method for binding EI instructions with identified reaching recovery point instructions, in accordance with one embodiment.
  • FIG. 15 is a flowchart illustrating a method for optimization of a non-sequential intermediate representation of a source binary application, in accordance with one embodiment.
  • FIG. 16 is a flowchart illustrating a method for generating runtime information to enable recovery of a source ISA state prior to issuance of an exception by an EI instruction, in accordance with one embodiment.
  • FIG. 17 is a flowchart illustrating a method for restoring a source ISA application state to enable exception recovery, in accordance with one embodiment.
  • FIG. 18 is a flowchart illustrating a method for restoring the source ISA application state to enable exception recovery of FIG. 17 , in accordance with one embodiment.
  • FIG. 19 is a flowchart illustrating a method for performing execution recovery at an EI instruction, in accordance with one embodiment.
  • FIG. 20 is a flowchart illustrating a method for executing source ISA instructions subsequent to a recovery point instruction, in accordance with one embodiment.
  • the method includes the translation of a source binary application generated for a source instruction set architecture (ISA) into a sequential, intermediate representation (IR) of the source binary application.
  • ISA source instruction set architecture
  • IR sequential, intermediate representation
  • the sequential IR is modified to incorporate exception recovery information for each exception instruction identified from the source ISA binary application.
  • incorporation of exception recovery information within the sequential IR enables a dynamic binary translator (DBT) to represent exception recovery values to support precise exceptions as regular values used by IR instructions.
  • DBT dynamic binary translator
  • the sequential IR may be optimized by, for example, copy propagation, code motion, dead code elimination with the constraint of prohibiting movement of an identified exception instruction (EI) downward in passing a predetermined II instruction.
  • the modified, non-sequential IR may be further optimized to form a translated binary application for a target ISA.
  • logic is representative of hardware and/or software configured to perform one or more functions.
  • examples of “hardware” include, but are not limited or restricted to, an integrated circuit, a finite state machine or even combinatorial logic.
  • the integrated circuit may take the form of a processor such as a microprocessor, application specific integrated circuit, a digital signal processor, a micro-controller, or the like.
  • FIG. 1 is a block diagram illustrating a computer system 100 including a dynamic binary translator 200 to support precise exceptions with minimal optimization constrains, in accordance with one embodiment.
  • computer system 100 comprises a processor system bus (front side bus (FSB)) 104 for communicating information between processor (CPU) 102 and chipset 110 .
  • processor system bus front side bus (FSB)
  • FTB front side bus
  • chipset the term “chipset” is used in a manner to collectively describe the various devices coupled to CPU 102 to perform desired system functionality.
  • CPU 102 may be a multicore chip multiprocessor (CMP).
  • CMP multicore chip multiprocessor
  • chipset 110 may include memory controller hub (MCH) 120 coupled to graphics (GFX) controller 130 via an interconnect 132 .
  • MCH 120 is integrated into MCH 120 such that, in one embodiment, MCH 120 operates as an integrated graphics MCH (GMCH).
  • MCH 120 is also coupled to main memory 146 via interconnect 142 .
  • main memory 140 may include, but is not limited to, random access memory (RAM), dynamic RAM (DRAM), static RAM (SRAM), synchronous DRAM (SDRAM), double data rate (DDR) SDRAM (DDR-SDRAM), Rambus DRAM (RDRAM) or any device capable of supporting high-speed buffering of data.
  • chipset may include an input/output (I/O) controller hub (ICH) 150 .
  • ICH 150 may include a universal serial bus (USB) link or interconnect 102 to couple one or more I/O devices 160 to ICH 150 .
  • I/O devices 160 may be coupled to ICH 150 via a point-to-point link, including, but not limited to, peripheral component interconnect (PCI) Express (PCI-Express) or other like point-to-point interconnect.
  • PCI peripheral component interconnect
  • PCI-Express peripheral component interconnect Express
  • SATA serial advance technology attachment
  • HDD hard disk drive devices
  • BIOS basic input/output system
  • BIOS basic input/output system
  • chipset 110 is illustrated as including a separate MCH 120 and ICH 150 , in one embodiment, MCH 120 may be integrated within CPU 102 . In an alternative embodiment, the functionality of MCH 120 and ICH 150 are integrated within chipset 110 . In one embodiment, dynamic binary translator 200 may be implemented within computer systems including an MCH integrated within a CPU, an MCH and ICH integrated within a chipset, as well as a system on-chip. Accordingly, those skilled in the art should recognize that FIG. 1 is provided to illustrate one embodiment and should not be construed in a limiting manner.
  • DBT dynamic binary translator
  • IR intermediate representation
  • exception recovery information the incorporation of information required to recover from an exception
  • ISA target instruction set architecture
  • FIG. 2 is a block diagram illustrating dynamic binary translation with support for precise exceptions with minimal optimization constraints, in accordance with one embodiment.
  • instructions are typically translated one block of instructions (BB) at a time and stored in memory in an area allocated for storing translating BBs.
  • the machine instructions of a source program 210 are typically translated and stored in memory in separate blocks of instructions.
  • each block of instructions consists of a contiguous sequence of non-branch machine instructions ending with a branch instruction.
  • a binary application such as the source binary application 210 of FIG. 2 typically consists of multiple blocks of instructions stored in the physical static sequence (e.g., BB 1 , . . . , BB 10 ).
  • source program 210 may refer to code of a binary application that is written for a native or source instruction set architecture (ISA).
  • ISA native or source instruction set architecture
  • DBT 200 translates source program 210 , which is written for a source ISA into optimized translated code 300 for a target ISA.
  • computer system 100 may be referred to as a very long instruction word (VLIW) architecture and is also referred to herein as the “target ISA.”
  • VLIW very long instruction word
  • target ISA the term “source ISA” may refer to ISAs having instruction words that are smaller than the VLIW architecture capabilities of computer system 100 .
  • computer system 100 may refer to a computer architecture manufactured by the Intel Corporation of Santa Clara, Calif., to process, for example, 64-bit, 128-bit or larger instruction words.
  • source ISA may refer to computer architectures configured to handle 32-bit instruction words, such as, for example, the 32-bit Intel Architecture (IA-32) execution layer (IA32EL).
  • target ISAs such as computer system 100 , are required to provide compatibility with legacy or source ISAs by translating binary applications of the source ISAs according to a target ISA, of, for example, computer system 100 .
  • the translation is performed using DBT 200 .
  • DBTs such as DBT 200
  • DBT 200 take advantage of information discovered at runtime to perform binary optimizations to improve performance using, for example, features that are available by a target ISA, but generally not supported by a source ISA.
  • instructions such as, load, store and floating point instructions may cause exceptions, generally prohibits optimization binary of source binary applications. Supporting such exceptions is essential for providing full binary compatibility in DBT system.
  • enabling recovery of exception handling may severely constrain optimization of a binary application that is translated for a target ISA.
  • optimization for the target ISA may not be able to move an update of a register past an EI instruction because doing so may change the machine state seen by an exception hander.
  • reordering of load instructions that potentially cause segmentation errors is prohibited because such reordering of the exceptions raised by the two instructions may prevent precise exception handling.
  • DBT 200 is designed to support precise exceptions with minimal optimization constraints. As described herein, to “support precise exceptions” may require the following: (1) the order of the exceptions that match that generated by the original source code; and (2) the exception handler should see the same processor state as if the original source raised the exception.
  • FIG. 2 is a block diagram illustrating translation and optimization of a source program where the optimized translated code 300 is modified to support precise exceptions with minimal optimization constraints, in accordance with one embodiment.
  • DBT 200 incorporates the information required to support precise exceptions into an intermediate representation 300 , referred to herein as “exception recovery information.”
  • exception recovery information is represented as one or more regular values within IR 300 . In one embodiment, this allows DBT 200 to treat values used by exception handling in a similar way that values of the source program code 210 are treated to enable a reduction of optimization constraints on an optimized, translated binary application.
  • source code of basic block 212 includes both exception instructions (EI) and irreversible instructions (II).
  • EI exception instructions
  • II irreversible instructions
  • an “exception instruction,” or EI may refer to an instruction, such as a load, store and division instruction, which may potentially generate a runtime exception.
  • an “irreversible instruction,” or II may refer to an instruction that changes the application state in a way that prohibits DBT 200 from recovering a previous application state. In other words, the execution of an II may prevent DBT 200 from rolling back and re-executing the II.
  • store instructions and system call instructions may be identified as irreversible instructions, or IIs.
  • source instruction S 2 222 refers to a store instruction and may be identified as both an exception or EI instruction, as well as an irreversible or II instruction.
  • Source instruction S 3 234 is a load instruction and is identified by DBT 200 as an EI instruction, whereas source instruction S 5 228 is referred to as both an EI instruction and an II instruction.
  • II source table 240 provides a data structure that may be used to track II instructions.
  • an identification value (II_ID) 242 is assigned to the II instruction to enable unique identification of the II instruction.
  • an address of the source instruction immediately following the II instruction (II_NSA) 244 is also stored within source table 240 .
  • DBT 200 restores a source machine state to the state immediately following the execution of the nearest preceding II instruction. Once restored, in one embodiment, DBT 200 begins interpreting instructions beginning with the next source instruction immediately following the nearest, preceding II instruction, referred to herein as “a recovery point instruction.” As described herein, a “recovery point instruction” may refer to an instruction in the source code, to restart execution for exception recovery.
  • an II instruction may be conceptually referred to as defining a value of a consistent state and an EI instruction that uses a value of a consistent state defined by an II instruction may be referred to herein as an II instruction that reaches the EI instruction (“reaching II instruction”).
  • the “consistent state” defined by a reaching II instruction may refer to the source register values if the source code is sequentially executed up to the recovery point instruction corresponding to the reaching II.
  • each EI instruction is required to have a reaching II instruction.
  • an EI instruction might not have a reaching II instruction.
  • DBT 200 may insert pseudo II instructions into IR 300 , such that each EI instruction includes a reaching II instruction
  • DBT 200 includes EI SMAP table 250 .
  • table 280 represents an EI instruction identification (EI_ID) 282 , a source register value needed to recover the consistent state defined by a corresponding reaching II instruction, and represents a virtual register mapping (SMAP) 284 for needed source registers of a source ISA.
  • DBT 200 may insert IR instructions within IR 300 to store source register values, which are required to enable reproduction of a consistent state at the corresponding reaching II instruction.
  • EI reach table 260 may store a unique identification value assigned to an EI instruction (EI_ID) 262 and for that EI instruction, table 260 stores a unique identification value assigned to the reaching II instruction (II_ID) 264 to enable the reaching II instruction to define a consistent state and a recovery point instruction.
  • the recovery point instruction indicated by a reaching II instruction refers to an instruction of the source code to restart exception for execution recovery.
  • the mapping information from SMAP table 280 identifies the source register values that would be generated if the source code is sequentially executed up to the recovery point instruction to provide the consistent state at the reaching II instruction for exception recovery.
  • source table 240 , EI reach table 260 and SMAP 280 illustrate the values stored to enable the definition of a consistent state at various reaching II instructions of corresponding EI instructions to support precise exceptions.
  • optimized translated code 400 is provided, which may include, for example, code motion, dead code elimination, as well as additional optimizations following the binding of EI instructions and their corresponding reaching II instructions. Accordingly, in one embodiment, optimizations may be performed by DBT 200 for source binary code 210 .
  • the explicit constraint on such optimizations required to support precise exceptions is the prevention of the movement of an EI instruction downward past an II instruction.
  • FIGS. 3-7 illustrate the process of dynamic binary translation and optimization, as performed by DBT 200 for source code block 220 of source program code 210 , as shown in FIG. 2 .
  • FIGS. 3-7 illustrate the generation of the IR representation of BB 1 350 , BB 10 390 of IR 300 and the representation of BB 1 402 and BB 10 430 of optimized translated code 400 , as shown in FIG. 2 .
  • FIG. 2 In the IR representation of the translation regions 302 - 359 , as shown in FIGS. 3-6 and translation regions 360 - 392 as shown in FIG.
  • t j is an integer
  • SSA static, single assignment
  • SSA form is an intermediate representation that effectively separates the values operated in a program from the locations they are stored in to enable more effective versions of several optimizations.
  • a procedure is in SSA form if every variable is assigned a value in the procedure occurs as the target of only one assignment.
  • FIG. 3 illustrates translation regions 302 and 320 to depict the identification of EI instructions and II instructions, as well as the insertion of instructions to load values to enable definition of a consistent state at corresponding II instructions (N 1 -N 1 ) or inserted pseudo II instructions, according to one embodiment.
  • each source instruction (SI) is translated into a sequence of IR instructions (N 1 -N 14 ).
  • source instructions S 2 224 , S 3 226 and S 5 228 of source program block 220 shown in FIG. 2 , are identified as EI instructions 304 , 306 and 308 .
  • EI instructions 304 and 308 are also load instructions, which may be identified as both II instructions and EI instructions (“II/IE”). Accordingly, as shown in translation region 302 , EI instruction 306 is identified by “ldind_EI,” while EI/II instructions 304 and 308 , are identified by “stind_II_EI.” As shown in II source table 240 , an identification value (II_ID) 242 and a next source address (II_NSA) 246 of II/IE instructions 304 and 308 are stored in table 240 .
  • II_ID identification value
  • II_NSA next source address
  • a pseudo II instruction 322 is inserted into the regionEntry( ) and an identification value (N 15 ) and a source address pair (s 1 ) 322 (N 15 , S 1 ) are added to II source table 240 .
  • a “ldvar” instruction ( 310 - 316 ) are inserted within translation regions 302 and 320 to load the values for the consistent state corresponding to the II instructions.
  • a pseudo II instruction 322 is inserted at the entry of the translated region 320 .
  • an SMAP representation ( 340 , 342 ) is added to the two stind_II_EI instructions 304 and 308 .
  • FIG. 4 illustrates translation regions 330 and 340 , in accordance with one embodiment.
  • instructions 332 - 336 to load values for enabling the definition of a consistent state at corresponding II instructions and pseudo II instructions are added to translation region 330 .
  • an SMAP representation 340 and 342 are added to EI/II instructions 304 and 308 to represent a register mapping for the consistent state defined by the two instructions.
  • SMAP representation 338 is added to Pseudo II instruction 322 .
  • IR instructions 332 - 336 are generated to represent the source register values needed to recover the consistent state as pseudo uses and represent the virtual register mapping for the needed source registers. This IR representation is generated for each II instruction in process block 530 .
  • SMAP_SRegs(II) is the set of source registers whose values are needed to recover the consistent state defined by an II instruction.
  • SMAP( s 1 ⁇ t 1 , s 2 ⁇ t 2 , . . . s m ⁇ t m ) (1) is associated with the II instruction to represent that after the execution of the instruction, the value of source register s i is stored in virtual register t i .
  • the actual set of SMAP_SRegs for each II is a subset of all the source registers and can be determined by performing data flow analysis on the code region that includes the II instruction and all the EI instructions it reaches.
  • dataflow analysis is to provide global information about how a procedure (or a larger segment of a program) manipulates its data. Accordingly, in one embodiment, dataflow analysis may be used to determine such global information about the source register values required to achieve a consistent state at one or more II instructions.
  • IR optimization is performed from translation region 330 .
  • EI instruction 306 is moved ahead of EI/II instruction 304 .
  • the one too many correspondence between the original source instructions 220 and the IR instructions is removed to prohibit obscuring the details of the invention.
  • Translation region 350 is also shown in FIG. 2 within IR 300 .
  • FIG. 5 illustrates translation regions 352 and 354 , in accordance with one embodiment.
  • pseudo II instruction 338 is identified as the reaching II instruction to define the consistent state for recovering the exception generated by EI instruction 306 .
  • a copy of the SMAP information 338 associated with pseudo II instruction 322 is copied to EI instruction 304 .
  • an EI_ID and a reaching II_ID (N 8 , N 14 ) of EI instruction 306 are added to EI reach table 260 .
  • EI/II instructions 304 and 308 are selected as the respective EI/II instructions. Accordingly, in one embodiment, no changes are made to the existing SMAP information associated with these two instructions. As shown by EI reach table 260 , the following pairs (N 7 , N 7 ) and (N 13 , N 13 ) are recorded within EI reach table 260 .
  • translation region 354 illustrates modification of translation region 352 after register allocation. Representatively, variables s 1 and temporary variables t 1 , t 2 , etc. are placed with native registers r 1 356 , r 3 357 and r 6 358 .
  • FIG. 6 illustrates translation region 402 of optimized translated code 400 , according to one embodiment.
  • the SMAP table 280 is modified to add mapping information.
  • the table has two entries: EI instruction represented as the IR instruction ID 282 and the SMAP information 284 for the consistent state.
  • table 280 along with source table 240 and reach table 260 , provide all the needed information to enable exception recovery to support precise exceptions.
  • FIG. 8 the particular methods associated with various embodiments are described in terms of computer software and hardware with reference to a flowchart.
  • the methods to be performed by a computing device may constitute state machines or computer programs made up of computer-executable instructions.
  • the computer-executable instructions may be written in a computer program and programming language or embodied in firmware logic. If written in a programming language conforming to a recognized standard, such instructions can be executed in a variety of hardware platforms and for interface to a variety of operating systems.
  • embodiments of the invention are not described with reference to any particular programming language. It will be appreciated that a variety of programming languages may be used to implement embodiments of the invention as described herein. Furthermore, it is common in the art to speak of software, in one form or another (e.g., program, procedure, process, application, etc.), as taking an action or causing a result. Such expressions are merely a shorthand way of saying that execution of the software by a computing device causes the device to perform an action or produce a result.
  • FIG. 8 is a flowchart illustrating a method 500 for a dynamic binary translator to support precise exception with minimal optimization constraints, in accordance with one embodiment.
  • examples of the described embodiments are made with reference to FIGS. 1-7 .
  • the described embodiments should not be limited to the examples provided to limit the scope provided by the appended claims.
  • the dynamic binary translation method 500 as shown in FIG. 8 , is described with reference to the flowcharts of FIGS. 9-16 .
  • process block 502 is further described with reference to FIG. 9 .
  • FIG. 9 is a flowchart illustrating a method 504 for identification of EI and II instructions, in accordance with one embodiment.
  • EI instructions and II instructions are first identified.
  • II instruction 362 and EI instruction 364 are identified within translation region 360 .
  • identification of EI and II instructions is performed during the translation of source binary instruction to IR and before an optimization.
  • the source load and division instructions are identified as EI instructions and the store instructions are identified as both EI instructions and II instructions (EI/II) instructions.
  • analysis may be performed to avoid marking the instructions that will not cause exception as EI instruction.
  • EI instructions and II instructions are identified at process blocks 506 and 508 .
  • a runtime table is generated.
  • the runtime table is illustrated as II_Source Table 240 , as shown in FIG. 7 .
  • a pair of values (II_ID, II_NextSourceAddress) is recorded in, for example, II source table 240 .
  • II_ID is a unique ID to identify the II instruction in IR 300
  • II_NextSourceAddress is the address of a source instruction right after the II instruction (II_NSA) that is selected as a recovery point instruction as shown in FIG. 7 .
  • pseudo II instructions are inserted at certain program points.
  • the insertion of pseudo II instructions performed at process block 520 ensures that for each EI instruction, there is one II instruction that reaches the EI instruction. This makes it possible to statically determine a recovery point instruction for each EI instruction.
  • pseudo II instruction 372 is inserted at the entry of the translated region 370 , to ensure that the first EI instruction in region 364 has a reaching II instruction. In one embodiment, if the region being translated has control-flow joints, there may be more than one II instruction reaching an EI instruction.
  • a pair of (II_ID, II_NSA) is also added to II_Source_Table 240 (see FIG. 7 ).
  • the II_NSA for pseudo II instruction 372 at the entry of the translated region 370 is the address of the first source instruction in region 370 .
  • representing the interpretation for recovering an exception raised by an EI instruction ( 362 / 364 ) will start from the first source instruction (N 22 ) in region 370 .
  • the II_NSA for the pseudo II instruction at a control-flow joint point is the address of the first source instruction for the corresponding joint basic block. This means if multiple II instructions reach an EI instruction, the interpretation for recovering the exception raised by the EI instruction will start from the first source instruction in basic block where the paths from the multiple II instructions and the EI instruction first join.
  • pseudo II instructions are inserted at control-flow joint points to ensure that only one consistent state reaches each EI instruction.
  • IR instructions 332 - 336 are generated to represent the source register values needed to recover the consistent state as pseudo uses and represent the virtual register mapping for the needed source registers. This IR representation is generated for each II instruction at process block 540 of FIG. 8 .
  • FIG. 10 is a flow chart illustrating a method 522 for inserting pseudo II instructions that control flow joints of a translation region in accordance with one embodiment.
  • a pseudo II instruction is inserted as an entry of each translated region within an IR such as IR 300 as shown in FIG. 7 .
  • a pseudo II instruction is inserted at each control flow joint for each translated region having a control flow joint. Further details regarding the insertion of pseudo II instructions or control flow joints are described in FIG. 11 .
  • FIG. 11 is a flow chart illustrating a method 530 for inserting pseudo II instructions of control flow joints of process block 526 as shown in FIG. 10 in accordance with one embodiment.
  • each block within a sequential II representation is identified that includes an EI instruction.
  • FIG. 12 is a flow chart illustrating a method 542 for generating the IR to represent the SMAP for each II by process 540 in accordance with one embodiment.
  • process block 544 it is determined whether a source register value is required to recover a consistent state at an II instruction. When such is the case, at process block 546 , at least one instruction is generated within the IR representation to store the source register value.
  • a state register mapping data structure is generated to provide a target ISA to source ISA register mapping according to the generated IR instruction, for example, as shown by translation region 330 as shown in FIG. 4 .
  • IR instructions 332 , 334 and 336 are generated within translation region 330 for the source register S 1 .
  • IR optimizations are performed with certain constraints on code motions as shown by translation region 380 of FIG. 7 .
  • the movement of an instruction downward passing an II instruction is prevented.
  • EI 1 which is right before an II instruction II 1 is moved down to right after II 1 .
  • II 1 has already been executed. This prevents the recovery of the consistent state for EI 1 , which is the state prior to execution. Therefore, the movement of EI instruction down a passing II instruction is prevented.
  • FIG. 13 is a flow chart illustrating a method for performing optimizations of process block 550 as shown in FIG. 8 in accordance with one embodiment.
  • code motion is performed to optimize a sequential IR representation of the source binder application to form a non-sequential IR.
  • copy propagation and debt code elimination may also be performed as part of process block 554 .
  • the code motion performed in process block 554 is monitored to prohibit the movement of an identified EI instruction beyond one of any identified II instructions and any inserted pseudo II instructions.
  • An optimized intermediate representation as shown in FIGS. 2 and 7 as optimized translated region 390 .
  • EI instruction 364 is reordered and moved before EI/II instruction 362 .
  • the SMAP information associated with the II instructions is removed.
  • binding an EI instruction as shown in translation region 390 of FIG. 7 SMAP information 382 is more to reaching EI instruction 364 to an II instruction means that when the EI instruction generates an exception, DBT 200 ( FIG. 2 ) restores the application state to the consistent state defined by the II instruction and starts interpretation from the source instruction right after the irreversible to recover the exception.
  • the reaching II instruction for each EI instruction is identified, according to one embodiment.
  • the algorithm to discover the reaching II instruction for each EI instruction is similar to the SSA renaming algorithm to find out the correct version of an SSA variable that reaches a use of the variable.
  • the instruction is bound to its reaching II instruction by copying the SMAP information from the II instruction to the EI instruction.
  • EI_Reach_Table to record pair (EI_ID, Reaching II_ID), where EI_ID is the unique ID to identify the EI instruction in the IR and Reaching II_ID is the unique ID to identify the II instruction that reaches the EI instruction.
  • FIG. 14 is a flow chart illustrating a method 562 for binding IE instructions with reaching II instructions of process block 560 , as shown in FIG. 8 , in accordance with one embodiment.
  • a reaching II instruction is identified for each EI instruction of the source binding application.
  • each identified EI exception is bound to a corresponding identified reaching II instruction.
  • EI instruction 364 is bound to pseudo II instruction 372 .
  • a data structure is generated to enable the identification of a reaching II for each identified EI instruction within the source binary application. For example, as shown in FIG. 7 , EI reaching table 260 is populated to show that EI instruction 364 (and 324 ) is bound to pseudo II instruction 372 (and 326 ).
  • an II instruction is not also an EI instruction, referred to herein as an EI/II instruction.
  • A an EI/II instruction.
  • the SMAP information generated for A at process block 530 may be referred to as SMAP_II(A).
  • SMAP_II(A) may represent the consistent state to recover the exceptions raised by the II instruction that A reaches.
  • SMAP_EI(A) the SMAP information generated for A at process block 530
  • SMAP_EI(A) may represent the consistent state to recover the exceptions raised by A.
  • the exception raised by A is directly reported without going through the interpretation process.
  • A is the reaching II instruction of itself or an EI/II instruction and uses SMAP_II(A) generated at process block 530 as SMAP_EI(A). Because (1) SMAP_II(A) represents the consistent state after a normal (no exception) execution of instruction A, and (2) when an exception happens at A, the processor restores the machine state to the state prior to the beginning of the execution of A, this embodiment relies on the assumption that the native machine has the same register states before executing A and after a normal execution of A.
  • an interpretation process is performed to recover the exception.
  • A is treated the same as other EI instructions in computing the reaching II instruction. This makes the reaching II instruction of A different from A itself. This embodiment may not be as efficient as a previous embodiment, but it doesn't rely on the assumption of the previous embodiment.
  • FIG. 7 illustrates the previous embodiment as EI/II instruction 362 is selected as its own reaching II instruction.
  • FIG. 15 illustrates a flow chart for performing a further optimization at process block 570 of FIG. 8 in accordance with one embodiment.
  • additional optimizations and register allocation are performed for modified non-sequential II 300 as shown in FIG. 7 .
  • reordering of identified EI instructions and II instructions is prohibited during the performance of the additional optimizations at process block 574 .
  • optimizations such as instruction combination and redundant load removal can create a dangling SMAP, which are eventually removed from IR 300 ( FIG. 8 .) Such optimizations are enhanced by removing dangling SMAP representation from IR 300 ( FIG. 8 .) Otherwise, optimizations should not affect SMAP representation.
  • the values used by SMAP 280 are kept for the purpose of exception handling.
  • the register allocation algorithm is extended to include the heuristics, such that the live values used by SMAP table 280 have lower spill cost to memory as compared with live values used by other instructions, assuming exceptions happen infrequently.
  • the SMAP information is extracted out from IR to construct a runtime table, referred to as EI_SMAP_Table 280 ( FIG. 7 ), to describe the consistent state register map for each instruction.
  • EI_SMAP_Table 280 FIG. 7
  • EI_ID the unique ID to identify the EI instruction in the IR
  • SMAP specifies the register mapping for the consistent state.
  • FIG. 16 is a flow chart illustrating a method 582 for performing the SMAP information extraction of process block 580 of FIG. 8 , in accordance with one embodiment.
  • register mapping information is extracted from the internal representation.
  • a runtime table is interrupted to provide a consistent state register map for each identified EI instruction. This table is shown as EI SMAP table 280 in FIG. 7 to illustrate EI instruction 364 of translated region 480 .
  • Information within register R 1 is mapped to register EAX to provide the source register to define the consistent state and corresponding source register values indicated by EI SMAP table 280 . Otherwise, it would be contained within the source registers of a source binding application 210 with sequentially executed up until the recovery point instruction 364 .
  • native code is emitted, in accordance with one embodiment.
  • the instruction ID, EI_ID is also replaced in the above runtime tables with the native instruction address for the corresponding EI instruction.
  • process blocks 520 , 540 , 560 and 580 construct three tables, II_Source_Table 240 , EI_Reach_II_Table 260 and EI_SMAP_Table 280 , which provide all the needed information to support precise exceptions. An implementation may combine these tables for efficiency.
  • FIG. 17 is a flowchart illustrating a method 600 for performing exception recovery according to a precise exception, in accordance with one embodiment.
  • an optimized, translated binary application from a binary application written for a source ISA and translated to a target ISA is executed.
  • a predetermined instruction corresponding to the EI instruction is identified.
  • such predetermined instruction may be referred to as a “reaching II instruction” of the exception, or EI, instruction.
  • a source ISA application state may be restored according to the identified instruction to enable exception recovery, for example, as described with reference to FIG. 18 .
  • FIG. 18 is a flowchart illustrating a method 630 for recovering a source ISA application state, in accordance with one embodiment.
  • a runtime exception invoked by the EI instruction is received in addition with a native exception state.
  • a source ISA application state is restored according to the reaching II instruction corresponding to the EI instruction.
  • one or more instructions subsequent to the reaching II instruction are executed to recover the exception.
  • FIG. 19 is a flowchart illustrating a method 640 for restoring the ISA application state at process block 620 of FIG. 17 , in accordance with one embodiment.
  • source register mapping information is identified according to an identification value assigned to the EI instruction. In one embodiment, such register mapping information may be contained within, for example, EI SMAP table 250 , as shown in FIG. 2 .
  • a source ISA application state is recovered according to register mapping contained within the identified register map data structure. Once recovered, at process block 646 , the exception may be delivered to an exception handler. In one embodiment, the exception recovery described with reference to FIG. 15 is based on an exception issued by an EI instruction, which is both an EI instruction and an II instruction.
  • FIG. 20 illustrates a method 650 for exception recovery for an exception caused by EI instruction having a reaching II instruction, in accordance with one embodiment.
  • a predetermined reaching instruction of the EI instruction is identified.
  • a source instruction is determined from the reaching instruction of the EI instruction.
  • such source instruction is the source instruction immediately following the corresponding reaching II instruction of the EI instruction.
  • source instructions are executed beginning with the identified instruction.
  • a source ISA application state is updated.
  • it is determined whether the EI instruction issues an exception during the execution of the source instruction When such exception is issued, at process block 662 , an updated source ISA application state at the EI instruction is provided to a user exception handler. Otherwise, execution continues until the end of the translated block.
  • DBT handles the exception as follows: (1) use the EI_ID to find the corresponding SMAP in EI_SMAP_Table; (2) Use the EI_ID to find the corresponding II_ID.
  • EI_ID and II_ID are the same, the EI instruction is also an II instruction, referred to herein as an EI/II instruction. Accordingly, DBT 200 may recover the consistent state using the SMAP table 280 and delivers the exception to the user exception handler as shown in FIGS. 2 and 19 . instruction.
  • the II_ID may be used to find the corresponding II_NSA in II_Source_Table 240 . Accordingly, DBT 200 may recover the consistent state using the SMAP_info from SMAP table 280 and starts the interpretation from the source instruction corresponding to II_NSA (recovery point instruction) to recover the exception.
  • a DBT such as DBT 200
  • DBT 200 may represent the values that are needed for precise exceptions as regular value is used by IR instructions.
  • this allows DBT 200 to treat values used by exception handling in a similar way that other program values are treated. In doing so, support for precise exceptions is enabled while providing reduced optimization constraints. Accordingly, DBT can use an exception recovery mechanism to decide whether an exception should be made visible to the application and the precise machine states the obligation should see at the exception point.
  • DBT 200 may allow optimizations of class boundaries of II instructions with the only explicit constraints are prevented in the movement of an EI instruction downward passing an II instruction. Accordingly, the DBT 200 as described herein may be utilized for binary translation with different hardware configurations, such as binary translation from a source machine with the big registered file to a native machine with a small register file.
  • the SMAP presentation allows DBT to treat value needed to reconstruct consistent states if they were used by regular instructions. Thus, DBT can naturally perform optimization on those values. The scope of the optimizations can naturally go beyond commit point instructions.
  • Elements of embodiments of the present invention may also be provided as a machine accessible storage medium for storing the machine-executable instructions.
  • the machine accessible storage medium may include, but is not limited to, flash memory, optical disks, compact disks-read only memory (CD-ROM), digital versatile/video disks (DVD) ROM, random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic or optical cards or other type of machine accessible storage media suitable for storing electronic instructions.

Abstract

A method and apparatus for dynamic binary translator to support precise exceptions with minimal optimization constraints. In one embodiment, the method includes the translation of a source binary application generated for a source instruction set architecture (ISA) into a sequential, intermediate representation (IR) of the source binary application. In one embodiment, the sequential IR is modified to incorporate exception recovery information for each of the exception instructions identified from the source binary application to enable a dynamic binary translator (DBT) to represent exception recovery values as regular values used by IR instructions. In one embodiment, the sequential IR may be optimized with a constraint on movement of an exception instruction downward past an irreversible instruction to form a non-sequential IR. In one embodiment, the non-sequential IR is optimized to form a translated binary application for a target ISA. Other embodiments are described and claimed.

Description

FIELD
One or more embodiments relate generally to the field of binary application translation. More particularly, one or more of the embodiments relate to a method and apparatus for dynamic binary translator to support precise exceptions with minimal optimization constraints.
BACKGROUND
Generally, computer programs are initially written in high level program statements. In order to be executed by a computer, the program statements are compiled into machine instructions that a microprocessor can recognize and execute. The machine instructions are selected from a set of machine instructions unique to a particular instruction set architecture (ISA).
Computer program statements that have been decoded into machine instructions for a source ISA such as Intel® X86, may undergo a binary translation in order to be executed at a target ISA, such as a reduced instruction set computer (RISC) architecture, or a very long instruction word (VLIW) architecture.
The translation may be performed by a dynamic translator, typically stored in memory. During translation, instructions are typically translated one basic block of instructions (BB) at a time and stored in memory. For example, each basic block of instructions may include a contiguous sequence of non-branch instructions (i.e., do not change order of executing instructions) which typically ends with a branch instruction.
Unfortunately, translated executable (binary) applications are generally not optimized in order to take advantage of the various optimization techniques provided by the target ISA. The performance of the target ISA is often a function of how well the processor manipulates and controls the flow of data within the system. As such, a target ISA can generally provide increased speed and throughput of instructions executed by the processor, as a result of several decades of engineering and research for optimizing instruction execution and data throughput as compared to a legacy (source) ISA. For example, the processors of the target ISAs achieve increased performance by executing instructions out of their original program order. By scheduling instructions according to availability of machine resources the processor is allowed to take advantage of parallelism inherent in the code.
Unfortunately, optimization of translated code is generally prohibited since the translation is generally limited to execution of translated instructions according to the program order provided in the source binary application. Otherwise, it may be difficult to determine a source ISA application state, according to a current target ISA application state. Furthermore, a single source or legacy instruction may be translated into several target ISA instructions. As a result, it is often difficult to determine correspondence between a target ISA application instruction and a source ISA application instruction.
Hence, the fact that instructions, such as load, store and floating point instructions may cause exceptions generally prohibits dynamic binary translation (DBT) optimizations. This challenge is posed due to the fact that native instructions in a translated region may generate exceptions.
Supporting such enabling exceptions is essential to provide full binary compatibility in a DBT system. On the other hand, straightforward recovery of such exceptions may severely constrain optimizations. For example, it may not be possible to move an update of a register past an exception instruction because doing so may change the machine state, as seen by, for example, an exception handler. As another example, reordering of loads that may cause segmentation errors is prohibited because reordering changes the order of exceptions raised by exception instructions.
BRIEF DESCRIPTION OF THE DRAWINGS
The various embodiments of the present invention are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
FIG. 1 is a block diagram illustrating a computer system including a dynamic binary translator to support precise exceptions with minimal optimization constraints, in accordance with one embodiment.
FIG. 2 is a block diagram further illustrating translation of a source program into an optimized translated code, in accordance with one embodiment.
FIG. 3 illustrates an intermediate representation (IR) of a source binary application modified to include identified exception instructions (EI), irreversible instructions (II) and inserted, pseudo II instructions, in accordance with one embodiment.
FIG. 4 illustrates an IR representation of a source binary application modified to represent a source mapping of registers and code motion, in accordance with one embodiment.
FIG. 5 is a flowchart illustrating an IR representation of a source binary application to illustrate binding of EI instructions and II instructions in addition to optimization and register allocation, in accordance with one embodiment.
FIG. 6 illustrates an optimized translated binary application from a source instruction set architecture (ISA) to a target ISA, in accordance with one embodiment.
FIG. 7 is a block diagram illustrating dynamic binary translation to support precise exceptions, in accordance with one embodiment.
FIG. 8 is a flowchart illustrating a method for dynamic binary translation to support precise exceptions with minimal optimization constraints, in accordance with one embodiment.
FIG. 9 is a flowchart illustrating a method for populating a data structure to track recovery point instructions corresponding to detected EI instructions, in accordance with one embodiment.
FIG. 10 is a flowchart for inserting pseudo recovery point instructions within a translated binary application, in accordance with one embodiment.
FIG. 11 is a flowchart illustrating a method for inserting pseudo recovery point instructions at control flow joints of a translated region, in accordance with one embodiment.
FIG. 12 is a flowchart illustrating a method for generating a state mapping table to enable recovery of a source ISA state at a predetermined recovery point instruction.
FIG. 13 is a flowchart illustrating a method for optimizing a sequential intermediate representation of a source binary application, in accordance with one embodiment.
FIG. 14 is a flowchart illustrating a method for binding EI instructions with identified reaching recovery point instructions, in accordance with one embodiment.
FIG. 15 is a flowchart illustrating a method for optimization of a non-sequential intermediate representation of a source binary application, in accordance with one embodiment.
FIG. 16 is a flowchart illustrating a method for generating runtime information to enable recovery of a source ISA state prior to issuance of an exception by an EI instruction, in accordance with one embodiment.
FIG. 17 is a flowchart illustrating a method for restoring a source ISA application state to enable exception recovery, in accordance with one embodiment.
FIG. 18 is a flowchart illustrating a method for restoring the source ISA application state to enable exception recovery of FIG. 17, in accordance with one embodiment.
FIG. 19 is a flowchart illustrating a method for performing execution recovery at an EI instruction, in accordance with one embodiment.
FIG. 20 is a flowchart illustrating a method for executing source ISA instructions subsequent to a recovery point instruction, in accordance with one embodiment.
DETAILED DESCRIPTION
A method and apparatus for dynamic binary translator to support precise exceptions with minimal optimization constraints are described. In one embodiment, the method includes the translation of a source binary application generated for a source instruction set architecture (ISA) into a sequential, intermediate representation (IR) of the source binary application. Once the sequential IR is generated, in one embodiment, the sequential IR is modified to incorporate exception recovery information for each exception instruction identified from the source ISA binary application. In one embodiment, incorporation of exception recovery information within the sequential IR enables a dynamic binary translator (DBT) to represent exception recovery values to support precise exceptions as regular values used by IR instructions. In one embodiment, the sequential IR may be optimized by, for example, copy propagation, code motion, dead code elimination with the constraint of prohibiting movement of an identified exception instruction (EI) downward in passing a predetermined II instruction. In one embodiment, the modified, non-sequential IR may be further optimized to form a translated binary application for a target ISA.
In the following description, numerous specific details such as logic implementations, sizes and names of signals and buses, types and interrelationships of system components, and logic partitioning/integration choices are set forth in order to provide a more thorough understanding. It will be appreciated, however, by one skilled in the art that the invention may be practiced without such specific details. In other instances, control structures and gate level circuits have not been shown in detail to avoid obscuring the invention. Those of ordinary skill in the art, with the included descriptions, will be able to implement appropriate logic circuits without undue experimentation.
In the following description, certain terminology is used to describe features of the invention. For example, the term “logic” is representative of hardware and/or software configured to perform one or more functions. For instance, examples of “hardware” include, but are not limited or restricted to, an integrated circuit, a finite state machine or even combinatorial logic. The integrated circuit may take the form of a processor such as a microprocessor, application specific integrated circuit, a digital signal processor, a micro-controller, or the like.
System
FIG. 1 is a block diagram illustrating a computer system 100 including a dynamic binary translator 200 to support precise exceptions with minimal optimization constrains, in accordance with one embodiment. Representatively, computer system 100 comprises a processor system bus (front side bus (FSB)) 104 for communicating information between processor (CPU) 102 and chipset 110. As described herein, the term “chipset” is used in a manner to collectively describe the various devices coupled to CPU 102 to perform desired system functionality. In one embodiment, CPU 102 may be a multicore chip multiprocessor (CMP).
Representatively, chipset 110 may include memory controller hub (MCH) 120 coupled to graphics (GFX) controller 130 via an interconnect 132. In an alternative embodiment, GFX controller 120 is integrated into MCH 120 such that, in one embodiment, MCH 120 operates as an integrated graphics MCH (GMCH). Representatively, MCH 120 is also coupled to main memory 146 via interconnect 142. In one embodiment, main memory 140 may include, but is not limited to, random access memory (RAM), dynamic RAM (DRAM), static RAM (SRAM), synchronous DRAM (SDRAM), double data rate (DDR) SDRAM (DDR-SDRAM), Rambus DRAM (RDRAM) or any device capable of supporting high-speed buffering of data.
As further illustrated, chipset may include an input/output (I/O) controller hub (ICH) 150. Representatively, ICH 150 may include a universal serial bus (USB) link or interconnect 102 to couple one or more I/O devices 160 to ICH 150. In an alternative embodiment, I/O devices 160 may be coupled to ICH 150 via a point-to-point link, including, but not limited to, peripheral component interconnect (PCI) Express (PCI-Express) or other like point-to-point interconnect. Likewise, a serial advance technology attachment (SATA) 172 may couple hard disk drive devices (HDD) 170 to ICH 150. In one embodiment, basic input/output system (BIOS) 106 initializes computer system 100.
Although chipset 110 is illustrated as including a separate MCH 120 and ICH 150, in one embodiment, MCH 120 may be integrated within CPU 102. In an alternative embodiment, the functionality of MCH 120 and ICH 150 are integrated within chipset 110. In one embodiment, dynamic binary translator 200 may be implemented within computer systems including an MCH integrated within a CPU, an MCH and ICH integrated within a chipset, as well as a system on-chip. Accordingly, those skilled in the art should recognize that FIG. 1 is provided to illustrate one embodiment and should not be construed in a limiting manner.
In one embodiment, dynamic binary translator (DBT) 200 incorporates information required for recovery from an exception into an intermediate representation (IR), for example, as illustrated in FIG. 2. In one embodiment, the incorporation of information required to recover from an exception, is referred to herein as “exception recovery information.” In one embodiment, incorporation of exception recovery information enables DBT 200 to provide additional optimizations of translated binary code to take advantage of the features of a target instruction set architecture (ISA), for example, as shown in FIG. 1.
FIG. 2 is a block diagram illustrating dynamic binary translation with support for precise exceptions with minimal optimization constraints, in accordance with one embodiment. Representatively, during dynamic binary translation, instructions are typically translated one block of instructions (BB) at a time and stored in memory in an area allocated for storing translating BBs. As such, the machine instructions of a source program 210 are typically translated and stored in memory in separate blocks of instructions. In one embodiment, each block of instructions consists of a contiguous sequence of non-branch machine instructions ending with a branch instruction.
Accordingly, a binary application, such as the source binary application 210 of FIG. 2, typically consists of multiple blocks of instructions stored in the physical static sequence (e.g., BB1, . . . , BB10). As illustrated in FIG. 2, source program 210 may refer to code of a binary application that is written for a native or source instruction set architecture (ISA). In one embodiment, DBT 200 translates source program 210, which is written for a source ISA into optimized translated code 300 for a target ISA. In one embodiment, computer system 100 may be referred to as a very long instruction word (VLIW) architecture and is also referred to herein as the “target ISA.” In contrast, as described herein, the term “source ISA” may refer to ISAs having instruction words that are smaller than the VLIW architecture capabilities of computer system 100.
In one embodiment, computer system 100 may refer to a computer architecture manufactured by the Intel Corporation of Santa Clara, Calif., to process, for example, 64-bit, 128-bit or larger instruction words. In contrast, source ISA may refer to computer architectures configured to handle 32-bit instruction words, such as, for example, the 32-bit Intel Architecture (IA-32) execution layer (IA32EL). Accordingly, in the embodiments described in further detail below, target ISAs, such as computer system 100, are required to provide compatibility with legacy or source ISAs by translating binary applications of the source ISAs according to a target ISA, of, for example, computer system 100. In one embodiment, the translation is performed using DBT 200.
Generally, DBTs, such as DBT 200, take advantage of information discovered at runtime to perform binary optimizations to improve performance using, for example, features that are available by a target ISA, but generally not supported by a source ISA. Unfortunately, the fact that instructions, such as, load, store and floating point instructions may cause exceptions, generally prohibits optimization binary of source binary applications. Supporting such exceptions is essential for providing full binary compatibility in DBT system.
Conversely, enabling recovery of exception handling may severely constrain optimization of a binary application that is translated for a target ISA. For example, optimization for the target ISA may not be able to move an update of a register past an EI instruction because doing so may change the machine state seen by an exception hander. As another example, reordering of load instructions that potentially cause segmentation errors is prohibited because such reordering of the exceptions raised by the two instructions may prevent precise exception handling.
In one embodiment, DBT 200 is designed to support precise exceptions with minimal optimization constraints. As described herein, to “support precise exceptions” may require the following: (1) the order of the exceptions that match that generated by the original source code; and (2) the exception handler should see the same processor state as if the original source raised the exception.
FIG. 2 is a block diagram illustrating translation and optimization of a source program where the optimized translated code 300 is modified to support precise exceptions with minimal optimization constraints, in accordance with one embodiment. In one embodiment, DBT 200 incorporates the information required to support precise exceptions into an intermediate representation 300, referred to herein as “exception recovery information.” In one embodiment, exception recovery information is represented as one or more regular values within IR 300. In one embodiment, this allows DBT 200 to treat values used by exception handling in a similar way that values of the source program code 210 are treated to enable a reduction of optimization constraints on an optimized, translated binary application.
Referring again to FIG. 2, source code of basic block 212 includes both exception instructions (EI) and irreversible instructions (II). As described herein, an “exception instruction,” or EI, may refer to an instruction, such as a load, store and division instruction, which may potentially generate a runtime exception. As described herein, an “irreversible instruction,” or II, may refer to an instruction that changes the application state in a way that prohibits DBT 200 from recovering a previous application state. In other words, the execution of an II may prevent DBT 200 from rolling back and re-executing the II. In one embodiment, store instructions and system call instructions may be identified as irreversible instructions, or IIs.
Referring again to FIG. 2, source instruction S2 222 refers to a store instruction and may be identified as both an exception or EI instruction, as well as an irreversible or II instruction. Source instruction S3 234 is a load instruction and is identified by DBT 200 as an EI instruction, whereas source instruction S5 228 is referred to as both an EI instruction and an II instruction. In one embodiment, II source table 240 provides a data structure that may be used to track II instructions. In one embodiment, for each II instruction, an identification value (II_ID) 242 is assigned to the II instruction to enable unique identification of the II instruction. In addition, an address of the source instruction immediately following the II instruction (II_NSA) 244 is also stored within source table 240.
Accordingly, in one embodiment, if an EI instruction issues an exception at runtime, DBT 200 restores a source machine state to the state immediately following the execution of the nearest preceding II instruction. Once restored, in one embodiment, DBT 200 begins interpreting instructions beginning with the next source instruction immediately following the nearest, preceding II instruction, referred to herein as “a recovery point instruction.” As described herein, a “recovery point instruction” may refer to an instruction in the source code, to restart execution for exception recovery.
Accordingly an II instruction may be conceptually referred to as defining a value of a consistent state and an EI instruction that uses a value of a consistent state defined by an II instruction may be referred to herein as an II instruction that reaches the EI instruction (“reaching II instruction”). As described herein, the “consistent state” defined by a reaching II instruction may refer to the source register values if the source code is sequentially executed up to the recovery point instruction corresponding to the reaching II. In one embodiment, each EI instruction is required to have a reaching II instruction. In some embodiments, an EI instruction might not have a reaching II instruction. Accordingly, in one embodiment, DBT 200 may insert pseudo II instructions into IR 300, such that each EI instruction includes a reaching II instruction
In one embodiment, DBT 200 includes EI SMAP table 250. In one embodiment, table 280 represents an EI instruction identification (EI_ID) 282, a source register value needed to recover the consistent state defined by a corresponding reaching II instruction, and represents a virtual register mapping (SMAP) 284 for needed source registers of a source ISA. In one embodiment, DBT 200 may insert IR instructions within IR 300 to store source register values, which are required to enable reproduction of a consistent state at the corresponding reaching II instruction.
Referring again to FIG. 2, EI reach table 260 may store a unique identification value assigned to an EI instruction (EI_ID) 262 and for that EI instruction, table 260 stores a unique identification value assigned to the reaching II instruction (II_ID) 264 to enable the reaching II instruction to define a consistent state and a recovery point instruction. Accordingly, in one embodiment, the recovery point instruction indicated by a reaching II instruction refers to an instruction of the source code to restart exception for execution recovery. Furthermore, the mapping information from SMAP table 280 identifies the source register values that would be generated if the source code is sequentially executed up to the recovery point instruction to provide the consistent state at the reaching II instruction for exception recovery.
Accordingly, source table 240, EI reach table 260 and SMAP 280 illustrate the values stored to enable the definition of a consistent state at various reaching II instructions of corresponding EI instructions to support precise exceptions. In one embodiment, following such translations and optimization of source program 210 by DBT 200, optimized translated code 400 is provided, which may include, for example, code motion, dead code elimination, as well as additional optimizations following the binding of EI instructions and their corresponding reaching II instructions. Accordingly, in one embodiment, optimizations may be performed by DBT 200 for source binary code 210. In one embodiment, the explicit constraint on such optimizations required to support precise exceptions is the prevention of the movement of an EI instruction downward past an II instruction.
FIGS. 3-7 illustrate the process of dynamic binary translation and optimization, as performed by DBT 200 for source code block 220 of source program code 210, as shown in FIG. 2. Representatively, FIGS. 3-7 illustrate the generation of the IR representation of BB1 350, BB10 390 of IR 300 and the representation of BB1 402 and BB10 430 of optimized translated code 400, as shown in FIG. 2. In the IR representation of the translation regions 302-359, as shown in FIGS. 3-6 and translation regions 360-392 as shown in FIG. 7, tj is an integer) is used to represent a static, single assignment (SSA) temporary variable, sj to represent an IR variable corresponding to source register sj and nj to represent an IR variable from which native register nj is preassigned before register allocation.
As known to those skilled in the art, static single assignment format or SSA form, is an intermediate representation that effectively separates the values operated in a program from the locations they are stored in to enable more effective versions of several optimizations. Generally a procedure is in SSA form if every variable is assigned a value in the procedure occurs as the target of only one assignment.
FIG. 3 illustrates translation regions 302 and 320 to depict the identification of EI instructions and II instructions, as well as the insertion of instructions to load values to enable definition of a consistent state at corresponding II instructions (N1-N1) or inserted pseudo II instructions, according to one embodiment. Representatively, as shown in FIG. 3, each source instruction (SI) is translated into a sequence of IR instructions (N1-N14). As indicated by IR translation region 302, source instructions S2 224, S3 226 and S5 228 of source program block 220, shown in FIG. 2, are identified as EI instructions 304, 306 and 308.
However, EI instructions 304 and 308 are also load instructions, which may be identified as both II instructions and EI instructions (“II/IE”). Accordingly, as shown in translation region 302, EI instruction 306 is identified by “ldind_EI,” while EI/ II instructions 304 and 308, are identified by “stind_II_EI.” As shown in II source table 240, an identification value (II_ID) 242 and a next source address (II_NSA) 246 of II/ IE instructions 304 and 308 are stored in table 240.
As further shown by translation region 320, a pseudo II instruction 322 is inserted into the regionEntry( ) and an identification value (N15) and a source address pair (s1) 322 (N15, S1) are added to II source table 240. As shown, a “ldvar” instruction (310-316) are inserted within translation regions 302 and 320 to load the values for the consistent state corresponding to the II instructions. A pseudo II instruction 322 is inserted at the entry of the translated region 320. As further illustrated in FIG. 4, an SMAP representation (340, 342) is added to the two stind_II_EI instructions 304 and 308.
FIG. 4 illustrates translation regions 330 and 340, in accordance with one embodiment. Representatively, instructions 332-336 to load values for enabling the definition of a consistent state at corresponding II instructions and pseudo II instructions are added to translation region 330. In addition, an SMAP representation 340 and 342 are added to EI/ II instructions 304 and 308 to represent a register mapping for the consistent state defined by the two instructions. Furthermore, SMAP representation 338 is added to Pseudo II instruction 322.
In one embodiment, following identification of all the II instructions and generating the needed pseudo II instructions, as shown in FIG. 4, IR instructions 332-336 are generated to represent the source register values needed to recover the consistent state as pseudo uses and represent the virtual register mapping for the needed source registers. This IR representation is generated for each II instruction in process block 530.
For example, assume SMAP_SRegs(II) is the set of source registers whose values are needed to recover the consistent state defined by an II instruction. For each source register si (l=1. . . m) in SMAP_SRegs(II), an IR instruction is generated to load the source register value and store the value to a symbolic register ti, such that ti=si.
SMAP(s 1 →t 1 , s 2 →t 2 , . . . s m →t m)   (1)
is associated with the II instruction to represent that after the execution of the instruction, the value of source register si is stored in virtual register ti.
For one embodiment, the actual set of SMAP_SRegs for each II is a subset of all the source registers and can be determined by performing data flow analysis on the code region that includes the II instruction and all the EI instructions it reaches. As known to those skilled in the art, the purpose of dataflow analysis is to provide global information about how a procedure (or a larger segment of a program) manipulates its data. Accordingly, in one embodiment, dataflow analysis may be used to determine such global information about the source register values required to achieve a consistent state at one or more II instructions.
As further illustrated by translation region 350, IR optimization is performed from translation region 330. Representatively, copy propagation, dead code elimination and code motion are performed. As a result of the IR optimizations, EI instruction 306 is moved ahead of EI/II instruction 304. In addition, the one too many correspondence between the original source instructions 220 and the IR instructions is removed to prohibit obscuring the details of the invention. Translation region 350 is also shown in FIG. 2 within IR 300.
FIG. 5 illustrates translation regions 352 and 354, in accordance with one embodiment. As illustrated by translation region 352, in one embodiment, pseudo II instruction 338 is identified as the reaching II instruction to define the consistent state for recovering the exception generated by EI instruction 306. Representatively, a copy of the SMAP information 338 associated with pseudo II instruction 322 is copied to EI instruction 304. In addition, an EI_ID and a reaching II_ID (N8, N14) of EI instruction 306 are added to EI reach table 260.
Conversely, the reaching II instructions for EI/ II instructions 304 and 308 are selected as the respective EI/II instructions. Accordingly, in one embodiment, no changes are made to the existing SMAP information associated with these two instructions. As shown by EI reach table 260, the following pairs (N7, N7) and (N13, N13) are recorded within EI reach table 260. Referring again to FIG. 5, translation region 354 illustrates modification of translation region 352 after register allocation. Representatively, variables s1 and temporary variables t1, t2, etc. are placed with native registers r1 356, r3 357 and r6 358.
FIG. 6 illustrates translation region 402 of optimized translated code 400, according to one embodiment. Representatively, the SMAP table 280 is modified to add mapping information. In each row, the table has two entries: EI instruction represented as the IR instruction ID 282 and the SMAP information 284 for the consistent state. In one embodiment, table 280 along with source table 240 and reach table 260, provide all the needed information to enable exception recovery to support precise exceptions.
For example, if the native instruction corresponding to the EI instruction (N8) 306 generates an exception at runtime, we use the native register r1 to recover the value of the source register EAX and then start the interpretation from source instruction s1 to recover the exception. If the native instruction corresponding to EI instruction 304 raises an exception at runtime, we use native register r3 to recover the value for the source register S1 (EAX) and deliver the exception to the user exception handler. Translation region 402 of optimized translated code 400 is also shown in FIG. 2.
The process of dynamic binary translation and optimization, as shown in FIG. 7, is illustrated while omitting IR instructions required to load source register values. Procedural methods for implementing the described embodiments for DBT translation, as well as the process described in FIG. 7, are now provided.
Operation
Turning now to FIG. 8, the particular methods associated with various embodiments are described in terms of computer software and hardware with reference to a flowchart. The methods to be performed by a computing device (e.g., an endpoint/link controller) may constitute state machines or computer programs made up of computer-executable instructions. The computer-executable instructions may be written in a computer program and programming language or embodied in firmware logic. If written in a programming language conforming to a recognized standard, such instructions can be executed in a variety of hardware platforms and for interface to a variety of operating systems.
In addition, embodiments of the invention are not described with reference to any particular programming language. It will be appreciated that a variety of programming languages may be used to implement embodiments of the invention as described herein. Furthermore, it is common in the art to speak of software, in one form or another (e.g., program, procedure, process, application, etc.), as taking an action or causing a result. Such expressions are merely a shorthand way of saying that execution of the software by a computing device causes the device to perform an action or produce a result.
FIG. 8 is a flowchart illustrating a method 500 for a dynamic binary translator to support precise exception with minimal optimization constraints, in accordance with one embodiment. In the embodiments described, examples of the described embodiments are made with reference to FIGS. 1-7. However, the described embodiments should not be limited to the examples provided to limit the scope provided by the appended claims. Furthermore, the dynamic binary translation method 500, as shown in FIG. 8, is described with reference to the flowcharts of FIGS. 9-16. For the purposes of the following description, process block 502 is further described with reference to FIG. 9.
FIG. 9 is a flowchart illustrating a method 504 for identification of EI and II instructions, in accordance with one embodiment. Referring again to FIG. 8, at process block 502, EI instructions and II instructions are first identified. As shown in FIG. 3, II instruction 362 and EI instruction 364 are identified within translation region 360. In one embodiment, identification of EI and II instructions is performed during the translation of source binary instruction to IR and before an optimization. For example, the source load and division instructions are identified as EI instructions and the store instructions are identified as both EI instructions and II instructions (EI/II) instructions. In one embodiment, analysis may be performed to avoid marking the instructions that will not cause exception as EI instruction.
As shown in FIG. 9, EI instructions and II instructions are identified at process blocks 506 and 508. At process block 510, a runtime table is generated. In one embodiment, the runtime table is illustrated as II_Source Table 240, as shown in FIG. 7. At process blocks 512 and 514, for each II instruction, a pair of values (II_ID, II_NextSourceAddress) is recorded in, for example, II source table 240. In one embodiment, II_ID is a unique ID to identify the II instruction in IR 300 and II_NextSourceAddress is the address of a source instruction right after the II instruction (II_NSA) that is selected as a recovery point instruction as shown in FIG. 7.
Referring again to FIG. 8, at process block 520, pseudo II instructions are inserted at certain program points. In one embodiment, the insertion of pseudo II instructions performed at process block 520 ensures that for each EI instruction, there is one II instruction that reaches the EI instruction. This makes it possible to statically determine a recovery point instruction for each EI instruction. As shown in FIG. 7, pseudo II instruction 372 is inserted at the entry of the translated region 370, to ensure that the first EI instruction in region 364 has a reaching II instruction. In one embodiment, if the region being translated has control-flow joints, there may be more than one II instruction reaching an EI instruction.
Referring again to FIG. 8, similar to process block 502, at process block 520 for each pseudo II instruction, a pair of (II_ID, II_NSA) is also added to II_Source_Table 240 (see FIG. 7). As shown in FIG. 7, the II_NSA for pseudo II instruction 372 at the entry of the translated region 370 is the address of the first source instruction in region 370.
In one embodiment, representing the interpretation for recovering an exception raised by an EI instruction (362/364) will start from the first source instruction (N22) in region 370. The II_NSA for the pseudo II instruction at a control-flow joint point is the address of the first source instruction for the corresponding joint basic block. This means if multiple II instructions reach an EI instruction, the interpretation for recovering the exception raised by the EI instruction will start from the first source instruction in basic block where the paths from the multiple II instructions and the EI instruction first join.
In one embodiment, pseudo II instructions are inserted at control-flow joint points to ensure that only one consistent state reaches each EI instruction. In one embodiment, following identification of all the II instructions and generating the needed pseudo II instructions, as shown in FIG. 7, IR instructions 332-336 are generated to represent the source register values needed to recover the consistent state as pseudo uses and represent the virtual register mapping for the needed source registers. This IR representation is generated for each II instruction at process block 540 of FIG. 8.
FIG. 10 is a flow chart illustrating a method 522 for inserting pseudo II instructions that control flow joints of a translation region in accordance with one embodiment. At process block 524, a pseudo II instruction is inserted as an entry of each translated region within an IR such as IR 300 as shown in FIG. 7. At process 526, a pseudo II instruction is inserted at each control flow joint for each translated region having a control flow joint. Further details regarding the insertion of pseudo II instructions or control flow joints are described in FIG. 11.
FIG. 11 is a flow chart illustrating a method 530 for inserting pseudo II instructions of control flow joints of process block 526 as shown in FIG. 10 in accordance with one embodiment. At process block 532, each block within a sequential II representation is identified that includes an EI instruction. Once identified at process block 534, it is determined whether the basic block is in an iterative dominance (DF+). Accordingly, assuming A represents all basic blocks with II instructions, in one embodiment, for each basic block within A in the iterative dominance frontier DF+(A), we insert as pseudo II instruction at the beginning of the basic block.
FIG. 12 is a flow chart illustrating a method 542 for generating the IR to represent the SMAP for each II by process 540 in accordance with one embodiment. At process block 544, it is determined whether a source register value is required to recover a consistent state at an II instruction. When such is the case, at process block 546, at least one instruction is generated within the IR representation to store the source register value. At process block 548, a state register mapping data structure is generated to provide a target ISA to source ISA register mapping according to the generated IR instruction, for example, as shown by translation region 330 as shown in FIG. 4. Representatively, as shown in FIG. 4, IR instructions 332, 334 and 336 are generated within translation region 330 for the source register S1.
Referring again to FIG. 8 at process block 550, IR optimizations are performed with certain constraints on code motions as shown by translation region 380 of FIG. 7. In particular, the movement of an instruction downward passing an II instruction is prevented. Assuming an EI instruction EI1, which is right before an II instruction II1 is moved down to right after II1. When EI1 generates an exception, II1 has already been executed. This prevents the recovery of the consistent state for EI1, which is the state prior to execution. Therefore, the movement of EI instruction down a passing II instruction is prevented.
FIG. 13 is a flow chart illustrating a method for performing optimizations of process block 550 as shown in FIG. 8 in accordance with one embodiment. At process block 554, code motion is performed to optimize a sequential IR representation of the source binder application to form a non-sequential IR. In one embodiment, copy propagation and debt code elimination may also be performed as part of process block 554. At process block 556, the code motion performed in process block 554 is monitored to prohibit the movement of an identified EI instruction beyond one of any identified II instructions and any inserted pseudo II instructions. An optimized intermediate representation as shown in FIGS. 2 and 7 as optimized translated region 390. Representatively, EI instruction 364 is reordered and moved before EI/II instruction 362.
In one embodiment, after binding all the II instructions to their reaching II instructions, the SMAP information associated with the II instructions is removed. In one embodiment, binding an EI instruction as shown in translation region 390 of FIG. 7, SMAP information 382 is more to reaching EI instruction 364 to an II instruction means that when the EI instruction generates an exception, DBT 200 (FIG. 2) restores the application state to the consistent state defined by the II instruction and starts interpretation from the source instruction right after the irreversible to recover the exception.
Referring again to FIG. 8, at process block 560, the reaching II instruction for each EI instruction is identified, according to one embodiment. The algorithm to discover the reaching II instruction for each EI instruction is similar to the SSA renaming algorithm to find out the correct version of an SSA variable that reaches a use of the variable. Then for each II instruction, the instruction is bound to its reaching II instruction by copying the SMAP information from the II instruction to the EI instruction. We also create a runtime table, EI_Reach_Table, to record pair (EI_ID, Reaching II_ID), where EI_ID is the unique ID to identify the EI instruction in the IR and Reaching II_ID is the unique ID to identify the II instruction that reaches the EI instruction.
FIG. 14 is a flow chart illustrating a method 562 for binding IE instructions with reaching II instructions of process block 560, as shown in FIG. 8, in accordance with one embodiment. At process block 564, a reaching II instruction is identified for each EI instruction of the source binding application. At process block 566, each identified EI exception is bound to a corresponding identified reaching II instruction. For example, as shown in FIG. 7, in translation region 392, EI instruction 364 is bound to pseudo II instruction 372. At process block 568, a data structure is generated to enable the identification of a reaching II for each identified EI instruction within the source binary application. For example, as shown in FIG. 7, EI reaching table 260 is populated to show that EI instruction 364 (and 324) is bound to pseudo II instruction 372 (and 326).
The above description assumes that an II instruction is not also an EI instruction, referred to herein as an EI/II instruction. For example, assume A an EI/II instruction. (See EI/II instruction 364 of FIG. 7). The SMAP information generated for A at process block 530 (FIG. 8) may be referred to as SMAP_II(A). SMAP_II(A) may represent the consistent state to recover the exceptions raised by the II instruction that A reaches. On the other hand, the SMAP information generated for A at process block 530 is referred to as SMAP_EI(A). SMAP_EI(A) may represent the consistent state to recover the exceptions raised by A.
There are various potential approaches to recover an exception caused by A. In one embodiment, the exception raised by A is directly reported without going through the interpretation process. In this embodiment, A is the reaching II instruction of itself or an EI/II instruction and uses SMAP_II(A) generated at process block 530 as SMAP_EI(A). Because (1) SMAP_II(A) represents the consistent state after a normal (no exception) execution of instruction A, and (2) when an exception happens at A, the processor restores the machine state to the state prior to the beginning of the execution of A, this embodiment relies on the assumption that the native machine has the same register states before executing A and after a normal execution of A.
In one embodiment, an interpretation process is performed to recover the exception. In this embodiment, A is treated the same as other EI instructions in computing the reaching II instruction. This makes the reaching II instruction of A different from A itself. This embodiment may not be as efficient as a previous embodiment, but it doesn't rely on the assumption of the previous embodiment. FIG. 7 illustrates the previous embodiment as EI/II instruction 362 is selected as its own reaching II instruction.
Referring again to FIG. 8, following process block 560, further optimizations and register allocation are performed at process block 570, in accordance with one embodiment. At process block 570, the reordering of EI instructions and II instructions is prohibited because dong so can invalidate the SMAP information and maintaining the information for such reordering optimization is difficult. FIG. 15 illustrates a flow chart for performing a further optimization at process block 570 of FIG. 8 in accordance with one embodiment. Representatively, at process block 574, additional optimizations and register allocation are performed for modified non-sequential II 300 as shown in FIG. 7. At process block 576, reordering of identified EI instructions and II instructions is prohibited during the performance of the additional optimizations at process block 574.
In one embodiment, other optimizations, such as instruction combination and redundant load removal can create a dangling SMAP, which are eventually removed from IR 300 (FIG. 8.) Such optimizations are enhanced by removing dangling SMAP representation from IR 300 (FIG. 8.) Otherwise, optimizations should not affect SMAP representation. In one embodiment, the values used by SMAP 280 are kept for the purpose of exception handling. In one embodiment, the register allocation algorithm is extended to include the heuristics, such that the live values used by SMAP table 280 have lower spill cost to memory as compared with live values used by other instructions, assuming exceptions happen infrequently.
At process block 580, the SMAP information is extracted out from IR to construct a runtime table, referred to as EI_SMAP_Table 280 (FIG. 7), to describe the consistent state register map for each instruction. In the table, for each EI instruction, we have information (EI_ID, SMAP), where EI_ID is the unique ID to identify the EI instruction in the IR, SMAP specifies the register mapping for the consistent state.
FIG. 16 is a flow chart illustrating a method 582 for performing the SMAP information extraction of process block 580 of FIG. 8, in accordance with one embodiment. At process block 584, register mapping information is extracted from the internal representation. At process block 586, a runtime table is interrupted to provide a consistent state register map for each identified EI instruction. This table is shown as EI SMAP table 280 in FIG. 7 to illustrate EI instruction 364 of translated region 480. Information within register R1 is mapped to register EAX to provide the source register to define the consistent state and corresponding source register values indicated by EI SMAP table 280. Otherwise, it would be contained within the source registers of a source binding application 210 with sequentially executed up until the recovery point instruction 364.
Referring again to FIG. 8, at process block 590, native code is emitted, in accordance with one embodiment. The instruction ID, EI_ID is also replaced in the above runtime tables with the native instruction address for the corresponding EI instruction. As shown in FIGS. 7-16, process blocks 520, 540, 560 and 580 construct three tables, II_Source_Table 240, EI_Reach_II_Table 260 and EI_SMAP_Table 280, which provide all the needed information to support precise exceptions. An implementation may combine these tables for efficiency.
FIG. 17 is a flowchart illustrating a method 600 for performing exception recovery according to a precise exception, in accordance with one embodiment. At process block 602, an optimized, translated binary application from a binary application written for a source ISA and translated to a target ISA is executed. Once executed, at process block 610, it is determined whether an EI instruction invokes a runtime exception. When such is detected, at process block 612, a predetermined instruction corresponding to the EI instruction is identified. In one embodiment, such predetermined instruction may be referred to as a “reaching II instruction” of the exception, or EI, instruction. Accordingly, at process block 620, a source ISA application state may be restored according to the identified instruction to enable exception recovery, for example, as described with reference to FIG. 18.
FIG. 18 is a flowchart illustrating a method 630 for recovering a source ISA application state, in accordance with one embodiment. At process block 630, a runtime exception invoked by the EI instruction is received in addition with a native exception state. Once received, at process block 634, a source ISA application state is restored according to the reaching II instruction corresponding to the EI instruction. Once such state is restored, at process block 636, one or more instructions subsequent to the reaching II instruction are executed to recover the exception.
FIG. 19 is a flowchart illustrating a method 640 for restoring the ISA application state at process block 620 of FIG. 17, in accordance with one embodiment. At process block 642, source register mapping information is identified according to an identification value assigned to the EI instruction. In one embodiment, such register mapping information may be contained within, for example, EI SMAP table 250, as shown in FIG. 2. At process block 644, a source ISA application state is recovered according to register mapping contained within the identified register map data structure. Once recovered, at process block 646, the exception may be delivered to an exception handler. In one embodiment, the exception recovery described with reference to FIG. 15 is based on an exception issued by an EI instruction, which is both an EI instruction and an II instruction.
Conversely, FIG. 20 illustrates a method 650 for exception recovery for an exception caused by EI instruction having a reaching II instruction, in accordance with one embodiment. At process block 652, a predetermined reaching instruction of the EI instruction is identified. Once identified, a source instruction is determined from the reaching instruction of the EI instruction. In one embodiment, such source instruction is the source instruction immediately following the corresponding reaching II instruction of the EI instruction. Once determined, at process block 656, source instructions are executed beginning with the identified instruction. As such source instructions are executed, at process block 658, a source ISA application state is updated. As such updating continues, at process block 660, it is determined whether the EI instruction issues an exception during the execution of the source instruction. When such exception is issued, at process block 662, an updated source ISA application state at the EI instruction is provided to a user exception handler. Otherwise, execution continues until the end of the translated block.
Accordingly, if an exception happens at runtime, the OS delivers the exception and the native exception state to the DBT exception handler. As shown by FIGS. 18-20, DBT handles the exception as follows: (1) use the EI_ID to find the corresponding SMAP in EI_SMAP_Table; (2) Use the EI_ID to find the corresponding II_ID.
In one embodiment, if EI_ID and II_ID are the same, the EI instruction is also an II instruction, referred to herein as an EI/II instruction. Accordingly, DBT 200 may recover the consistent state using the SMAP table 280 and delivers the exception to the user exception handler as shown in FIGS. 2 and 19. instruction. In one embodiment the II_ID may be used to find the corresponding II_NSA in II_Source_Table 240. Accordingly, DBT 200 may recover the consistent state using the SMAP_info from SMAP table 280 and starts the interpretation from the source instruction corresponding to II_NSA (recovery point instruction) to recover the exception.
Accordingly, by incorporating exception recovery information into an intermediate representation, a DBT, such as DBT 200, is shown in FIGS. 1 and 2, may represent the values that are needed for precise exceptions as regular value is used by IR instructions. In one embodiment, this allows DBT 200 to treat values used by exception handling in a similar way that other program values are treated. In doing so, support for precise exceptions is enabled while providing reduced optimization constraints. Accordingly, DBT can use an exception recovery mechanism to decide whether an exception should be made visible to the application and the precise machine states the obligation should see at the exception point.
Accordingly, DBT 200 may allow optimizations of class boundaries of II instructions with the only explicit constraints are prevented in the movement of an EI instruction downward passing an II instruction. Accordingly, the DBT 200 as described herein may be utilized for binary translation with different hardware configurations, such as binary translation from a source machine with the big registered file to a native machine with a small register file. In a further embodiment, the SMAP presentation allows DBT to treat value needed to reconstruct consistent states if they were used by regular instructions. Thus, DBT can naturally perform optimization on those values. The scope of the optimizations can naturally go beyond commit point instructions.
Elements of embodiments of the present invention may also be provided as a machine accessible storage medium for storing the machine-executable instructions. The machine accessible storage medium may include, but is not limited to, flash memory, optical disks, compact disks-read only memory (CD-ROM), digital versatile/video disks (DVD) ROM, random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic or optical cards or other type of machine accessible storage media suitable for storing electronic instructions.
It should be appreciated that reference throughout this specification to “one embodiment” or “an embodiment” means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment. Therefore, it is emphasized and should be appreciated that two or more references to “an embodiment” or “one embodiment” or “an alternative embodiment” in various portions of this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures or characteristics may be combined as suitable in one or more embodiments.
In the above detailed description of the various embodiments, reference is made to the accompanying drawings, which show by way of illustration, and not of limitation, specific embodiments in which the teachings disclosed herein may be practiced. In the drawings, like numerals describe substantially similar components throughout the several views. The embodiments illustrated are described in sufficient detail to enable those skilled in to the art to practice the teachings disclosed herein. Other embodiments may be utilized and derived therefrom, such that structural and logical substitutions and changes may be made without departing from the scope of this disclosure. The above detailed description, therefore, is not to be taken in a limiting sense, and the scope of various embodiments is defined only by the appended claims, along with the full range of equivalents to which such claims are entitled.
Having disclosed embodiments and the best mode, modifications and variations may be made to the disclosed embodiments while remaining within the scope of the embodiments as defined by the following claims.

Claims (17)

1. A computer implemented method comprising:
translating a source binary application, generated for a source instruction set architecture (ISA), into a sequential intermediate representation (IR) of the source binary application;
identifying each exception instruction within the source ISA binary application;
identifying a predetermined reaching instruction within the sequential IR of the source ISA binary application for each of the identified exception instructions;
identifying one or more irreversible instructions within the source ISA binary application;
generating an irreversible instruction (II) data structure;
storing an identification assigned to each of the one or more irreversible instructions identified from the source binary application within the II data structure;
selecting a recovery point instruction as a source instruction immediately following the identified irreversible instruction;
storing an address of the source instruction immediately following the identified irreversible instruction within the II data structure to form exception recovery information for the identified exception instructions;
modifying the sequential IR to incorporate the exception recovery information for the identified exception instructions, identified from the source ISA binary application, to form a modified, non-sequential IR; and
optimizing the modified, non-sequential IR to form an optimized, translated binary application for a target ISA that incorporates the exception recovery information to enable exception recovery.
2. The method of claim 1, further comprising:
generating at least one instruction within the sequential IR to store at least one source register value required to recover a consistent state at a predetermined instruction of the sequential IR; and
generating a state register mapping data structure to provide a target ISA to source ISA register mapping according to the generated, IR instruction.
3. The method of claim 1, wherein modifying the sequential IR information further comprises:
inserting a pseudo irreversible instruction (II) at an entry of each translated region within the sequential IR;
inserting a pseudo II at each control flow joint for each translated region having a control-flow joint; and
storing information regarding each inserted pseudo II within an II data structure.
4. The method of claim 3, wherein inserting pseudo II at each control flow joint further comprises:
identifying each basic block within the sequential IR that includes an identified exception instruction; and
inserting a pseudo II at a beginning of each basic block in an iterative dominance frontier:
DF+(S),
where S represents each basic block of the sequential IR with an identified exception instruction.
5. The method of claim 1, wherein modifying the sequential IR comprises:
performing code motion to optimize the sequential IR of the source binary application to form a non-sequential IR; and
prohibiting, during the performing of code motion, movement of an identified exception instruction beyond one of an identified irreversible instruction (II) and an inserted, pseudo II.
6. The method of claim 1, wherein incorporating exception recovery information further comprises:
identifying a reaching irreversible instruction (II) for each identified exception instruction of the source binary application, wherein the reaching II is one of an identified II of the source binary application and an inserted, pseudo II;
binding each identified exception instruction to a corresponding, identified reaching II instruction; and
generating a data structure to enable identification of a reaching II for each identified exception instruction within the source binary application.
7. The method of claim 5, optimizing the modified IR comprising:
performing additional optimization and register allocation of the modified, non-sequential IR; and
prohibiting, during the performing additional optimization, reordering of identified exception instructions and identified irreversible instructions (II).
8. The method of claim 1, further comprising:
extracting register mapping information to construct a runtime table to provide a consistent state register map for each identified exception instruction;
emitting target code; and
replacing identification values within one or more runtime tables with source instruction addresses for each corresponding identified exception instruction.
9. An article of manufacture having a machine accessible storage medium including associated instructions, wherein the instructions, when executed, result in the machine comprising at least one component performing:
identifying, during translation of a binary application from a source instruction set architecture (ISA) to a target ISA, each exception instruction within the source ISA binary application;
identifying a predetermined reaching instruction within a sequential intermediate representation (IR) of the source ISA binary application for each of the identified exception instructions;
identifying one or more irreversible instructions within the source ISA binary application;
generating an irreversible instruction (II) data structure;
storing an identification assigned to each of the one or more irreversible instructions identified from the source binary application within the II data structure;
selecting a recovery point instruction as a source instruction immediately following the identified irreversible instruction;
storing an address of the source instruction immediately following the identified irreversible instruction within the II data structure to form exception recovery information for the identified exception instructions;
executing an optimized, translated binary application, the translated binary application formed from the sequential IR of the binary application that is further optimized for a target ISA to form the optimized, translated binary application that incorporates the exception recovery information for the identified exception instructions to enable exception recovery;
identifying, following invocation of a runtime exception by an exception instruction, a predetermined instruction corresponding to the exception instruction; and
restoring a source ISA application state according to the identified instruction to enable exception recovery using the exception recovery information.
10. The article of manufacture of claim 9, wherein identifying the predetermined instruction further results in the machine performing:
receiving a runtime exception invoked by the exception instruction and a native exception state;
restoring a source ISA application state according to the instruction corresponding to the exception instruction; and
executing one or more instructions subsequent to the corresponding instruction to recover the exception.
11. The article of manufacture of claim 9, wherein restoring the source ISA application state further comprises:
identifying source register mapping information according to an identification value assigned to the exception instruction;
recovering a source ISA application state according to register mapping information contained within the identified register map data structure; and
delivering the exception to a user exception handler.
12. The article of manufacture of claim 10, wherein executing the one or more instructions further comprises:
identifying a predetermined reaching instruction of the exception instruction;
determining, from the reaching instruction of the exception instruction, a source instruction identified by the predetermined reaching instruction;
executing source instructions beginning with the identified source instruction;
updating the source ISA state according to the execution instructions; and
providing an updated source ISA application state at the exception instruction to a user exception handler if the exception instruction issues an exception during the executing of the source instructions.
13. A system comprising:
a processor;
a memory controller coupled to the processor; and
a memory coupled to the memory controller, the memory controller including a binary translator to identify, during translation of a binary application from a source instruction set architecture (ISA) to a target ISA, each exception instruction within the source ISA binary application, to identify a predetermined reaching instruction within a sequential intermediate representation (IR) of the source ISA binary application for each of the identified exception instructions, to identify one or more irreversible instructions within the source ISA binary application, to generate an irreversible instruction (II) data structure, to store an identification assigned to each of the one or more irreversible instructions identified from the source binary application within the II data structure, to select a recovery point instruction as a source instruction immediately following the identified irreversible instruction, to store an address of the source instruction immediately following the identified irreversible instruction within the II data structure to form exception recovery information for the identified exception instructions,
wherein the binary translator to incorporate the exception recovery information for the identified exception instructions into the sequential IR of the source binary application, to form a modified, non-sequential IR and to optimize the modified, non-sequential IR to form an optimized, translated binary application for a target ISA that incorporates the exception recovery information for the identified exception instructions to enable exception recovery.
14. The system of claim 13, wherein the translator is further to generate at least one instruction within the sequential IR to store at least one source register value required to recover a consistent state at a predetermined instruction of the sequential IR and to generate a state register map data structure to provide a target ISA to source ISA register mapping according to the generated IR instruction.
15. The system of claim 13, wherein the translator is further to insert a pseudo reaching instruction at the entry of each translated region within the IR, to insert a pseudo reaching instruction at each control flow joint for each translated region having a control flow joint and to store information regarding each inserted reaching instruction within a data structure.
16. The system of claim 13, wherein the translator is further to perform code motion to optimize the sequential IR of the source binary application to form a non-sequential IR and to prohibit movement of an identified exception instruction beyond one of an identified irreversible instruction and an inserted pseudo irreversible instruction.
17. The system of claim 13, wherein the translator is further to identify a reaching irreversible instruction (II) for each identified exception instruction of the source binary application, wherein the reaching II is one of an identified II of the source binary application and an inserted pseudo II, to bind each identified exception instruction to a corresponding, identified reaching II and to generate a data structure to enable the identification of a reaching II for each identified exception instruction within the source binary application.
US11/241,610 2005-09-30 2005-09-30 Apparatus and method for dynamic binary translator to support precise exceptions with minimal optimization constraints Active 2029-05-13 US7757221B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US11/241,610 US7757221B2 (en) 2005-09-30 2005-09-30 Apparatus and method for dynamic binary translator to support precise exceptions with minimal optimization constraints

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
US11/241,610 US7757221B2 (en) 2005-09-30 2005-09-30 Apparatus and method for dynamic binary translator to support precise exceptions with minimal optimization constraints

Publications (2)

Publication Number Publication Date
US20070079304A1 US20070079304A1 (en) 2007-04-05
US7757221B2 true US7757221B2 (en) 2010-07-13

Family

ID=37903365

Family Applications (1)

Application Number Title Priority Date Filing Date
US11/241,610 Active 2029-05-13 US7757221B2 (en) 2005-09-30 2005-09-30 Apparatus and method for dynamic binary translator to support precise exceptions with minimal optimization constraints

Country Status (1)

Country Link
US (1) US7757221B2 (en)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080040587A1 (en) * 2006-08-09 2008-02-14 Kevin Charles Burke Debug Circuit Comparing Processor Instruction Set Operating Mode
US20080052691A1 (en) * 2006-06-29 2008-02-28 Naveen Neelakantam Communicating with and recovering state information from a dynamic translator
US20100115497A1 (en) * 2008-11-05 2010-05-06 Sun Microsystems, Inc. Handling signals and exceptions in a dynamic translation environment
US20100293258A1 (en) * 2009-05-14 2010-11-18 International Business Machines Corporation Dynamic optimization of mobile services
US20100306746A1 (en) * 2009-05-29 2010-12-02 University Of Maryland Binary rewriting without relocation information
US20130247046A1 (en) * 2009-06-30 2013-09-19 International Business Machines Corporation Processing code units on multi-core heterogeneous processors
US20130283249A1 (en) * 2011-09-30 2013-10-24 Abhay S. Kanhere Instruction and logic to perform dynamic binary translation
US20140196019A1 (en) * 2012-01-06 2014-07-10 Jianping Chen Method and Apparatus for Substituting Compiler Built-in Helper Functions with Machine Instructions
US9032381B2 (en) 2012-06-29 2015-05-12 Intel Corporation State recovery methods and apparatus for computing platforms
US9223714B2 (en) 2013-03-15 2015-12-29 Intel Corporation Instruction boundary prediction for variable length instruction set
US9563432B2 (en) 2013-04-19 2017-02-07 Nvidia Corporation Dynamic configuration of processing pipeline based on determined type of fetched instruction
US9891936B2 (en) 2013-09-27 2018-02-13 Intel Corporation Method and apparatus for page-level monitoring
US10621092B2 (en) 2008-11-24 2020-04-14 Intel Corporation Merging level cache and data cache units having indicator bits related to speculative execution
US10725755B2 (en) 2008-11-24 2020-07-28 Intel Corporation Systems, apparatuses, and methods for a hardware and software system to automatically decompose a program to multiple parallel threads
US20230244457A1 (en) * 2022-01-31 2023-08-03 Next Silicon Ltd Matching binary code to intermediate representation code

Families Citing this family (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8407675B1 (en) * 2007-02-06 2013-03-26 The United States Of America As Represented By The Secretary Of The Navy Extraction of executable code and translation to alternate platform
US8146106B2 (en) * 2007-12-31 2012-03-27 Intel Corporation On-demand emulation via user-level exception handling
US20100153776A1 (en) * 2008-12-12 2010-06-17 Sun Microsystems, Inc. Using safepoints to provide precise exception semantics for a virtual machine
US8732680B2 (en) * 2009-02-19 2014-05-20 International Business Machines Corporation Intermediate form for bitwidth sensitive applications and uses thereof
US9329846B1 (en) * 2009-11-25 2016-05-03 Parakinetics Inc. Cooperative program code transformation
US8479176B2 (en) * 2010-06-14 2013-07-02 Intel Corporation Register mapping techniques for efficient dynamic binary translation
US9798873B2 (en) 2011-08-04 2017-10-24 Elwha Llc Processor operable to ensure code integrity
US9170843B2 (en) 2011-09-24 2015-10-27 Elwha Llc Data handling apparatus adapted for scheduling operations according to resource allocation based on entitlement
US9471373B2 (en) 2011-09-24 2016-10-18 Elwha Llc Entitlement vector for library usage in managing resource allocation and scheduling based on usage and priority
US8943313B2 (en) 2011-07-19 2015-01-27 Elwha Llc Fine-grained security in federated data sets
US9465657B2 (en) 2011-07-19 2016-10-11 Elwha Llc Entitlement vector for library usage in managing resource allocation and scheduling based on usage and priority
US9298918B2 (en) 2011-11-30 2016-03-29 Elwha Llc Taint injection and tracking
US9460290B2 (en) 2011-07-19 2016-10-04 Elwha Llc Conditional security response using taint vector monitoring
US9443085B2 (en) 2011-07-19 2016-09-13 Elwha Llc Intrusion detection using taint accumulation
US8813085B2 (en) 2011-07-19 2014-08-19 Elwha Llc Scheduling threads based on priority utilizing entitlement vectors, weight and usage level
US9575903B2 (en) 2011-08-04 2017-02-21 Elwha Llc Security perimeter
US8955111B2 (en) 2011-09-24 2015-02-10 Elwha Llc Instruction set adapted for security risk monitoring
US9558034B2 (en) 2011-07-19 2017-01-31 Elwha Llc Entitlement vector for managing resource allocation
US9098608B2 (en) 2011-10-28 2015-08-04 Elwha Llc Processor configured to allocate resources using an entitlement vector
JP2015507269A (en) 2012-01-10 2015-03-05 インテル コーポレイション ISA bridging by callback
KR101394780B1 (en) 2012-08-08 2014-05-15 인텔 코포레이션 Isa bridging including support for call to overidding virtual functions
US20160283247A1 (en) * 2015-03-25 2016-09-29 Intel Corporation Apparatuses and methods to selectively execute a commit instruction
US10282182B2 (en) * 2016-09-23 2019-05-07 Intel Corporation Technologies for translation cache management in binary translation systems
US11886848B2 (en) * 2022-05-25 2024-01-30 International Business Machines Corporation Binary translation using raw binary code with compiler produced metadata

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5802373A (en) * 1996-01-29 1998-09-01 Digital Equipment Corporation Method for providing a pipeline interpreter for a variable length instruction set
US20020092002A1 (en) * 1999-02-17 2002-07-11 Babaian Boris A. Method and apparatus for preserving precise exceptions in binary translated code
US6502237B1 (en) * 1996-01-29 2002-12-31 Compaq Information Technologies Group, L.P. Method and apparatus for performing binary translation method and apparatus for performing binary translation
US6535903B2 (en) * 1996-01-29 2003-03-18 Compaq Information Technologies Group, L.P. Method and apparatus for maintaining translated routine stack in a binary translation environment
US20030101438A1 (en) * 2001-08-15 2003-05-29 Debi Mishra Semantics mapping between different object hierarchies
US20030191622A1 (en) * 1999-04-27 2003-10-09 Victoria University Of Manchester Exception handling method and apparatus for use in program code conversion
US20040194070A1 (en) * 2003-03-28 2004-09-30 Leonid Baraz Apparatus and method for reproduction of a source ISA application state corresponding to a target ISA application state at an execution stop point
US20040268330A1 (en) * 2003-06-26 2004-12-30 Microsoft Corporation Intermediate representation for multiple exception handling models
US20050005265A1 (en) * 2003-07-04 2005-01-06 Knowles Paul Thomas Method and apparatus for performing adjustable precision exception handling
US20060013218A1 (en) * 2004-07-15 2006-01-19 Paul Shore Method and system for a gigabit Ethernet IP telephone chip with no DSP core, which uses a RISC core with instruction extensions to support voice processing
US20060095896A1 (en) * 2004-09-28 2006-05-04 Jianhui Li Apparatus, system, and method of removing exception related dependencies
US20060161908A1 (en) * 2005-01-14 2006-07-20 Microsoft Corporation Software tool with modeling of asynchronous program flow
US20060253691A1 (en) * 2005-04-20 2006-11-09 Transitive Limited Method and apparatus for precise handling of exceptions during program code conversion
US20060294508A1 (en) * 2005-06-27 2006-12-28 Intel Corporation Apparatus, system, and method of dynamic binary translation supporting a denormal input handling mechanism
US7516453B1 (en) * 1998-10-26 2009-04-07 Vmware, Inc. Binary translator with precise exception synchronization mechanism

Patent Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5802373A (en) * 1996-01-29 1998-09-01 Digital Equipment Corporation Method for providing a pipeline interpreter for a variable length instruction set
US6502237B1 (en) * 1996-01-29 2002-12-31 Compaq Information Technologies Group, L.P. Method and apparatus for performing binary translation method and apparatus for performing binary translation
US6535903B2 (en) * 1996-01-29 2003-03-18 Compaq Information Technologies Group, L.P. Method and apparatus for maintaining translated routine stack in a binary translation environment
US7516453B1 (en) * 1998-10-26 2009-04-07 Vmware, Inc. Binary translator with precise exception synchronization mechanism
US20090187750A1 (en) * 1998-10-26 2009-07-23 Vmware, Inc. Binary Translator with Precise Exception Synchronization Mechanism
US20020092002A1 (en) * 1999-02-17 2002-07-11 Babaian Boris A. Method and apparatus for preserving precise exceptions in binary translated code
US7065750B2 (en) * 1999-02-17 2006-06-20 Elbrus International Method and apparatus for preserving precise exceptions in binary translated code
US20030191622A1 (en) * 1999-04-27 2003-10-09 Victoria University Of Manchester Exception handling method and apparatus for use in program code conversion
US6961932B2 (en) * 2001-08-15 2005-11-01 Microsoft Corporation Semantics mapping between different object hierarchies
US20030101438A1 (en) * 2001-08-15 2003-05-29 Debi Mishra Semantics mapping between different object hierarchies
US20040194070A1 (en) * 2003-03-28 2004-09-30 Leonid Baraz Apparatus and method for reproduction of a source ISA application state corresponding to a target ISA application state at an execution stop point
US20070006192A1 (en) * 2003-06-26 2007-01-04 Microsoft Corporation Intermediate representation for multiple exception handling models
US20040268330A1 (en) * 2003-06-26 2004-12-30 Microsoft Corporation Intermediate representation for multiple exception handling models
US7120898B2 (en) * 2003-06-26 2006-10-10 Microsoft Corporation Intermediate representation for multiple exception handling models
US20050005265A1 (en) * 2003-07-04 2005-01-06 Knowles Paul Thomas Method and apparatus for performing adjustable precision exception handling
US20060013218A1 (en) * 2004-07-15 2006-01-19 Paul Shore Method and system for a gigabit Ethernet IP telephone chip with no DSP core, which uses a RISC core with instruction extensions to support voice processing
US20060095896A1 (en) * 2004-09-28 2006-05-04 Jianhui Li Apparatus, system, and method of removing exception related dependencies
US20060161908A1 (en) * 2005-01-14 2006-07-20 Microsoft Corporation Software tool with modeling of asynchronous program flow
US20060253691A1 (en) * 2005-04-20 2006-11-09 Transitive Limited Method and apparatus for precise handling of exceptions during program code conversion
US20060294508A1 (en) * 2005-06-27 2006-12-28 Intel Corporation Apparatus, system, and method of dynamic binary translation supporting a denormal input handling mechanism

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
Beck et al, "Dynamic Reconfiguration with Binary Translation: Breaking the ILP Barrier with Software Compatibility", Jun. 2005, ACM, pp. 732-737. *
Oh et al, "Memory Access Optimization of Dynamic Binary Translation for Reconfigurable Architectures", 2005, IEEE, pp. 1011-1017. *
Ramsey et al, "A Transformational Approach to Binary Translation of Delayed Branches", ACM Transactions on Programming Languages and Systems, vol. 25, No. 2, Mar. 2003, pp. 210-224. *
Sutter et al, "Link-Time Binary Rewriting Techniques for Program Compaction", ACM Transactions on Programming Languages and Systems, vol. 27, No. 5, Sep. 2005, pp. 882-945. *

Cited By (27)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080052691A1 (en) * 2006-06-29 2008-02-28 Naveen Neelakantam Communicating with and recovering state information from a dynamic translator
US20080040587A1 (en) * 2006-08-09 2008-02-14 Kevin Charles Burke Debug Circuit Comparing Processor Instruction Set Operating Mode
US8352713B2 (en) * 2006-08-09 2013-01-08 Qualcomm Incorporated Debug circuit comparing processor instruction set operating mode
US20100115497A1 (en) * 2008-11-05 2010-05-06 Sun Microsystems, Inc. Handling signals and exceptions in a dynamic translation environment
US8473930B2 (en) * 2008-11-05 2013-06-25 Oracle America, Inc. Handling signals and exceptions in a dynamic translation environment
US10725755B2 (en) 2008-11-24 2020-07-28 Intel Corporation Systems, apparatuses, and methods for a hardware and software system to automatically decompose a program to multiple parallel threads
US10621092B2 (en) 2008-11-24 2020-04-14 Intel Corporation Merging level cache and data cache units having indicator bits related to speculative execution
US8813044B2 (en) * 2009-05-14 2014-08-19 International Business Machines Corporation Dynamic optimization of mobile services
US8769507B2 (en) * 2009-05-14 2014-07-01 International Business Machines Corporation Dynamic optimization of mobile services
US20100293258A1 (en) * 2009-05-14 2010-11-18 International Business Machines Corporation Dynamic optimization of mobile services
US20100306746A1 (en) * 2009-05-29 2010-12-02 University Of Maryland Binary rewriting without relocation information
US8510723B2 (en) * 2009-05-29 2013-08-13 University Of Maryland Binary rewriting without relocation information
US8966458B2 (en) * 2009-06-30 2015-02-24 International Business Machines Corporation Processing code units on multi-core heterogeneous processors
US20130247046A1 (en) * 2009-06-30 2013-09-19 International Business Machines Corporation Processing code units on multi-core heterogeneous processors
US9417855B2 (en) * 2011-09-30 2016-08-16 Intel Corporation Instruction and logic to perform dynamic binary translation
US20130283249A1 (en) * 2011-09-30 2013-10-24 Abhay S. Kanhere Instruction and logic to perform dynamic binary translation
US10649746B2 (en) 2011-09-30 2020-05-12 Intel Corporation Instruction and logic to perform dynamic binary translation
US20140196019A1 (en) * 2012-01-06 2014-07-10 Jianping Chen Method and Apparatus for Substituting Compiler Built-in Helper Functions with Machine Instructions
US9098355B2 (en) * 2012-01-06 2015-08-04 Intel Corporation Method and apparatus for substituting compiler built-in helper functions with machine instructions
US9507575B2 (en) 2012-06-29 2016-11-29 Intel Corporation State recovery methods and apparatus for computing platforms
US9032381B2 (en) 2012-06-29 2015-05-12 Intel Corporation State recovery methods and apparatus for computing platforms
US10635418B2 (en) 2012-06-29 2020-04-28 Intel Corporation State recovery methods and apparatus for computing platforms
US9223714B2 (en) 2013-03-15 2015-12-29 Intel Corporation Instruction boundary prediction for variable length instruction set
US9563432B2 (en) 2013-04-19 2017-02-07 Nvidia Corporation Dynamic configuration of processing pipeline based on determined type of fetched instruction
US9891936B2 (en) 2013-09-27 2018-02-13 Intel Corporation Method and apparatus for page-level monitoring
US20230244457A1 (en) * 2022-01-31 2023-08-03 Next Silicon Ltd Matching binary code to intermediate representation code
US11886847B2 (en) * 2022-01-31 2024-01-30 Next Silicon Ltd Matching binary code to intermediate representation code

Also Published As

Publication number Publication date
US20070079304A1 (en) 2007-04-05

Similar Documents

Publication Publication Date Title
US7757221B2 (en) Apparatus and method for dynamic binary translator to support precise exceptions with minimal optimization constraints
US7596781B2 (en) Register-based instruction optimization for facilitating efficient emulation of an instruction stream
US8479176B2 (en) Register mapping techniques for efficient dynamic binary translation
US10228919B2 (en) Demand-driven algorithm to reduce sign-extension instructions included in loops of a 64-bit computer program
US5721927A (en) Method for verifying contiquity of a binary translated block of instructions by attaching a compare and/or branch instruction to predecessor block of instructions
US6243668B1 (en) Instruction set interpreter which uses a register stack to efficiently map an application register state
JP2004038923A (en) Emulation of conditional code flag for program code conversion
US8281296B2 (en) Cross-ISA inlining in a system virtual machine
US7076769B2 (en) Apparatus and method for reproduction of a source ISA application state corresponding to a target ISA application state at an execution stop point
CN102364433B (en) Method for realizing Wine construction tool transplanting on ARM (Advanced RISC Machines) processor
CN111625279A (en) Dynamic and static fusion binary translation method and system based on dynamic link library
US9098355B2 (en) Method and apparatus for substituting compiler built-in helper functions with machine instructions
US20170046140A1 (en) State recovery methods and apparatus for computing platforms
US8276132B1 (en) System and method for representing and managing a multi-architecture co-processor application program
JPH10133884A (en) Method for executing programming code including conjectural code
US10241768B2 (en) Controlling execution of binary code
US7774767B2 (en) System and method for compiler interprocedural optimization having support for object files in libraries
US8281294B1 (en) System and method for representing and managing a multi-architecture co-processor application program
US8347310B1 (en) System and method for representing and managing a multi-architecure co-processor application program
US11249733B2 (en) Electronic apparatus and control method thereof
JP2007323358A (en) Medium recording compiler program, compile method and information processor involving this method
CN116661807A (en) Binary translation code inline optimization method, binary translation code inline optimization device and storage medium
CN116149793A (en) Binary translation register mapping method
Das et al. Issues and support for dynamic register allocation
US7340592B1 (en) Executing a translated block of instructions and branching to correction code when expected top of stack does not match actual top of stack to adjust stack at execution time to continue executing without restarting translating

Legal Events

Date Code Title Description
AS Assignment

Owner name: INTEL CORPORATION, CALIFORNIA

Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:ZHENG, BIXIA;WANG, CHENG C.;KIM, HO-SEOP;AND OTHERS;SIGNING DATES FROM 20050929 TO 20050930;REEL/FRAME:017070/0781

Owner name: INTEL CORPORATION, CALIFORNIA

Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:ZHENG, BIXIA;WANG, CHENG C.;KIM, HO-SEOP;AND OTHERS;REEL/FRAME:017070/0781;SIGNING DATES FROM 20050929 TO 20050930

STCF Information on status: patent grant

Free format text: PATENTED CASE

FPAY Fee payment

Year of fee payment: 4

MAFP Maintenance fee payment

Free format text: PAYMENT OF MAINTENANCE FEE, 8TH YEAR, LARGE ENTITY (ORIGINAL EVENT CODE: M1552)

Year of fee payment: 8

MAFP Maintenance fee payment

Free format text: PAYMENT OF MAINTENANCE FEE, 12TH YEAR, LARGE ENTITY (ORIGINAL EVENT CODE: M1553); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY

Year of fee payment: 12