Dynamic translation is used during debugging of a computer application process. During runtime, the first application is dynamically translated to produce translated code. Debugging code, such as a conditional breakpoint, may then be added to the translated code.
Apparatus and method are described for fast code coverage analysis. The present invention for fast code coverage analysis utilizes a technique that provides for capturing an event every first time that a block of code is visited. This allows for generating an event only once during numerous executions of a code block. The generation of only one event provides for an execution time close to the speed of the original source code.
A method and system of dynamically translating code that uses code annotations to determine whether the dynamic translator must fully materialize machine state. At compilation time, annotations are placed in an application's executable file indicating the number of formal parameters expected by each of the application's entry points. When the application is dynamically translated, the dynamic translation system (DTS) aggressively translates the application. Therefore, the DTS does not generate instructions for materializing the machine state at potential stopping points. When the application makes a system call that arms an exception handler, the DTS looks to the annotations to determine the number of formal parameters expected by the handler. If an exception handler expects two or fewer parameters, then that handler does not use the machine state. Conversely, if a handler expects three or more parameters, then that handler may use the machine state. Therefore, if the handler only has two formal parameters, then the DTS continues to aggressively translate the application program. Otherwise, the DTS discards all of the previously translated code and starts conservatively translating the application.
A method of interpreting a program and performing time consuming operations at various times in a manner whereby the probability that a user of the program perceives any delay in the execution of the program is minimized. A time consuming operation as used herein is one which may take an interpreter from a fraction of a second to several seconds to perform, depending on the process. The method includes determining when a block will occur during the execution of the program. A block is a period of time that an operating system will halt a running of the program. Next it is determined whether or not to perform the time consuming operation based upon a criteria which depends on a length of time that the program is blocked. If it is blocked for a required time, the time consuming operation is performed, otherwise the interpreter will wait to perform the time consuming operation.
A method and system of dynamically translating code that uses code annotations to determine whether the dynamic translator must fully materialize machine state. At compilation time, annotations are placed in an application's executable file indicating the number of formal parameters expected by each of the application's entry points. When the application is dynamically translated, the dynamic translation system (DTS) aggressively translates the application. Therefore, the DTS does not generate instructions for materializing the machine state at potential stopping points. When the application makes a system call that arms an exception handler, the DTS looks to the annotations to determine the number of formal parameters expected by the handler. If an exception handler expects two or fewer parameters, then that handler does not use the machine state. Conversely, if a handler expects three or more parameters, then that handler may use the machine state. Therefore, if the handler only has two formal parameters, then the DTS continues to aggressively translate the application program. Otherwise, the DTS discards all of the previously translated code and starts conservatively translating the application.
A dynamic translation system is configured to translate existing code into translated code which is compatible with a particular computer system. As the dynamic translation system translates the existing code, the computer system executes the translated code. Once a synchronous fault occurs, the dynamic translation system retranslates the block of code containing the synchronous fault and saves the instruction and state mappings for each instruction capable of causing the synchronous fault. Once the instruction causing the synchronous fault is reached during the retranslation process, the dynamic translation system combines the saved instruction and state mappings of the instruction causing the synchronous error with the current machine state of the computer system to form a simulated machine state. This simulated machine state represents the machine state that would have existed at the time of the synchronous fault if the original code were executing, instead of the translated code. Through techniques known in the art, the computer system utilizes the simulated machine state in order to appropriately process the synchronous fault.