Method and device for generating registration data at...

Data processing: software development – installation – and managem – Software program development tool – Testing or debugging

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

C717S148000, C717S162000

Reexamination Certificate

active

06732355

ABSTRACT:

DETAILED DESCRIPTION OF THE INVENTION
1. Field of the Invention
The present invention relates to a compile method and a method for tracing a stack.
2. Background of the Invention
Presently, Java™ is widely used, not only as a common language for network computing but also as a standard language of object-oriented languages not dependent on any platform. A program written in Java™ is translated into a bytecode which is executed by a Java™ viitual machine. Accordingly, a program once written in Java™ has an advantage that is operates on any computer supporting Java™ regardless of its CPU (multi-platform).
Despite these advantages, execution of a bytecode by a virtual machine is inferior to direct execution of a machine language code in terms of execution performance. Thus, in general, the bytecode is translated into a machine language code (hereafter, referred to as “JITed code”) by a JIT compiler during operation of a Java™ program so as to execute a JITed code instead of a bytecode. The minimum unit of compilation is a subroutine called a method. A frequently executed code is translated into a machine language so that performance of a machine language code may be exploited while preserving multi-platform characteristics of a Java™ bytecode.
A JITed code for a method is equal to an optimization code generated by C compiler and so on the point of being a code suited to a CPU on which a program operates. In general, in the currently popular CPUS, if a subroutine is invoked, the subroutine forms on a stack an area for storing a local variable to be used by itself (referred to as a “frame”).
FIG. 1
shows a state of a stack when subroutine A has invoked subroutine B and subroutine B has invoked subroutine C. In this drawing, the stack extends upward. The areas represent respective frames of the subroutines. Stack pointer SP points to the top of this stack, namely the top of frame C. If subroutine C further invokes subroutine D, a frame of subroutine D is newly formed from the current SP and the SP points to the top of the frame again. When returning from each subroutine, its frame is removed. For instance, in returning from subroutine D to subroutine C, the frame of subroutine D is removed before returning and the SP returns to the value when subroutine C invoked subroutine D and points to the top of frame C again. In the case of Java™, CPU resources are allocated to each executable unit called a thread which has its own stack (referred to as a “thread stack”). A JITed code creates the above-mentioned frame (hereafter referred to as “JITed frame”) on a thread stack.
It is not only a JITed frame that is in a thread stack. A JITed code invokes various service routines provided by a Java™ virtual machine. There are also service routines which further activate a new Java™ virtual machine.
FIG. 2
shows a state in which frames of a JITed code and other codes are mixed in a thread stack. The portions with alphabetic characters are JITed frames.
A base pointer is usually used for tracing a stack. For instance, base pointer EBP of x86 (herein EBP) always holds a base address of a current frame in a stack to facilitate detection of a frame in a stack. For instance, in the case of debugging a C program and the like, it is helpful to know invocation relationship of a method by tracing a stack. A frame chain by EBP is often used for this purpose.
As a general compiler optimization technique, particularly an important one for an x86 architecture, which has a smaller number of registers, there is omission of a base pointer. In the above-mentioned example of a C program, when debugging has ended and a final code is to be built, optimization is performed by releasing EBP from a frame chain so that maintenance overhead of the frame chain decreases to allow an EBP register to be allocated as a general register. Thus, a fast code may be generated. This optimization is possible in a language like C, certainly because it is not necessary to trace a stack at a runtime.
In Java™ JIT compiler, such omission of a base pointer is difficult. It is because, in the language specifications of Java™, classLoaderDepth( ) of Java.lang.SecurityManager, countStackFrames( ) of Java.lang.Thread and the like require a function equal to tracing a stack. In addition, there is also necessity of storing in an exception object a stack trace of the time when an exception occurs. These do not function if a base pointer is omitted.
Apart from the above, there is also a cause in a mechanism of JITed code discarding which makes omission of a base pointer difficult. There are cases where, if the memory used by a JIT compiler including a JiTed code is limited or to be limited, only class unload is not sufficient. For instance, in a desktop environment where operation is on a thin client without any virtual memory by a hard disk such as a network computing machine (hereafter, an “NC machine”), multiple Java™ applications such as a mail, a word processor, a scheduler, and the like are simultaneously activated and thousands of methods may be invoked, though a significant percentage of those methods are not present (are not active) in each thread stack. Since class unload only discards a class and its method with no possibility of being used in a Java™ system, a JITed code of such a nonactive method is not discarded. Thus, a JIT compiler has a mechanism of JITed code discarding, which locates an active method in any thread stack and discards a nonactive method (or part of it) to set memory free. To discover an active method correctly and fast, a frame chain to couple only JITed code frames is indispensable.
An object of the present invention is to enable a trace of a stack even in a state where the base pointer is omitted.
SUMMARY OF THE INVENTION
At a compilation time in the present invention, a process is performed: for storing into a storage during a compilation of a method, pairs of an address of a code and information concerning a size of a stack frame after a stack pointer is moved, the code causing an address of the stack pointer to be changed; and for registering a table which is constituted by the pairs and an initial frame size with correspondence to the compiled method. While information of a stack frame size after change is suitably the amount of change in the stack pointer from the initial frame size, it may be the stack frame size itself after the change. In the former case, the table includes the initial frame size, or the initial frame size is provided separately.
If a pause is taken and a trace is performed when such a process is performed at a compilation time and a JITed code is executed in a suitable form, the steps are taken for: obtaining and storing into a storage, an address of an execution code and an address of a stack pointer at a temporary pause for a trace; and calculating and storing into a storage, a base address which is to be pointed by a base pointer by using the address of the execution code, the address of the stack pointer, and the table for the method including the execution code.
On the other hand, if a pause is taken and a trace is performed when a JITed last frame record mode (a mode wherein, if a first method compiled by a predetermined compiler has invoked a second method not compiled by a predetermined compiler, a record pointing to a stack frame of the first method is generated) is adopted in a suitable form and a non-JITed code is executed in a suitable form, the steps are taken for: obtaining and storing into a storage, an address of the stack frame of the first method referring to the record and an execution restarting address which maintained in the stack frame of the first method; and calculating and storing into a storage, a base address which is to be pointed by a base pointer by using the address of the stack frame of the first method, the execution restarting address and the table for the first method.
Thus, tracing a stack is possible even if optimization without the base pointer is performed. Accordingly, the above-mentioned problem of the language specifications of Java™ is s

LandOfFree

Say what you really think

Search LandOfFree.com for the USA inventors and patents. Rate them and share your experience with other people.

Rating

Method and device for generating registration data at... 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 device for generating registration data at..., we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Method and device for generating registration data at... will most certainly appreciate the feedback.

Rate now

     

Profile ID: LFUS-PAI-O-3222386

  Search
All data on this website is collected from public sources. Our data reflects the most accurate information available at the time of publication.