Program conversion apparatus

Data processing: software development – installation – and managem – Software program development tool – Translation of code

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

C717S136000, C717S137000, C717S139000

Reexamination Certificate

active

06675377

ABSTRACT:

This application is based on an application No. 11-259542 filed in Japan, the content of which is hereby incorporated by reference.
BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention relates to a program conversion apparatus for converting a source program written in an object-orientated language into an executable program.
2. Description of the Prior Art
The use of object-orientated languages such as C++ and Java (Java is a trademark of Sun Microsystems) in recent software development has caused program development to proceed at an increasingly higher pace.
Such object-orientated languages introduce the concept of a ‘class’, an abstract data type that binds together a data structure, made up of a set of variables, with a set of routines, performing processing using the data expressed by the data structure. In C++, the data structure is known as a ‘data member’ and the routine as a ‘member function’.
Files
901
and
902
in
FIG. 23
show examples of class definitions based on the C++ standard. In the drawing, file
901
includes class definitions
911
and
912
and file
902
include a class definition
913
.
The class definition
911
in file
901
includes lines
920
to
924
. Line
920
declares the start of the class definition
911
and indicates that its class name is X. Line
921
shows a declaration of a data member, and indicates that class X has an int type member x as a data member. Lines
922
to
924
are declarations of member functions. Line
922
shows that class X has a member function f that has no argument and does not return a return value. Line
923
shows that class X has a function g that has an int type argument and returns an int type return value. Line
924
shows that class X has a function h that has an int type argument and does not return a return value.
The keyword virtual written at the start of the declarations for functions g and h in lines
923
and
924
, is a keyword used in C++. This keyword indicates that the relevant member function is a special function known as a ‘virtual function’.
FIG. 24
shows the inheritance relationship between the three classes X, Y and Z shown in FIG.
23
. As shown in the drawing, class X is inherited by class Y, and class Y by class Z. Here, class X is described as the base class of class Y, and class Y as a derived class of class X. Similarly, class Y is the base class of class Z, and class Z is a derived class of class Y. Furthermore, although class X is not directly inherited by class Z, it is indirectly inherited via class Y. Thus, class X may be referred to as an indirect base class of class Z and class Z as an indirect derived class of class X.
In languages such as C++ and Java, a pointer to a base class is assigned to an address of an object of the base class, so that the pointer to the base class indicates the object of the base class. Furthermore, the pointer to the base class is assigned to an address of an object of a derived class, so that the pointer to the base class can also indicate a derived class object. For example, the pointer to class X can indicate the object of class X, the object of class Y and the object of class Z. Similarly, the pointer to class Y can indicate the object of class Y and also the object of class Z.
In
FIG. 25
, line
951
shows that an object indicated by a pointer ptr_x belongs to one of the classes X, Y and Z, line
952
shows that an object indicated by a pointer ptr_y belongs to one of the classes Y and Z, and line
953
shows that an object indicated by a pointer ptr_z belongs to the class Z.
Here, a called function dynamically determined at execution according to the type of object shown by the pointer is referred to as a virtual function. An example of coding used when a function to be executed is dynamically determined by the object indicated by the pointer is shown in FIG.
26
.
In the drawing, line
961
shows that a function g is called via the pointer ptr_x to class X. When the pointer ptr_x indicates the object for class X, a function g in class X is executed, and when it indicates the object for class Z, a function g in class Z is executed. Line
962
shows that a function g is called via the pointer ptr_y to class Y. When the pointer ptr_y indicates the object for class Y, a function g in class Y is executed, and when it indicates the object for class Z, a function g in class Z is executed. Line
963
shows that a function g is called via the pointer ptr_z to class Z, and executes a function g in class Z.
A declaration of a virtual function in a derived class, as in
FIG. 23
, lines
931
and
941
, must be performed using the same function name, argument type and return type as the virtual function declared in the base class.
In order to express this kind of special function call, a virtual function table is generated for a class when a virtual function is declared in that class. The virtual function table stores the addresses of all the virtual functions declared in the class. Furthermore, an object for a class in which a virtual function is declared holds a pointer to the virtual function table as one of its members. The pointer to the virtual function table is generated implicitly by a compiler.
FIG. 27
shows examples of objects for classes declaring a virtual functions and structures for virtual function tables. In an object obj_x
701
shown in
FIG. 27A
, an area
702
shown by a start address &obj_x stores a member x, and an area
703
shown by a next address &obj_x+4 stores a pointer to a virtual function table for class X. Furthermore, an area
712
shown by the pointer to the virtual function table for class X, is the start of a virtual function table
711
for class X. A start address of the virtual function table
711
, in other words an area
712
shown by _vtb
1
_X, stores an address of a virtual function g in class X. An area
713
shown by a next address _vtb
1
_X+4 stores an address of a virtual function h in class x.
Furthermore,
FIG. 27B
similarly shows an object obje_y
721
of class Y, structured from an area
722
storing a member x, an area
723
storing a pointer to a virtual function table for class Y, and an area
724
storing a member y. A virtual function table
731
for class Y is structured from an area
732
storing an address of a virtual function g in class Y, and an area
733
storing an address of a virtual function h in class Y.
FIG. 27C
similarly shows an object obj_z
741
for class Z, structured from an area
742
storing a member x, an area
743
storing a pointer to a virtual function table for class Z, an area
744
storing a member y, and an area
745
storing a member z. A virtual function table
751
for class Z is structured from an area
752
storing an address of a virtual function g in class Z, and an area
753
storing an address of a virtual function h in class Z.
Calling virtual functions is performed in the following way.
First, a pointer to a virtual function table in an object is obtained. Next, a pointer to a call function is obtained from the virtual function table. Finally, the function is called indirectly using the pointer to the function.
If the pointer to class X indicates the object for class X when this processing is performed, a virtual function in class X is called, since the pointer to the virtual function table indicates a virtual function table for class X. If the pointer indicates the object for class Y, the pointer to the virtual function table indicates a virtual function table for class Y, so a virtual function in class Y is called. If, however, the pointer indicates the object for class Z, the pointer to the virtual function table indicates a virtual function table for class Z, so a virtual function in class Z is called.
FIG. 28A
shows a source program
781
for calling a virtual function using C++, and
FIG. 28B
shows an executable program
791
generated based on the source program
781
. In the drawing, line
782
shows a call for a function g via a pointer ptr_z to class

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

Program conversion apparatus does not yet have a rating. At this time, there are no reviews or comments for this patent.

If you have personal experience with Program conversion apparatus, we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Program conversion apparatus will most certainly appreciate the feedback.

Rate now

     

Profile ID: LFUS-PAI-O-3228328

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