Data processing: software development – installation – and managem – Software program development tool – Translation of code
Reexamination Certificate
1998-10-07
2001-10-23
Chaki, Kakali (Department: 2122)
Data processing: software development, installation, and managem
Software program development tool
Translation of code
C717S152000, C712S227000
Reexamination Certificate
active
06308318
ABSTRACT:
TECHNICAL FIELD OF THE INVENTION
The present invention relates to dynamic translation systems which translate input object code designed for use in one environment into output object code for use in another environment. More particularly, the present invention relates to a method and apparatus for asynchronous exception handling in such a dynamic translation system.
BACKGROUND OF THE INVENTION
Dynamic translation systems translate input object code native to one computer system into output object code native to another computer system. A typical use of a dynamic translation system is to transparently migrate old software into a new platform that can be executed on a new machine. Other uses of dynamic translation systems include collecting instrumentation information, translating object code intended for use with a particular hardware implementation into object code that can be used with a different hardware implementation, and translating slow object code into fast object code by optimizing the code based on execution profile information. Unlike a compiler, which translates source code into executable code before run time, a dynamic translator translates the input object code into the output object code during run time, i.e., on the fly.
One of the more difficult tasks performed in a dynamic translation system is the handling of asynchronous exceptions. Asynchronous exceptions are events which interrupt the flow of control of a program in order to handle an externally triggered event. When an asynchronous exception occurs, the dynamic translation system must simulate, during the execution of the translated application code, the handling of the asynchronous exception by the input application code. This is a difficult task and is further complicated due to the fact that asynchronous exceptions can occur at any time.
Oftentimes, a single instruction in the input object code may be translated into multiple instructions in the output object code. It is possible that an asynchronous exception or event will occur during the translation of an instruction in the input object code into multiple instructions in the output object code. For example, in the case where an instruction in the input object code is mapped into three instructions in the output object code, it is possible that an asynchronous event will occur after the first instruction in the native object code has been produced, but before the second instruction in the native object code has been produced. Since an asynchronous exception handler must be provided with an accurately reconstructed application context, the asynchronous exception handler cannot be provided with the reconstructed application context before all of the instructions in the output object code which correspond to the single instruction in the input object code have been translated.
FIGS. 1A and 1B
illustrate exception handling during normal execution of an application program
1
and during translation of application program
1
in a dynamic translation system, respectively.
FIG. 1A
depicts a program
1
being executed by hardware
2
running operating system
3
. When an asynchronous event
6
occurs during execution of the instructions comprised by the program
1
, the normal flow of control of execution is transferred, as indicated by arrow
8
, from the point of interruption
5
to the event handler routine
7
comprised by the program
1
. The input to the event handler routine
7
corresponds to the instruction pointer at the point of interruption
5
and the hardware register state at the point of interruption. Both of these inputs must be correct in order for the exception to be correctly handled by the event handler routine
7
. Once the exception has been handled by the event handler routine
7
, execution resumes from the point of interruption
5
in accordance with the normal flow of control of execution.
FIG. 1B
illustrates the situation where translated code contained in a code cache memory device
9
of a dynamic translation system
10
is interrupted by an asynchronous event
11
during dynamic translation execution. Control is then transferred, as indicated by arrow
12
, to the event handler routine
7
of the application program
1
. Since there is not necessarily a 1-to-1mapping between the code of the untranslated program
1
and the translated code in the code cache memory
9
, the point of interruption, as well as the hardware register state at the point of interruption, input to the event handler routine
7
will be different than if the asynchronous event had occurred during normal execution of the program
1
in the manner shown in FIG.
1
A. If control is transferred in this manner, the event handler routine
7
will behave incorrectly and will produce an incorrect result before returning to the point of interruption in the code cache memory
9
.
Therefore, the dynamic translation system
10
must intercept the asynchronous event and recover the register state and instruction pointer at the time of the event before transferring control to the event handler routine
7
. The register state and instruction pointer cannot be recovered at arbitrary points in the instruction stream because it is not guaranteed that the state of the hardware register and the value of the instruction pointer will be correct at arbitrary points. When an asynchronous event occurs at an arbitrary point in the code cache memory
9
, the instruction pointer is pointing to a translated code location. However, when the asynchronous event occurs at a point in the program code
1
, the instruction pointer is pointing to a location in the program code
1
which may not be the same as the location in the translated code.
Various approaches have been used in conjunction with dynamic translation execution to ensure that the reconstructed application context (i.e., the hardware register state and the instruction pointer) is correct when control is transferred to an asynchronous exception handler. These approaches utilize guaranteed application state recoverable points, hereinafter referred to as GAR points, which are points programmed into the translated code, usually at the end of a translated block. These prior approaches record the occurrence of an asynchronous exception and continue execution of instructions from the point of interruption until a GAR point dynamically following the point of interruption has been reached. The application context is always accurate at the GAR point. Therefore, when a GAR point is reached in the instruction stream, control is transferred to the asynchronous exception handler.
Buzbee, U.S. Pat. No. 5,764,962, discloses a dynamic translation system which utilizes a branch-target register which is globally-allocated and which contains an address of an asynchronous signal handler. When a determination is made that an asynchronous signal has arrived, the dynamic translation system records the event and sets a Boolean flag in a globally-allocated predicate register to indicate that an asynchronous signal has arrived. Translation is then resumed from the point of interruption. When the translation reaches a “transfer of control operation” inside a block of code, the transfer of control operation uses as a predicate the contents of the predicate register and branches to an address stored in the branch-target register when the bit in the predicate register is set.
All of the prior approaches for handling asynchronous exceptions, including the approach disclosed in the Buzbee patent, detect when an asynchronous exception has occurred, record the asynchronous exception, continue execution until a GAR point is reached, and transfer control to the asynchronous exception handler for servicing the asynchronous event when the GAR point is reached. These GAR points correspond to instructions embedded in the translated code which correspond to locations in the instruction flow where state can be recovered. In addition, the GAR points often include instructions which cause the dynamic translation system to check to determine whether an asynchronou
Chaki Kakali
Hewlett--Packard Company
Nguyen-Ba Hoang-Vu Antony
LandOfFree
Method and apparatus for handling asynchronous exceptions in... does not yet have a rating. At this time, there are no reviews or comments for this patent.
If you have personal experience with Method and apparatus for handling asynchronous exceptions in..., we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Method and apparatus for handling asynchronous exceptions in... will most certainly appreciate the feedback.
Profile ID: LFUS-PAI-O-2611443