US20030149963A1 - Condition code flag emulation for program code conversion - Google Patents
Condition code flag emulation for program code conversion Download PDFInfo
- Publication number
- US20030149963A1 US20030149963A1 US10/314,179 US31417902A US2003149963A1 US 20030149963 A1 US20030149963 A1 US 20030149963A1 US 31417902 A US31417902 A US 31417902A US 2003149963 A1 US2003149963 A1 US 2003149963A1
- Authority
- US
- United States
- Prior art keywords
- flag
- instruction
- subject
- parameters
- affecting
- 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.)
- Abandoned
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45537—Provision of facilities of other operating environments, e.g. WINE
Definitions
- the present invention relates in general to the field of program code conversion.
- the invention relates to a method and apparatus for emulation of condition code flags.
- registers are a small number of high-speed memory locations closely associated with the processor.
- the registers can be contrasted with general random access memory provided remote from the processor, which is slower but has a much larger capacity.
- general random access memory provided remote from the processor, which is slower but has a much larger capacity.
- a modern processor includes of the order of 32 to 144 registers. The limited size and high speed of the registers make them one of the most critical resources in almost all computer architectures.
- the registers are usually augmented with a set of condition code flags.
- the condition code flags are set or cleared such as in response to the execution of instructions in the processor and are used to represent the outcome of various operations.
- the value of one or more of the condition code flags is often used as the basis for a decision during execution of a sequence of instructions. Hence, in the context of program code conversion, it is critical to accurately emulate the condition code flags.
- processor architectures are inherently highly incompatible. Some processors are strongly reliant on the use of condition code flags, whereas some other processors do not provide any condition code flags at all. For example, it is very expensive to provide an emulator able to convert subject code written for a subject processor which does use condition code flags to run on a target processor without any condition code flags.
- An aim of the present invention is to provide a method for emulating condition code flags that addresses the problems of the prior art, particularly those problems set out above.
- a preferred aim of the present invention is to provide a method for emulating condition code flags that is efficient and reduces overall cost of program code conversion.
- a method for emulating condition code flags during program code conversion comprising the steps of: (a) identifying a flag-affecting instruction in a sequence of subject code instructions; (b) recording parameters of the identified flag-affecting instruction; (c) detecting a flag-usage instruction in the sequence of subject code instructions; and (d) resolving a flag status with respect to the recorded parameters.
- the step (d) comprises explicitly calculating a flag status by emulating effects of the identified flag-affecting instruction on one or more subject condition code flags.
- the step (b) comprises setting a flag status indicator to a pending state to indicate that parameters have been recorded
- the step (d) comprises setting the flag status indicator to a normalised state to indicate that a flag status has been explicitly calculated.
- step (d) comprises implicitly determining flag status with reference to the recorded parameters.
- the step (c) comprises determining a flag usage type with reference to a type of the detected flag-usage instruction
- the step (d) comprises resolving flag status either by explicitly calculating a flag status or by implicitly determining a flag status, according to the determined flag usage type.
- the step (a) comprises identifying a second flag-identifying instruction in the sequence of subject code instructions, and the step (b) comprises replacing the recorded parameters with parameters of the second flag-affecting instruction.
- the recorded parameters are replaced as each new flag-affecting instruction is encountered.
- parameters are recorded for a plurality of instructions.
- the step (a) comprises identifying a type of flag-affecting instruction as one of a plurality of predetermined types, and the step (b) comprises recording parameters for each type of flag-affecting instruction.
- the predetermined types include a first type instruction affecting a full set of condition code flags, and a second type instruction affecting a subset of the full set of condition code flags.
- the step (d) comprises resolving flag status for a full set of condition code flags with respect to the recorded first-type parameters, and resolving flag status with respect to the subset of the condition code flags with respect to the recorded second-type parameters.
- the step (d) comprises explicitly determining flag status from the recorded first-type parameters, and modifying the explicitly determined flag status from the recorded second-type parameters.
- the predetermined types include instruction types each affecting a condition code flag set amongst a plurality of condition code flag sets.
- the recorded parameters include an instruction type parameter and one or more instruction operand parameters.
- the parameters are recorded in dedicated storage locations, such as predetermined locations in a main memory. The parameters are suitably copied to such location.
- recording an instruction operand parameter may comprise storing a reference to a location containing an operand.
- recording an instruction operand parameter comprises determining that an operand remains available unmodified at an original location and storing a reference to the original location as the instruction operand parameter, or else copying the operand from the original location to a dedicated operand parameter storage location.
- the method comprises providing a plurality of abstract registers representing registers of a subject processor, and supplementing the abstract registers with one or more additional abstract registers each for storing an operand as an instruction operand parameter.
- a method for emulating condition code flags during program code conversion comprising: selecting a sequence of subject code instructions; identifying a flag-affecting instruction in the sequence of subject code instructions, the flag-affecting instruction specifying an operation that affects subject condition code flags of a subject processor; recording parameters of the identified flag-affecting instruction including an instruction type parameter and one or more operand parameters; detecting a flag-usage instruction in the sequence of subject code instructions, the flag-usage instruction specifying an operation with reference to a flag status of one or more of the subject condition code flags; and in response to detecting a flag-usage instruction, resolving a flag status of one or more of the subject condition code flags with respect to the recorded parameters.
- the method preferably comprises updating the recorded parameters when a new flag-affecting instruction is encountered in the sequence of subject code instructions.
- Parameters may be recorded for a plurality of flag-affecting instructions.
- the plurality of instructions are each associated with differing sets of subject condition code flags.
- the method comprises resolving flag status by at least one of (a) explicitly calculating a status for one or more subject condition code flags by emulating an effect of the recorded flag-affecting instruction, or (b) implicitly representing the flag-usage instruction using the recorded parameters, or (c) selecting between options (a) and (b) according to a type of the flag-usage instruction.
- the recorded parameters include at least one instruction operand parameter, and wherein recording the instruction operand parameter comprises at least one of (a) copying an operand to a predetermined storage location, or (b) storing a reference to an original location containing the operand, or (c) selectively performing (a) or (b).
- an emulator apparatus for use in a target computing environment for emulating a subject processor of a subject computing environment when translating subject code appropriate to the subject computing environment to produce target code appropriate to the target computing environment, the emulator apparatus comprising: means for identifying a flag-affecting instruction in a sequence of subject code instructions; an instruction parameter store for recording parameters of the identified flag-affecting instruction; means for detecting a flag-usage instruction in the sequence of subject code instructions; and means for resolving a flag status with respect to the instruction parameters recorded in the instruction parameter store.
- the invention also extends to a computing platform embodying the emulator apparatus and/or arranged to perform the methods defined herein.
- the computing platform may take any suitable form including, for example, a networked computing system, a server computer, a desktop computer, or a portable computing device.
- the invention also extends to a computer readable recording medium containing program code instructions for performing any of the methods defined herein.
- FIG. 1 shows an example computing environment including subject and target computing environments
- FIG. 2 outlines a preferred method for emulating condition code flags
- FIG. 3 shows two examples of subject program code
- FIG. 4 shows a preferred emulator
- FIG. 5 shows an example of subject program code together with recorded instruction parameters
- FIG. 6 shows program code during translation from a subject environment to a target environment
- FIG. 7 shows a preferred arrangement for storing instruction parameters
- FIG. 8 shows an example of subject program code
- FIG. 9 shows a condition register of condition code flags in an example subject processor
- FIG. 10 shows a preferred arrangement for storing instruction parameters
- FIG. 11 shows another preferred arrangement for storing instruction parameters.
- an example computing environment including a subject computing environment 1 and a target computing environment 2 .
- subject code 10 is executable natively on a subject processor 12 .
- the subject processor 12 includes a set of subject registers 14 and a set of subject condition code flags 16 .
- the subject code 10 may be represented in any suitable language with intermediate layers (e.g. compilers) between the subject code 10 and the subject processor 12 , as will be familiar to the skilled person.
- the subject processor 12 is a member of the Intel (rtm) ⁇ 86 family of processors, whilst the target processor 22 is a member of the PowerPC (rtm) processor family.
- the subject processor 12 is a member of the Intel (rtm) ⁇ 86 family of processors
- the target processor 22 is a member of the PowerPC (rtm) processor family.
- These two processors are inherently non-compatible. Firstly, these two processors use different instruction sets.
- an ⁇ 86 processor uses two flags (the auxiliary flag and the parity flag) which are unique to that family and are not provided in the PowerPC (rtm) architecture.
- an emulator 30 is provided in the target computing environment 2 , in order to run the subject code 10 in that non-compatible environment.
- the emulator 30 performs a translation process on the subject code 10 and provides a translated target code 20 to the target processor 22 .
- the emulator 30 performs binary translation, wherein subject code 10 in the form of executable binary code appropriate to the subject processor 12 is translated into executable binary code appropriate to the target processor 22 .
- Translation can be performed statically, or dynamically. In static translation, an entire program is translated prior to execution of the translated program on the target processor. This involves a significant delay. Therefore, emulators have been developed which dynamically translate small sections of the subject code 10 for execution immediately on the target processor 22 . This is much more efficient, because large sections of the subject code 10 will not be used in practice, or will be used only rarely.
- the preferred embodiment of the present invention is particularly intended for use with an emulator 30 that performs dynamic binary translation of the subject code 10 into target code 20 executable on the target processor 22 .
- the subject code 10 provides instructions that directly or indirectly make use of the subject registers 14 and the subject condition code flags 16 . Hence, it is desired to emulate the effects of those instructions, in order to provide an accurate translation of the subject code 10 .
- the target condition code flags 26 are not directly compatible with the subject condition code flags 16 , emulation of the subject condition code flags 16 in the target computing environment is expensive in terms of both time and resources.
- condition code flags It is desired to provide emulation of condition code flags in a manner which is cost efficient in the target processor. Further, it is desired that the emulation method can be performed efficiently in many different types of target processor. Ideally, it is desired to allow efficient emulation even in a target processor which does not provide any condition code flags.
- FIG. 2 shows a first preferred embodiment of a method for emulating condition code flags.
- step 210 parameters of a flag-setting instruction are recorded. Conveniently, certain instructions are known to affect one or more of the condition code flags, whilst other instructions are known to have no affect on the condition code flags. Hence, when translating a sequence of instructions in the subject code 10 , an instruction which potentially affects flag settings is identified. Parameters of that flag-affecting instruction are then stored, to be available later.
- step 220 a flag usage is detected. That is, it is known that some instructions in the instruction set of the subject code 10 make use of one or more of the subject condition code flags 16 , such as to make a branch or jump decision based on the value of a condition code flag. At this point, it is desired to know the real values of those flags.
- Step 230 comprises resolving a value for the condition code flags, at least for the one or more flags where a usage has been detected, from the recorded parameters of the flag-affecting instruction.
- flag emulation is deferred until the last possible moment. Instruction parameters are recorded for a potentially flag-affecting instruction. Then, when it is necessary to emulate the flag, such as when the flags are used as the basis for a decision, the recorded instruction parameters are used to resolve the necessary flag or flags at that point.
- the flag-affecting instruction is emulated including explicit emulation of the effect of that instruction on the subject condition code flags. However, since full flag emulation is only performed when a flag-using instruction is encountered, overhead associated with flag emulation is significantly reduced and emulator performance is substantially enhanced.
- the flag values have been resolved, they remain valid until a new flag-affecting instruction is encountered. At that point, the parameters of the flag-affecting instruction are again recorded, as in step 210 . Conveniently, the emulated condition code flags are marked as either being in a normalised, explicitly calculated state, or else in a pending state to be resolved with reference to a recorded flag-affecting instruction.
- FIG. 3 shows two example instruction sequences to illustrate the method of FIG. 2.
- the instruction at line 1 affects the subject condition code flags “z”, “s” and “o”, with the “z” flag subsequently utilised by the conditional branch instruction at line 2.
- the first instruction (Sub) subtracts the value of register R 2 from the value in register R 1 , and the branch (Bez) is effected if the result is equal to zero.
- the parameters of the instruction on line 1 are recorded, and are then used to determine the value of the flag “z” for the instruction on line 2.
- the instruction (Ble) on line 2 branches if the result of the subtraction is less than or equal to zero, this decision being made with reference to the example condition code flags “z”, “s” and “o”.
- the branch decision in line 2 can be made simply based upon the parameters of the preceding flag-affecting instruction in line 1. That is, the flag value “z” can be determined implicitly based upon the recorded instruction parameters and there is no need to explicitly determine the value of the flag “z”.
- the step 220 advantageously comprises determining a flag usage, and determining a flag usage type.
- the step 230 then comprises either explicitly determining flag values, or else implicitly determining flag values from recorded instruction parameters, based upon the determined flag usage type.
- the example instruction sequences shown in FIG. 3 provide a flag-affecting instruction (Sub) followed immediately by a flag-using instruction (Bez or Ble)
- a flag-using instruction (Bez or Ble)
- one or more intervening sterile instructions are present between example lines 1 and 2, which do not affect or use the relevant flag or flags.
- the emulator 30 of the preferred embodiment is illustrated in more detail, comprising a front end 31 , a core 32 and a back end 33 .
- the front end 31 is configured specific to the subject processor 12 being emulated.
- the front end 31 takes a predetermined section of the subject code 10 and provides a block of a generic intermediate representation (an “IR block”).
- the core 32 optimises each IR block generated by the front end 31 by employing optimisation techniques, such as dead code elimination, which need not be described here in detail.
- the back end 33 takes optimised IR blocks from the core 32 and produces target code 20 executable by the target processor 22 .
- the front end 31 divides the subject code 10 into basic blocks, where each basic block is a sequential set of instructions between a first instruction at a unique entry point and a last instruction at a unique exit point (such as a jump, call or branch instruction).
- the core 32 may select a group block comprising two or more basic blocks which are to be treated together as a single unit. Further, the front end 31 may form iso-blocks representing the same basic block of subject code under different entry conditions.
- a first predetermined section of the subject code 10 is identified, such as a basic block, and is translated by the emulator 30 running on the target processor 22 in a translation mode.
- the target processor 22 then executes the corresponding optimised and translated block of target code 20 .
- the preferred emulator 30 includes a plurality of abstract registers 320 , suitably provided in the core 32 , which represent the physical subject registers 14 that would be used within the subject processor 12 to execute the subject code 10 .
- the abstract registers define the state of the subject processor 12 being emulated by representing the expected effects of the subject code instructions on the subject processor registers.
- FIG. 4 also shows a preferred implementation of the flag emulation method, suitable for use in the general emulator architecture described above.
- a flag-affecting instruction is identified in the subject code 10
- parameters of that instruction are recorded in an instruction parameter store 200 .
- the stored instruction parameters include an instruction type 201 , and one or more instruction operands 202 .
- each instruction can operate on a maximum of two operands, and therefore two operand parameters 202 a , and 202 b are recorded.
- the instruction type parameter 201 together with the one or more operand parameters 202 provide sufficient information for each of the emulated subject condition code flags 16 to be resolved either explicitly, or implicitly.
- the one or more operand parameters 202 are suitably represented as one or more abstract registers additional to the emulated set of subject registers 14 . That is, the emulator 30 of target computing environment 2 emulates the set of subject registers 14 , by using abstract registers, and supplements this set of abstract registers with one or more additional registers to store the instruction operand parameters.
- the operand parameters 202 which are dynamic quantities, are available in the target processor 12 in a high speed memory location and the values of the subject condition code flags 16 are resolvable quickly and cheaply, such as via suitable dynamic target code.
- the instruction type parameter 201 which is a statically determinable quantity, is suitably stored in a slower or more remote location in the target computing environment 2 , such as in main memory, and is associated with a corresponding section of code such as a basic block.
- FIG. 5 shows six lines of example subject code. Some of the instructions (Sub) affect the full set of condition code flags o,s,z,a,p & c, whilst other instructions (Inc) affect only a subset of the condition code flags.
- the third column records the instruction type, whilst the fourth and the final columns record the two operands A & B referenced by that instruction.
- “Normalised” refers to the normalised status of the flag values
- “SubLong” refers to an instruction type, namely a long (32 bit) subtraction operation in an example ⁇ 86 processor.
- EAX, EBX, ECX and EDX are example subject registers.
- the emulator forms predetermined sections of subject code such as basic blocks, and records entry conditions giving the status of the emulation when passing from one basic block into another. That is, the emulator records entry conditions which are used to define the current status of the emulation at entry into a new basic block. These entry conditions include, for example, the status of each abstract register, and the status of the condition code flags.
- entry conditions include, for example, the status of each abstract register, and the status of the condition code flags.
- FIG. 5 the “Inc” instructions in lines 2 and 4 which affect a subset of the flags require the flags to be explicitly determined and the status is shown as normalised.
- the “Sub” instructions put the flags into the pending state and the parameters of that flag-affecting instruction are recorded. When it comes to the jump “JA” instruction in line 6, the condition code flags are emulated indirectly derived from the recorded parameters of the “Sub” instruction in line 5.
- FIG. 6 illustrates the preferred emulation method during translation of the subject code into target code
- first column an example pair of instructions are shown, in this case a compare (Cmp) instruction and a jump if not equal to zero (Jne) instruction.
- the front end 31 of the emulator 30 determines that these instructions form a basic block.
- the second column shows the same instructions, set out as standardised intermediate representation in the core 32 .
- the third column shows the resulting target code produced by the back end 33 .
- This example shows subject code appropriate to an ⁇ 86 processor being emulated by an MIPS processor.
- the architecture of a MIPS processor does not provide any target condition code flags.
- the fourth column of FIG. 6 shows that two lines of target code produced from the intermediate representation can be removed by global dead code elimination during an optimisation phase performed by the emulator. Hence, the two lines of subject code in the first column result in a single line of target code in the third column.
- the emulation method described herein can be efficiently implemented even for highly non-compatible environments.
- Flag emulation is not required at all for a large percentage of instructions, i.e. for sterile instructions. Further, in many instances flag status can be derived implicitly from the recorded instruction parameters. Only a small percentage of the instructions in the source code require full normalised emulation of the subject condition code flags. As practical examples, instructions such as subtraction (Sub) or compare (Cmp) or test (Tst) which occur frequently in source code written such as for ⁇ 86 subject processors can be emulated without any need for explicit resolution of the subject condition code flags.
- Sub subtraction
- Cmp compare
- Tst test
- the last flag-affecting instruction is recorded simply and easily by using additional abstract registers to represent each operand.
- an additional abstract register is provided for each potential operand.
- each instruction can act on at most two operands, and therefore two additional operand parameter registers are employed.
- it is advantageous to record additional instruction parameters as will now, be described below.
- FIG. 7 shows a preferred implementation for recording multiple sets of instruction parameters.
- two sets of instruction parameters are provided, namely inst — 1 and inst — 2.
- FIG. 8 shows four lines of subject code to illustrate the use of the first and second recorded instruction parameters of FIG. 7.
- the add instruction (add) at line 1 affects the complete flag set
- the decrement instruction (dec) at line 3 affects only a subset of the flags.
- the embodiment described above would require an explicit definition of the flags at line 3, by first normalising the flags with reference to the instruction parameters recorded for line 1.
- FIG. 7 it is now possible to record both instructions, from lines 1 and 3, without needing to normalise the flags at either point.
- the flag-using jump instruction is encountered at line 4, the values of the condition code flags are resolved explicitly or implicitly from the two sets of stored instruction parameters.
- FIGS. 9 and 10 illustrate another preferred implementation of the emulation method for use with processors such as the PowerPC (rtm) family which make use of a number of identical flag sets.
- processors such as the PowerPC (rtm) family which make use of a number of identical flag sets.
- FIG. 9 shows the condition register used in a typical PowerPC processor using eight 4 -bit condition fields (CF) which each contain four flags, namely less than (LT), greater than (GT), equal to (EQ) and summary overflow (SO).
- CF condition fields
- EQ summary overflow
- condition code flags in the condition register are initiated by compare instructions, which perform a signed or unsigned comparison of two values.
- instruction parameters are recorded for each of the condition fields.
- instruction parameters are recorded for each of “n” instructions, such that the last flag-affecting instruction can be recorded for each of the condition fields.
- the embodiment of FIG. 10 can be combined with the embodiment of FIG. 8, to provide a plurality of recorded instructions for each of the condition fields.
- FIG. 11 shows a further preferred option to improve efficiency of emulation.
- the operands of a flag affecting instruction are copied to operand registers so as to be available when it is necessary to resolve the flag status.
- the operand value is validly recorded, for example, in an emulated subject register. Provided the value in that subject register remains unchanged, then the subject register itself can be used as the source of the value of that operand.
- FIG. 11 in this example is adapted for the architecture of a PowerPC processor.
- the first control field denotes whether the operand value has been copied to the dedicated operand register 202 , or else denotes that the second field specifies the location which contains the value of this operand. That is, the second control field is used as a reference to a subject register (i.e. one of the abstract registers held by the emulator) which contains the value of the desired operand parameter.
- the first control field is a single bit in length, while the second field is five bits in length, which is sufficient to address the available subject registers of this example processor.
- the recorded operand parameters are only a subset of the operand parameters employed by the flag-affecting instruction. Firstly, when the flag-affecting instruction performs a reversible transformation and the result of the operation is still available when it is desired to resolve flag status, then the result together with a first operand can be used to infer a second operand. Secondly, if the flag-affecting operation has duplicate parameters, then it is sufficient to record just one of those parameters.
- the emulation method described herein is apt to be recorded on a computer readable recording medium as a computing program for performing the method.
- the invention also extends to an emulator apparatus, and to a computing platform, for performing the emulation method.
- the present invention has many advantages as will be apparent from the description above, and as will be apparent to the skilled person through practice of the invention.
- flag emulation is performed efficiently and cost effectively, even for highly non-compatible subject and target processor environments.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Executing Machine-Instructions (AREA)
Abstract
Description
- The present invention relates in general to the field of program code conversion. In particular, the invention relates to a method and apparatus for emulation of condition code flags.
- In the field of computer processing, it is often desired to run program code written for a computer processor of a first type (a “subject” processor) on a processor of a second type (a “target” processor). Here, an emulator is used to perform program code translation, such that the subject program is able to run on the target processor. The emulator provides a virtual environment, as if the subject program were running natively on a subject processor, by emulating the subject processor.
- Most conventional computer processors comprise a set of registers, which are a small number of high-speed memory locations closely associated with the processor. The registers can be contrasted with general random access memory provided remote from the processor, which is slower but has a much larger capacity. Typically, a modern processor includes of the order of 32 to 144 registers. The limited size and high speed of the registers make them one of the most critical resources in almost all computer architectures.
- The registers are usually augmented with a set of condition code flags. The condition code flags are set or cleared such as in response to the execution of instructions in the processor and are used to represent the outcome of various operations. The value of one or more of the condition code flags is often used as the basis for a decision during execution of a sequence of instructions. Hence, in the context of program code conversion, it is critical to accurately emulate the condition code flags.
- Whilst there tends to be some overlap between the set of condition code flags of a subject processor and the set of condition code flags of a target processor, in almost all cases there is not an exact correspondence between the two sets of flags. Therefore, accurately emulating the subject condition code flags can be an expensive operation. The degree to which flag emulation impacts upon the efficiency of the conversion process varies according to compatibility of the subject processor architecture with the target processor architecture, but in general the emulation of subject condition code flags amounts to a significant proportion of overall performance.
- A further problem arises in that some processor architectures are inherently highly incompatible. Some processors are strongly reliant on the use of condition code flags, whereas some other processors do not provide any condition code flags at all. For example, it is very expensive to provide an emulator able to convert subject code written for a subject processor which does use condition code flags to run on a target processor without any condition code flags.
- An aim of the present invention is to provide a method for emulating condition code flags that addresses the problems of the prior art, particularly those problems set out above.
- A preferred aim of the present invention is to provide a method for emulating condition code flags that is efficient and reduces overall cost of program code conversion.
- According to a first aspect of the present invention there is provided a method for emulating condition code flags during program code conversion, comprising the steps of: (a) identifying a flag-affecting instruction in a sequence of subject code instructions; (b) recording parameters of the identified flag-affecting instruction; (c) detecting a flag-usage instruction in the sequence of subject code instructions; and (d) resolving a flag status with respect to the recorded parameters.
- In a first preferred embodiment, preferably the step (d) comprises explicitly calculating a flag status by emulating effects of the identified flag-affecting instruction on one or more subject condition code flags. Preferably, the step (b) comprises setting a flag status indicator to a pending state to indicate that parameters have been recorded, and the step (d) comprises setting the flag status indicator to a normalised state to indicate that a flag status has been explicitly calculated.
- In a second preferred embodiment, preferably the step (d) comprises implicitly determining flag status with reference to the recorded parameters.
- The first and second preferred embodiments can be used in combination. Preferably, the step (c) comprises determining a flag usage type with reference to a type of the detected flag-usage instruction, and the step (d) comprises resolving flag status either by explicitly calculating a flag status or by implicitly determining a flag status, according to the determined flag usage type.
- Preferably, the step (a) comprises identifying a second flag-identifying instruction in the sequence of subject code instructions, and the step (b) comprises replacing the recorded parameters with parameters of the second flag-affecting instruction. Here, the recorded parameters are replaced as each new flag-affecting instruction is encountered. Alternatively, parameters are recorded for a plurality of instructions.
- Preferably, the step (a) comprises identifying a type of flag-affecting instruction as one of a plurality of predetermined types, and the step (b) comprises recording parameters for each type of flag-affecting instruction.
- In one embodiment, preferably, the predetermined types include a first type instruction affecting a full set of condition code flags, and a second type instruction affecting a subset of the full set of condition code flags. Preferably, the step (d) comprises resolving flag status for a full set of condition code flags with respect to the recorded first-type parameters, and resolving flag status with respect to the subset of the condition code flags with respect to the recorded second-type parameters. Preferably, the step (d) comprises explicitly determining flag status from the recorded first-type parameters, and modifying the explicitly determined flag status from the recorded second-type parameters.
- In a second embodiment, preferably the predetermined types include instruction types each affecting a condition code flag set amongst a plurality of condition code flag sets.
- Preferably, the recorded parameters include an instruction type parameter and one or more instruction operand parameters. In one embodiment, the parameters are recorded in dedicated storage locations, such as predetermined locations in a main memory. The parameters are suitably copied to such location. However, recording an instruction operand parameter may comprise storing a reference to a location containing an operand. Here, recording an instruction operand parameter comprises determining that an operand remains available unmodified at an original location and storing a reference to the original location as the instruction operand parameter, or else copying the operand from the original location to a dedicated operand parameter storage location. Preferably, the method comprises providing a plurality of abstract registers representing registers of a subject processor, and supplementing the abstract registers with one or more additional abstract registers each for storing an operand as an instruction operand parameter.
- According to a second aspect of the present invention there is provided a method for emulating condition code flags during program code conversion, comprising: selecting a sequence of subject code instructions; identifying a flag-affecting instruction in the sequence of subject code instructions, the flag-affecting instruction specifying an operation that affects subject condition code flags of a subject processor; recording parameters of the identified flag-affecting instruction including an instruction type parameter and one or more operand parameters; detecting a flag-usage instruction in the sequence of subject code instructions, the flag-usage instruction specifying an operation with reference to a flag status of one or more of the subject condition code flags; and in response to detecting a flag-usage instruction, resolving a flag status of one or more of the subject condition code flags with respect to the recorded parameters.
- The method preferably comprises updating the recorded parameters when a new flag-affecting instruction is encountered in the sequence of subject code instructions. Parameters may be recorded for a plurality of flag-affecting instructions. In one embodiment the plurality of instructions are each associated with differing sets of subject condition code flags.
- Preferably, the method comprises resolving flag status by at least one of (a) explicitly calculating a status for one or more subject condition code flags by emulating an effect of the recorded flag-affecting instruction, or (b) implicitly representing the flag-usage instruction using the recorded parameters, or (c) selecting between options (a) and (b) according to a type of the flag-usage instruction.
- Preferably, the recorded parameters include at least one instruction operand parameter, and wherein recording the instruction operand parameter comprises at least one of (a) copying an operand to a predetermined storage location, or (b) storing a reference to an original location containing the operand, or (c) selectively performing (a) or (b).
- According to a third aspect of the present invention there is provided an emulator apparatus for use in a target computing environment for emulating a subject processor of a subject computing environment when translating subject code appropriate to the subject computing environment to produce target code appropriate to the target computing environment, the emulator apparatus comprising: means for identifying a flag-affecting instruction in a sequence of subject code instructions; an instruction parameter store for recording parameters of the identified flag-affecting instruction; means for detecting a flag-usage instruction in the sequence of subject code instructions; and means for resolving a flag status with respect to the instruction parameters recorded in the instruction parameter store.
- The invention also extends to a computing platform embodying the emulator apparatus and/or arranged to perform the methods defined herein. The computing platform may take any suitable form including, for example, a networked computing system, a server computer, a desktop computer, or a portable computing device. The invention also extends to a computer readable recording medium containing program code instructions for performing any of the methods defined herein.
- For a better understanding of the invention, and to show how embodiments of the same may be carried into effect, reference will now be made, by way of example, to the accompanying diagrammatic drawings in which:
- FIG. 1 shows an example computing environment including subject and target computing environments;
- FIG. 2 outlines a preferred method for emulating condition code flags;
- FIG. 3 shows two examples of subject program code;
- FIG. 4 shows a preferred emulator;
- FIG. 5 shows an example of subject program code together with recorded instruction parameters;
- FIG. 6 shows program code during translation from a subject environment to a target environment;
- FIG. 7 shows a preferred arrangement for storing instruction parameters;
- FIG. 8 shows an example of subject program code;
- FIG. 9 shows a condition register of condition code flags in an example subject processor;
- FIG. 10 shows a preferred arrangement for storing instruction parameters; and
- FIG. 11 shows another preferred arrangement for storing instruction parameters.
- Referring to FIG. 1, an example computing environment is shown including a
subject computing environment 1 and atarget computing environment 2. In thesubject environment 1,subject code 10 is executable natively on asubject processor 12. Thesubject processor 12 includes a set ofsubject registers 14 and a set of subject condition code flags 16. Here, thesubject code 10 may be represented in any suitable language with intermediate layers (e.g. compilers) between thesubject code 10 and thesubject processor 12, as will be familiar to the skilled person. - It is desired to run the
subject code 10 in thetarget computing environment 2, which provides atarget processor 22 using a set of target registers 24 and a set of target condition code flags 26. As a typical example, thesubject processor 12 is a member of the Intel (rtm) ×86 family of processors, whilst thetarget processor 22 is a member of the PowerPC (rtm) processor family. These two processors are inherently non-compatible. Firstly, these two processors use different instruction sets. Secondly, an ×86 processor uses two flags (the auxiliary flag and the parity flag) which are unique to that family and are not provided in the PowerPC (rtm) architecture. Hence, anemulator 30 is provided in thetarget computing environment 2, in order to run thesubject code 10 in that non-compatible environment. - The
emulator 30 performs a translation process on thesubject code 10 and provides a translatedtarget code 20 to thetarget processor 22. Suitably, theemulator 30 performs binary translation, whereinsubject code 10 in the form of executable binary code appropriate to thesubject processor 12 is translated into executable binary code appropriate to thetarget processor 22. - Translation can be performed statically, or dynamically. In static translation, an entire program is translated prior to execution of the translated program on the target processor. This involves a significant delay. Therefore, emulators have been developed which dynamically translate small sections of the
subject code 10 for execution immediately on thetarget processor 22. This is much more efficient, because large sections of thesubject code 10 will not be used in practice, or will be used only rarely. The preferred embodiment of the present invention is particularly intended for use with anemulator 30 that performs dynamic binary translation of thesubject code 10 intotarget code 20 executable on thetarget processor 22. - In executable form, the
subject code 10 provides instructions that directly or indirectly make use of thesubject registers 14 and the subject condition code flags 16. Hence, it is desired to emulate the effects of those instructions, in order to provide an accurate translation of thesubject code 10. However, since the target condition code flags 26 are not directly compatible with the subject condition code flags 16, emulation of the subject condition code flags 16 in the target computing environment is expensive in terms of both time and resources. - It is desired to provide emulation of condition code flags in a manner which is cost efficient in the target processor. Further, it is desired that the emulation method can be performed efficiently in many different types of target processor. Ideally, it is desired to allow efficient emulation even in a target processor which does not provide any condition code flags.
- FIG. 2 shows a first preferred embodiment of a method for emulating condition code flags. In
step 210, parameters of a flag-setting instruction are recorded. Conveniently, certain instructions are known to affect one or more of the condition code flags, whilst other instructions are known to have no affect on the condition code flags. Hence, when translating a sequence of instructions in thesubject code 10, an instruction which potentially affects flag settings is identified. Parameters of that flag-affecting instruction are then stored, to be available later. - In
step 220, a flag usage is detected. That is, it is known that some instructions in the instruction set of thesubject code 10 make use of one or more of the subject condition code flags 16, such as to make a branch or jump decision based on the value of a condition code flag. At this point, it is desired to know the real values of those flags. -
Step 230 comprises resolving a value for the condition code flags, at least for the one or more flags where a usage has been detected, from the recorded parameters of the flag-affecting instruction. - In this method, flag emulation is deferred until the last possible moment. Instruction parameters are recorded for a potentially flag-affecting instruction. Then, when it is necessary to emulate the flag, such as when the flags are used as the basis for a decision, the recorded instruction parameters are used to resolve the necessary flag or flags at that point. Here, the flag-affecting instruction is emulated including explicit emulation of the effect of that instruction on the subject condition code flags. However, since full flag emulation is only performed when a flag-using instruction is encountered, overhead associated with flag emulation is significantly reduced and emulator performance is substantially enhanced.
- Once the flag values have been resolved, they remain valid until a new flag-affecting instruction is encountered. At that point, the parameters of the flag-affecting instruction are again recorded, as in
step 210. Conveniently, the emulated condition code flags are marked as either being in a normalised, explicitly calculated state, or else in a pending state to be resolved with reference to a recorded flag-affecting instruction. - FIG. 3 shows two example instruction sequences to illustrate the method of FIG. 2. In a simple first example, the instruction at
line 1 affects the subject condition code flags “z”, “s” and “o”, with the “z” flag subsequently utilised by the conditional branch instruction atline 2. In this example, the first instruction (Sub) subtracts the value of register R2 from the value in register R1, and the branch (Bez) is effected if the result is equal to zero. The parameters of the instruction online 1 are recorded, and are then used to determine the value of the flag “z” for the instruction online 2. In the second more complex example, the instruction (Ble) online 2 branches if the result of the subtraction is less than or equal to zero, this decision being made with reference to the example condition code flags “z”, “s” and “o”. - As an enhancement of this first method, it has been found that for most flag-using instructions it is not necessary to explicitly calculate the value of each flag. That is, the value of a- flag can be determined implicitly, with reference to the stored parameters of the flag-affecting instruction.
- Referring to the code examples of FIG. 3, the branch decision in
line 2 can be made simply based upon the parameters of the preceding flag-affecting instruction inline 1. That is, the flag value “z” can be determined implicitly based upon the recorded instruction parameters and there is no need to explicitly determine the value of the flag “z”. Hence, thestep 220 advantageously comprises determining a flag usage, and determining a flag usage type. Thestep 230 then comprises either explicitly determining flag values, or else implicitly determining flag values from recorded instruction parameters, based upon the determined flag usage type. - Instruction combinations similar to those shown in FIG. 3 occur very frequently. Hence, this optimisation has a significant impact.
- The example instruction sequences shown in FIG. 3 provide a flag-affecting instruction (Sub) followed immediately by a flag-using instruction (Bez or Ble) However, it is also possible that one or more intervening sterile instructions are present between
example lines - Referring now to FIG. 4, the
emulator 30 of the preferred embodiment is illustrated in more detail, comprising afront end 31, acore 32 and aback end 33. - The
front end 31 is configured specific to thesubject processor 12 being emulated. Thefront end 31 takes a predetermined section of thesubject code 10 and provides a block of a generic intermediate representation (an “IR block”). - The
core 32 optimises each IR block generated by thefront end 31 by employing optimisation techniques, such as dead code elimination, which need not be described here in detail. - The
back end 33 takes optimised IR blocks from thecore 32 and producestarget code 20 executable by thetarget processor 22. - Suitably, the
front end 31 divides thesubject code 10 into basic blocks, where each basic block is a sequential set of instructions between a first instruction at a unique entry point and a last instruction at a unique exit point (such as a jump, call or branch instruction). The core 32 may select a group block comprising two or more basic blocks which are to be treated together as a single unit. Further, thefront end 31 may form iso-blocks representing the same basic block of subject code under different entry conditions. - In use, a first predetermined section of the
subject code 10 is identified, such as a basic block, and is translated by theemulator 30 running on thetarget processor 22 in a translation mode. Thetarget processor 22 then executes the corresponding optimised and translated block oftarget code 20. - The preferred
emulator 30 includes a plurality of abstract registers 320, suitably provided in thecore 32, which represent the physical subject registers 14 that would be used within thesubject processor 12 to execute thesubject code 10. The abstract registers define the state of thesubject processor 12 being emulated by representing the expected effects of the subject code instructions on the subject processor registers. - FIG. 4 also shows a preferred implementation of the flag emulation method, suitable for use in the general emulator architecture described above. When a flag-affecting instruction is identified in the
subject code 10, parameters of that instruction are recorded in aninstruction parameter store 200. Most conveniently, the stored instruction parameters include aninstruction type 201, and one or more instruction operands 202. For example, in a ×86 type processor each instruction can operate on a maximum of two operands, and therefore twooperand parameters instruction type parameter 201 together with the one or more operand parameters 202 provide sufficient information for each of the emulated subject condition code flags 16 to be resolved either explicitly, or implicitly. - The one or more operand parameters202 are suitably represented as one or more abstract registers additional to the emulated set of subject registers 14. That is, the
emulator 30 oftarget computing environment 2 emulates the set ofsubject registers 14, by using abstract registers, and supplements this set of abstract registers with one or more additional registers to store the instruction operand parameters. Hence, the operand parameters 202, which are dynamic quantities, are available in thetarget processor 12 in a high speed memory location and the values of the subject condition code flags 16 are resolvable quickly and cheaply, such as via suitable dynamic target code. Theinstruction type parameter 201, which is a statically determinable quantity, is suitably stored in a slower or more remote location in thetarget computing environment 2, such as in main memory, and is associated with a corresponding section of code such as a basic block. - As shown in FIG. 4, in this first preferred embodiment only the most recent flag-affecting instruction is recorded. As each new flag-affecting instruction is encountered in the sequence of instructions in the
subject code 10, then the recorded parameters are replaced with those of the latest encountered flag-affecting instruction. That is, as each new flag-affecting instruction is encountered, the instruction parameters are replaced with those of that new flag-affecting instruction. - To further illustrate the preferred embodiments of the present invention, FIG. 5 shows six lines of example subject code. Some of the instructions (Sub) affect the full set of condition code flags o,s,z,a,p & c, whilst other instructions (Inc) affect only a subset of the condition code flags. The third column records the instruction type, whilst the fourth and the final columns record the two operands A & B referenced by that instruction. In this example, “Normalised” refers to the normalised status of the flag values, while “SubLong” refers to an instruction type, namely a long (32 bit) subtraction operation in an example ×86 processor. EAX, EBX, ECX and EDX are example subject registers.
- In use, the emulator forms predetermined sections of subject code such as basic blocks, and records entry conditions giving the status of the emulation when passing from one basic block into another. That is, the emulator records entry conditions which are used to define the current status of the emulation at entry into a new basic block. These entry conditions include, for example, the status of each abstract register, and the status of the condition code flags. In FIG. 5, the “Inc” instructions in
lines line 6, the condition code flags are emulated indirectly derived from the recorded parameters of the “Sub” instruction inline 5. - FIG. 6 illustrates the preferred emulation method during translation of the subject code into target code In the first column an example pair of instructions are shown, in this case a compare (Cmp) instruction and a jump if not equal to zero (Jne) instruction. The
front end 31 of theemulator 30 determines that these instructions form a basic block. The second column shows the same instructions, set out as standardised intermediate representation in thecore 32. The third column shows the resulting target code produced by theback end 33. This example shows subject code appropriate to an ×86 processor being emulated by an MIPS processor. The architecture of a MIPS processor does not provide any target condition code flags. This example illustrates a worst case practical situation, because traditionally the condition code flags of the ×86 processor are very expensive to emulate in the flagless MIPS processor. The fourth column of FIG. 6 shows that two lines of target code produced from the intermediate representation can be removed by global dead code elimination during an optimisation phase performed by the emulator. Hence, the two lines of subject code in the first column result in a single line of target code in the third column. - As illustrated by the simple example in FIG. 6, the emulation method described herein can be efficiently implemented even for highly non-compatible environments. Flag emulation is not required at all for a large percentage of instructions, i.e. for sterile instructions. Further, in many instances flag status can be derived implicitly from the recorded instruction parameters. Only a small percentage of the instructions in the source code require full normalised emulation of the subject condition code flags. As practical examples, instructions such as subtraction (Sub) or compare (Cmp) or test (Tst) which occur frequently in source code written such as for ×86 subject processors can be emulated without any need for explicit resolution of the subject condition code flags.
- In the implementation described above, the last flag-affecting instruction is recorded simply and easily by using additional abstract registers to represent each operand. In this architecture, an additional abstract register is provided for each potential operand. In the example of an ×86 processor, each instruction can act on at most two operands, and therefore two additional operand parameter registers are employed. Sometimes, however, it is advantageous to record additional instruction parameters, as will now, be described below.
- FIG. 7 shows a preferred implementation for recording multiple sets of instruction parameters. In this example, two sets of instruction parameters are provided, namely
inst —1 andinst —2. - For some types of processor, there are instructions which affect only a subset of the subject condition code flags, whilst other instructions affect the full set of subject condition code flags. As one option, this problem is overcome by explicitly determining the full set of flag values from the last full set flag-affecting instruction, and then explicitly determining the flag values of the subset affected by the subset-affecting instruction. The full set of flag values can then be determined by combining the explicitly determined flag values of the last full-set flag affecting instruction with those of the newly encountered subset affecting instruction.
- FIG. 8 shows four lines of subject code to illustrate the use of the first and second recorded instruction parameters of FIG. 7. The add instruction (add) at
line 1 affects the complete flag set, whereas the decrement instruction (dec) atline 3 affects only a subset of the flags. The embodiment described above would require an explicit definition of the flags atline 3, by first normalising the flags with reference to the instruction parameters recorded forline 1. However, by providing two sets of instruction parameters as shown in FIG. 7, it is now possible to record both instructions, fromlines line 4, the values of the condition code flags are resolved explicitly or implicitly from the two sets of stored instruction parameters. - FIGS. 9 and 10 illustrate another preferred implementation of the emulation method for use with processors such as the PowerPC (rtm) family which make use of a number of identical flag sets.
- FIG. 9 shows the condition register used in a typical PowerPC processor using eight4-bit condition fields (CF) which each contain four flags, namely less than (LT), greater than (GT), equal to (EQ) and summary overflow (SO). In this processor architecture, a flag-setting operation is allowed to selectively modify one of the eight sets of flags. Further, although most instructions will set every flag in the specified flag set, some operations exist which affect the status of specific flags. Hence, in traditional emulation systems, it is relatively expensive to emulate a processor of this nature.
- A majority of modifications to the condition code flags in the condition register are initiated by compare instructions, which perform a signed or unsigned comparison of two values. One of the three comparison flags within the specified condition field (LTn, GTn or EQn, where n=0 . . . 7) is set, while the other two are cleared. In order to emulate this relatively complex set of subject condition code flags, it is convenient to provide a set of recorded instructions such that instruction parameters are recorded for each of the condition fields. In this example, as shown in FIG. 10, instruction parameters are recorded for each of “n” instructions, such that the last flag-affecting instruction can be recorded for each of the condition fields. If necessary, the embodiment of FIG. 10 can be combined with the embodiment of FIG. 8, to provide a plurality of recorded instructions for each of the condition fields.
- FIG. 11 shows a further preferred option to improve efficiency of emulation. In the embodiments discussed above, the operands of a flag affecting instruction are copied to operand registers so as to be available when it is necessary to resolve the flag status. However, in some circumstances it is possible to avoid this copying operation by referring instead to the original source location of that operand. That is, the operand value is validly recorded, for example, in an emulated subject register. Provided the value in that subject register remains unchanged, then the subject register itself can be used as the source of the value of that operand.
- FIG. 11 in this example is adapted for the architecture of a PowerPC processor. For each operand A0-n, B0-n, two control fields are recorded. The first control field denotes whether the operand value has been copied to the dedicated operand register 202, or else denotes that the second field specifies the location which contains the value of this operand. That is, the second control field is used as a reference to a subject register (i.e. one of the abstract registers held by the emulator) which contains the value of the desired operand parameter. Here, the first control field is a single bit in length, while the second field is five bits in length, which is sufficient to address the available subject registers of this example processor.
- In another preferred embodiment, the recorded operand parameters are only a subset of the operand parameters employed by the flag-affecting instruction. Firstly, when the flag-affecting instruction performs a reversible transformation and the result of the operation is still available when it is desired to resolve flag status, then the result together with a first operand can be used to infer a second operand. Secondly, if the flag-affecting operation has duplicate parameters, then it is sufficient to record just one of those parameters. These special-case flag-affecting instructions allow increased optimisation of the target code and further reduce overhead associated with emulation of condition code flags.
- The preferred embodiments of the invention have been described in the context of an emulator performing program code conversion for the purposes of translation between non-compatible computing environments. However, the principles of the invention are also applicable to fields such as program code conversion for the purposes of optimisation, wherein a subject processor and a target processor have a compatible architecture.:
- The emulation method described herein is apt to be recorded on a computer readable recording medium as a computing program for performing the method. The invention also extends to an emulator apparatus, and to a computing platform, for performing the emulation method.
- The present invention has many advantages as will be apparent from the description above, and as will be apparent to the skilled person through practice of the invention. In particular, flag emulation is performed efficiently and cost effectively, even for highly non-compatible subject and target processor environments.
Claims (25)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US10/361,000 US7331040B2 (en) | 2002-02-06 | 2003-02-06 | Condition code flag emulation for program code conversion |
US11/957,343 US8024555B2 (en) | 2002-02-06 | 2007-12-14 | Condition code flag emulation for program code conversion |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
GB0202728.2 | 2002-02-06 | ||
GBGB0202728.2A GB0202728D0 (en) | 2002-02-06 | 2002-02-06 | Condition code flag emulation for program code conversion |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US10/361,000 Continuation-In-Part US7331040B2 (en) | 2002-02-06 | 2003-02-06 | Condition code flag emulation for program code conversion |
Publications (1)
Publication Number | Publication Date |
---|---|
US20030149963A1 true US20030149963A1 (en) | 2003-08-07 |
Family
ID=9930503
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US10/314,179 Abandoned US20030149963A1 (en) | 2002-02-06 | 2002-12-05 | Condition code flag emulation for program code conversion |
US11/957,343 Active 2025-07-06 US8024555B2 (en) | 2002-02-06 | 2007-12-14 | Condition code flag emulation for program code conversion |
Family Applications After (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US11/957,343 Active 2025-07-06 US8024555B2 (en) | 2002-02-06 | 2007-12-14 | Condition code flag emulation for program code conversion |
Country Status (4)
Country | Link |
---|---|
US (2) | US20030149963A1 (en) |
JP (1) | JP4911868B2 (en) |
GB (2) | GB0202728D0 (en) |
HK (1) | HK1056933A1 (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040176941A1 (en) * | 2003-03-04 | 2004-09-09 | Shan-Chyun Ku | Method of simulating computation instructions for an instruction set simulator |
US20080034188A1 (en) * | 2006-08-03 | 2008-02-07 | Nec Corporation | Information processing apparatus and method for accelerating information processing |
US20080177985A1 (en) * | 2002-02-06 | 2008-07-24 | Transitive Limited | Condition code flag emulation for program code conversion |
US20100268916A1 (en) * | 2007-12-29 | 2010-10-21 | Institute Of Computing Technology Of The Chinese Academy Of Sciences | Risc processor and its register flag bit processing method |
US20120180039A1 (en) * | 2011-01-11 | 2012-07-12 | International Business Machines Corporation | Automated Deployment of Applications with Tenant-Isolation Requirements |
US11966727B2 (en) | 2016-03-11 | 2024-04-23 | Lzlabs Gmbh | Load module compiler |
Families Citing this family (30)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7434209B2 (en) | 2003-07-15 | 2008-10-07 | Transitive Limited | Method and apparatus for performing native binding to execute native code |
GB0316531D0 (en) * | 2003-07-15 | 2003-08-20 | Transitive Ltd | Method and apparatus for performing native binding |
US8574393B2 (en) * | 2007-12-21 | 2013-11-05 | Tsinghua University | Method for making touch panel |
US8452947B2 (en) | 2008-02-01 | 2013-05-28 | International Business Machines Corporation | Hardware wake-and-go mechanism and content addressable memory with instruction pre-fetch look-ahead to detect programming idioms |
US8386822B2 (en) | 2008-02-01 | 2013-02-26 | International Business Machines Corporation | Wake-and-go mechanism with data monitoring |
US8250396B2 (en) | 2008-02-01 | 2012-08-21 | International Business Machines Corporation | Hardware wake-and-go mechanism for a data processing system |
US8725992B2 (en) | 2008-02-01 | 2014-05-13 | International Business Machines Corporation | Programming language exposing idiom calls to a programming idiom accelerator |
US8341635B2 (en) * | 2008-02-01 | 2012-12-25 | International Business Machines Corporation | Hardware wake-and-go mechanism with look-ahead polling |
US8516484B2 (en) * | 2008-02-01 | 2013-08-20 | International Business Machines Corporation | Wake-and-go mechanism for a data processing system |
US8788795B2 (en) * | 2008-02-01 | 2014-07-22 | International Business Machines Corporation | Programming idiom accelerator to examine pre-fetched instruction streams for multiple processors |
US8225120B2 (en) * | 2008-02-01 | 2012-07-17 | International Business Machines Corporation | Wake-and-go mechanism with data exclusivity |
US8880853B2 (en) * | 2008-02-01 | 2014-11-04 | International Business Machines Corporation | CAM-based wake-and-go snooping engine for waking a thread put to sleep for spinning on a target address lock |
US8312458B2 (en) * | 2008-02-01 | 2012-11-13 | International Business Machines Corporation | Central repository for wake-and-go mechanism |
US8316218B2 (en) | 2008-02-01 | 2012-11-20 | International Business Machines Corporation | Look-ahead wake-and-go engine with speculative execution |
US8640141B2 (en) | 2008-02-01 | 2014-01-28 | International Business Machines Corporation | Wake-and-go mechanism with hardware private array |
US8171476B2 (en) * | 2008-02-01 | 2012-05-01 | International Business Machines Corporation | Wake-and-go mechanism with prioritization of threads |
US8127080B2 (en) | 2008-02-01 | 2012-02-28 | International Business Machines Corporation | Wake-and-go mechanism with system address bus transaction master |
US8145849B2 (en) | 2008-02-01 | 2012-03-27 | International Business Machines Corporation | Wake-and-go mechanism with system bus response |
US8732683B2 (en) * | 2008-02-01 | 2014-05-20 | International Business Machines Corporation | Compiler providing idiom to idiom accelerator |
US8612977B2 (en) | 2008-02-01 | 2013-12-17 | International Business Machines Corporation | Wake-and-go mechanism with software save of thread state |
CN100555225C (en) * | 2008-03-17 | 2009-10-28 | 中国科学院计算技术研究所 | A kind of risc processor device and method of supporting the X86 virtual machine |
US8145723B2 (en) | 2009-04-16 | 2012-03-27 | International Business Machines Corporation | Complex remote update programming idiom accelerator |
US8886919B2 (en) * | 2009-04-16 | 2014-11-11 | International Business Machines Corporation | Remote update programming idiom accelerator with allocated processor resources |
US8230201B2 (en) | 2009-04-16 | 2012-07-24 | International Business Machines Corporation | Migrating sleeping and waking threads between wake-and-go mechanisms in a multiple processor data processing system |
US8082315B2 (en) | 2009-04-16 | 2011-12-20 | International Business Machines Corporation | Programming idiom accelerator for remote update |
US9811338B2 (en) * | 2011-11-14 | 2017-11-07 | Intel Corporation | Flag non-modification extension for ISA instructions using prefixes |
KR101642556B1 (en) * | 2012-09-21 | 2016-07-25 | 인텔 코포레이션 | Methods and systems for performing a binary translation |
US10261785B2 (en) | 2017-02-28 | 2019-04-16 | Microsoft Technology Licensing, Llc | Arithmetic lazy flags representation for emulation |
US10884720B2 (en) | 2018-10-04 | 2021-01-05 | Microsoft Technology Licensing, Llc | Memory ordering annotations for binary emulation |
US10684835B1 (en) * | 2018-12-11 | 2020-06-16 | Microsoft Technology Licensing, Llc | Improving emulation and tracing performance using compiler-generated emulation optimization metadata |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5768593A (en) * | 1996-03-22 | 1998-06-16 | Connectix Corporation | Dynamic cross-compilation system and method |
US5805895A (en) * | 1996-06-09 | 1998-09-08 | Motorola, Inc. | Method and apparatus for code translation optimization |
US20020026633A1 (en) * | 1991-04-23 | 2002-02-28 | Shinobu Koizumi | Retargetable information processing system |
Family Cites Families (66)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4514803A (en) * | 1982-04-26 | 1985-04-30 | International Business Machines Corporation | Methods for partitioning mainframe instruction sets to implement microprocessor based emulation thereof |
JPS6017539A (en) * | 1983-07-11 | 1985-01-29 | Hitachi Ltd | Emulation system |
US5329471A (en) * | 1987-06-02 | 1994-07-12 | Texas Instruments Incorporated | Emulation devices, systems and methods utilizing state machines |
US6522985B1 (en) * | 1989-07-31 | 2003-02-18 | Texas Instruments Incorporated | Emulation devices, systems and methods utilizing state machines |
US4951195A (en) * | 1988-02-01 | 1990-08-21 | International Business Machines Corporation | Condition code graph analysis for simulating a CPU processor |
CA2002201C (en) * | 1988-12-06 | 1999-04-27 | John Charles Goettelmann | Translation technique |
US5313614A (en) * | 1988-12-06 | 1994-05-17 | At&T Bell Laboratories | Method and apparatus for direct conversion of programs in object code form between different hardware architecture computer systems |
US5077657A (en) * | 1989-06-15 | 1991-12-31 | Unisys | Emulator Assist unit which forms addresses of user instruction operands in response to emulator assist unit commands from host processor |
US5805792A (en) * | 1989-07-31 | 1998-09-08 | Texas Instruments Incorporated | Emulation devices, systems, and methods |
JPH04229337A (en) * | 1990-12-27 | 1992-08-18 | Hitachi Ltd | Emulator |
US5598560A (en) * | 1991-03-07 | 1997-01-28 | Digital Equipment Corporation | Tracking condition codes in translation code for different machine architectures |
US5507030A (en) * | 1991-03-07 | 1996-04-09 | Digitial Equipment Corporation | Successive translation, execution and interpretation of computer program having code at unknown locations due to execution transfer instructions having computed destination addresses |
DE69226093T2 (en) * | 1991-03-07 | 1999-02-25 | Digital Equipment Corp., Maynard, Mass. | Method and device for processing computer code in a code translator |
US5630157A (en) * | 1991-06-13 | 1997-05-13 | International Business Machines Corporation | Computer organization for multiple and out-of-order execution of condition code testing and setting instructions |
US5440702A (en) * | 1992-10-16 | 1995-08-08 | Delco Electronics Corporation | Data processing system with condition code architecture for executing single instruction range checking and limiting operations |
AU6629894A (en) * | 1993-05-07 | 1994-12-12 | Apple Computer, Inc. | Method for decoding guest instructions for a host computer |
US6126329A (en) * | 1993-06-08 | 2000-10-03 | Rational Software Coporation | Method and apparatus for accurate profiling of computer programs |
US5999737A (en) * | 1994-03-01 | 1999-12-07 | Digital Equipment Corporation | Link time optimization via dead code elimination, code motion, code partitioning, code grouping, loop analysis with code motion, loop invariant analysis and active variable to register analysis |
US5574927A (en) * | 1994-03-25 | 1996-11-12 | International Meta Systems, Inc. | RISC architecture computer configured for emulation of the instruction set of a target computer |
US5481719A (en) * | 1994-09-09 | 1996-01-02 | International Business Machines Corporation | Exception handling method and apparatus for a microkernel data processing system |
US5751982A (en) * | 1995-03-31 | 1998-05-12 | Apple Computer, Inc. | Software emulation system with dynamic translation of emulated instructions for increased processing speed |
US5737631A (en) * | 1995-04-05 | 1998-04-07 | Xilinx Inc | Reprogrammable instruction set accelerator |
US6076155A (en) * | 1995-10-24 | 2000-06-13 | S3 Incorporated | Shared register architecture for a dual-instruction-set CPU to facilitate data exchange between the instruction sets |
US6077314A (en) * | 1995-12-06 | 2000-06-20 | International Business Machines Corporation | Method of, system for, and computer program product for providing improved code motion and code redundancy removal using extended global value numbering |
US6105124A (en) * | 1996-01-26 | 2000-08-15 | Intel Corporation | Method and apparatus for merging binary translated basic blocks of instructions |
US6000028A (en) * | 1996-01-29 | 1999-12-07 | Digital Equipment Corporation | Means and apparatus for maintaining condition codes in an unevaluated state |
US6091897A (en) * | 1996-01-29 | 2000-07-18 | Digital Equipment Corporation | Fast translation and execution of a computer program on a non-native architecture by use of background translator |
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 |
US6199095B1 (en) * | 1996-01-29 | 2001-03-06 | Compaq Computer Corporation | System and method for achieving object method transparency in a multi-code execution environment |
US5930509A (en) * | 1996-01-29 | 1999-07-27 | Digital Equipment Corporation | Method and apparatus for performing binary translation |
US6330691B1 (en) * | 1996-02-23 | 2001-12-11 | Institute For The Development Of Emerging Architectures Llc | Use of dynamic translation to provide breakpoints in non-writeable object code |
US5901308A (en) * | 1996-03-18 | 1999-05-04 | Digital Equipment Corporation | Software mechanism for reducing exceptions generated by speculatively scheduled instructions |
US5946491A (en) * | 1996-06-06 | 1999-08-31 | International Business Machines Corporation | Register allocation method and apparatus for gernerating spill code as a function of register pressure compared to dual thresholds |
US5903760A (en) * | 1996-06-27 | 1999-05-11 | Intel Corporation | Method and apparatus for translating a conditional instruction compatible with a first instruction set architecture (ISA) into a conditional instruction compatible with a second ISA |
US5890000A (en) * | 1996-12-04 | 1999-03-30 | International Business Machines Corporation | Cooperation of global and local register allocators for better handling of procedures |
US5925124A (en) * | 1997-02-27 | 1999-07-20 | International Business Machines Corporation | Dynamic conversion between different instruction codes by recombination of instruction elements |
US6031994A (en) * | 1997-04-01 | 2000-02-29 | Intel Corporation | Method for determining the set of variables that may be ambiguously defined at a point in a computer program |
JP3327818B2 (en) * | 1997-08-29 | 2002-09-24 | 松下電器産業株式会社 | Program conversion device and recording medium |
US5870575A (en) * | 1997-09-22 | 1999-02-09 | International Business Machines Corporation | Indirect unconditional branches in data processing system emulation mode |
US5956495A (en) * | 1997-09-22 | 1999-09-21 | International Business Machines Corporation | Method and system for processing branch instructions during emulation in a data processing system |
US6505296B2 (en) * | 1997-10-13 | 2003-01-07 | Hewlett-Packard Company | Emulated branch effected by trampoline mechanism |
US6185675B1 (en) * | 1997-10-24 | 2001-02-06 | Advanced Micro Devices, Inc. | Basic block oriented trace cache utilizing a basic block sequence buffer to indicate program order of cached basic blocks |
US6170083B1 (en) * | 1997-11-12 | 2001-01-02 | Intel Corporation | Method for performing dynamic optimization of computer code |
US6009261A (en) * | 1997-12-16 | 1999-12-28 | International Business Machines Corporation | Preprocessing of stored target routines for emulating incompatible instructions on a target processor |
US6631514B1 (en) * | 1998-01-06 | 2003-10-07 | Hewlett-Packard Development, L.P. | Emulation system that uses dynamic binary translation and permits the safe speculation of trapping operations |
US6530078B1 (en) * | 1998-03-26 | 2003-03-04 | Alexander V. Shmid | Virtual machines in OS/390 for execution of any guest system |
US6205545B1 (en) * | 1998-04-30 | 2001-03-20 | Hewlett-Packard Company | Method and apparatus for using static branch predictions hints with dynamically translated code traces to improve performance |
US6434741B1 (en) * | 1998-04-30 | 2002-08-13 | Hewlett-Packard Company | Method and apparatus for debugging of optimized code using emulation |
US6427234B1 (en) * | 1998-06-11 | 2002-07-30 | University Of Washington | System and method for performing selective dynamic compilation using run-time information |
US6360194B1 (en) * | 1998-09-08 | 2002-03-19 | Bull Hn Information Systems Inc. | Different word size multiprocessor emulation |
US6223339B1 (en) * | 1998-09-08 | 2001-04-24 | Hewlett-Packard Company | System, method, and product for memory management in a dynamic translator |
US6301705B1 (en) * | 1998-10-01 | 2001-10-09 | Institute For The Development Of Emerging Architectures, L.L.C. | System and method for deferring exceptions generated during speculative execution |
US6308318B2 (en) * | 1998-10-07 | 2001-10-23 | Hewlett-Packard Company | Method and apparatus for handling asynchronous exceptions in a dynamic translation system |
US20020147969A1 (en) * | 1998-10-21 | 2002-10-10 | Richard A. Lethin | Dynamic optimizing object code translator for architecture emulation and dynamic optimizing object code translation method |
EP0997815A3 (en) * | 1998-10-29 | 2004-05-26 | Texas Instruments Incorporated | Interactive translation system and method |
US6539471B2 (en) * | 1998-12-23 | 2003-03-25 | Intel Corporation | Method and apparatus for pre-processing instructions for a processor |
US6321379B1 (en) * | 1998-12-23 | 2001-11-20 | Cray Inc. | Method and system for target register allocation |
US6594824B1 (en) * | 1999-02-17 | 2003-07-15 | Elbrus International Limited | Profile driven code motion and scheduling |
US6530079B1 (en) * | 1999-06-02 | 2003-03-04 | International Business Machines Corporation | Method for optimizing locks in computer programs |
US6539541B1 (en) * | 1999-08-20 | 2003-03-25 | Intel Corporation | Method of constructing and unrolling speculatively counted loops |
US6523173B1 (en) * | 2000-01-11 | 2003-02-18 | International Business Machines Corporation | Method and apparatus for allocating registers during code compilation using different spill strategies to evaluate spill cost |
US6526572B1 (en) * | 2000-02-09 | 2003-02-25 | Hewlett-Packard Company | Mechanism for software register renaming and load speculation in an optimizer |
US6643630B1 (en) * | 2000-04-13 | 2003-11-04 | Koninklijke Philips Electronics N.V. | Apparatus and method for annotating an intermediate representation of an application source code |
US6564297B1 (en) * | 2000-06-15 | 2003-05-13 | Sun Microsystems, Inc. | Compiler-based cache line optimization |
US6549987B1 (en) * | 2000-11-16 | 2003-04-15 | Intel Corporation | Cache structure for storing variable length data |
GB0202728D0 (en) * | 2002-02-06 | 2002-03-27 | Transitive Technologies Ltd | Condition code flag emulation for program code conversion |
-
2002
- 2002-02-06 GB GBGB0202728.2A patent/GB0202728D0/en not_active Ceased
- 2002-12-05 US US10/314,179 patent/US20030149963A1/en not_active Abandoned
-
2003
- 2003-02-06 GB GB0302718A patent/GB2388218B/en not_active Expired - Lifetime
- 2003-02-06 JP JP2003029240A patent/JP4911868B2/en not_active Expired - Fee Related
- 2003-12-19 HK HK03109256A patent/HK1056933A1/en not_active IP Right Cessation
-
2007
- 2007-12-14 US US11/957,343 patent/US8024555B2/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020026633A1 (en) * | 1991-04-23 | 2002-02-28 | Shinobu Koizumi | Retargetable information processing system |
US5768593A (en) * | 1996-03-22 | 1998-06-16 | Connectix Corporation | Dynamic cross-compilation system and method |
US5805895A (en) * | 1996-06-09 | 1998-09-08 | Motorola, Inc. | Method and apparatus for code translation optimization |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080177985A1 (en) * | 2002-02-06 | 2008-07-24 | Transitive Limited | Condition code flag emulation for program code conversion |
US8024555B2 (en) * | 2002-02-06 | 2011-09-20 | International Business Machines Corporation | Condition code flag emulation for program code conversion |
US20040176941A1 (en) * | 2003-03-04 | 2004-09-09 | Shan-Chyun Ku | Method of simulating computation instructions for an instruction set simulator |
US20080034188A1 (en) * | 2006-08-03 | 2008-02-07 | Nec Corporation | Information processing apparatus and method for accelerating information processing |
US7886133B2 (en) * | 2006-08-03 | 2011-02-08 | Nec Corporation | Information processing apparatus and method for accelerating information processing |
US20100268916A1 (en) * | 2007-12-29 | 2010-10-21 | Institute Of Computing Technology Of The Chinese Academy Of Sciences | Risc processor and its register flag bit processing method |
US9189232B2 (en) * | 2007-12-29 | 2015-11-17 | Loongson Technology Corporation Limited | RISC processor and its register flag bit processing method |
US20120180039A1 (en) * | 2011-01-11 | 2012-07-12 | International Business Machines Corporation | Automated Deployment of Applications with Tenant-Isolation Requirements |
US9104514B2 (en) * | 2011-01-11 | 2015-08-11 | International Business Machines Corporation | Automated deployment of applications with tenant-isolation requirements |
US11966727B2 (en) | 2016-03-11 | 2024-04-23 | Lzlabs Gmbh | Load module compiler |
Also Published As
Publication number | Publication date |
---|---|
GB2388218A (en) | 2003-11-05 |
JP4911868B2 (en) | 2012-04-04 |
JP2004038923A (en) | 2004-02-05 |
GB0202728D0 (en) | 2002-03-27 |
HK1056933A1 (en) | 2004-03-05 |
US20080177985A1 (en) | 2008-07-24 |
GB2388218B (en) | 2005-01-26 |
US8024555B2 (en) | 2011-09-20 |
GB0302718D0 (en) | 2003-03-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20030149963A1 (en) | Condition code flag emulation for program code conversion | |
US7331040B2 (en) | Condition code flag emulation for program code conversion | |
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 | |
KR100463810B1 (en) | Memory controller for a microprocessor for detecting a failure of speculation on the physical nature of a component being addressed | |
US6009261A (en) | Preprocessing of stored target routines for emulating incompatible instructions on a target processor | |
EP2324424B1 (en) | Apparatus and method for handling page protection faults in a computing system | |
EP2267598B1 (en) | Risc processor apparatus and method for supporting x86 virtual machine | |
EP0817996B1 (en) | Software emulation system with dynamic translation of emulated instructions for increased processing speed | |
KR100816781B1 (en) | Data Processing Using Multiple Instruction Sets | |
US8578351B2 (en) | Hybrid mechanism for more efficient emulation and method therefor | |
KR100443759B1 (en) | Improved microprocessor | |
US8364461B2 (en) | Reusing invalidated traces in a system emulator | |
JP2001504957A (en) | Memory data aliasing method and apparatus in advanced processor | |
JPH0782441B2 (en) | Simulation method | |
JP2001507151A (en) | Gate storage buffers for advanced microprocessors. | |
US7171543B1 (en) | Method and apparatus for executing a 32-bit application by confining the application to a 32-bit address space subset in a 64-bit processor | |
US5764962A (en) | Emulation of asynchronous signals using a branch mechanism | |
US7809547B2 (en) | Host computer system emulating target system legacy software and providing for incorporating more powerful application program elements into the flow of the legacy software | |
KR100421687B1 (en) | Translated memory protection apparatus for an advanced microprocessor | |
KR100864891B1 (en) | Raw Operation Processing in Multiple Instruction Set Systems | |
US20050216713A1 (en) | Instruction text controlled selectively stated branches for prediction via a branch target buffer | |
US5732235A (en) | Method and system for minimizing the number of cycles required to execute semantic routines | |
US6467037B1 (en) | Utilizing a program counter with one or more data counters for executing instructions | |
US7069205B1 (en) | System and method for emulating the operation of a video graphics adapter | |
US10133655B1 (en) | Emulation of target system using JIT compiler and bypassing translation of selected target code blocks |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
AS | Assignment |
Owner name: TRANSITIVE TECHNOLOGIES LIMITED, UNITED KINGDOM Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:SANDHAM, JOHN;NORTH, GERAINT M.;REEL/FRAME:013752/0793 Effective date: 20030203 |
|
AS | Assignment |
Owner name: TRANSITIVE LIMITED, UNITED KINGDOM Free format text: CHANGE OF NAME;ASSIGNOR:TRANSITIVE TECHNOLOGIES LIMITED;REEL/FRAME:017940/0686 Effective date: 20030620 |
|
STCB | Information on status: application discontinuation |
Free format text: ABANDONED -- FAILURE TO RESPOND TO AN OFFICE ACTION |
|
AS | Assignment |
Owner name: IBM UNITED KINGDOM LIMITED, ENGLAND Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:TRANSITIVE LIMITED;REEL/FRAME:022824/0715 Effective date: 20090529 Owner name: IBM UNITED KINGDOM LIMITED,ENGLAND Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:TRANSITIVE LIMITED;REEL/FRAME:022824/0715 Effective date: 20090529 |
|
AS | Assignment |
Owner name: IBM CORPORATION, NEW YORK Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:IBM UNITED KINGDOM LIMITED;REEL/FRAME:022928/0190 Effective date: 20090626 Owner name: IBM CORPORATION,NEW YORK Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:IBM UNITED KINGDOM LIMITED;REEL/FRAME:022928/0190 Effective date: 20090626 |
|
AS | Assignment |
Owner name: INTERNATIONAL BUSINESS MACHINES CORPORATION, NEW Y Free format text: CORRECTIVE ASSIGNMENT TO CORRECT THE ASSIGNEE NAME PREVIOUSLY RECORDED ON REEL 022928 FRAME 0190. ASSIGNOR(S) HEREBY CONFIRMS THE RECEIVING PARTY;ASSIGNOR:IBM UNITED KINGDOM LIMITED;REEL/FRAME:031085/0824 Effective date: 20090626 |