Method and mechanism for invocation on objects with...

Electrical computers and digital processing systems: multicomput – Computer-to-computer data routing – Least weight routing

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

Reexamination Certificate

active

06412019

ABSTRACT:

BACKGROUND OF THE INVENTION
1. Field of the Invention
The invention relates to the field of object-oriented programming. More particularly, the invention relates to invocation on objects with interface inheritance.
2. Description of Related Art
Object-oriented programming is a method of software design implementation in which programs are organized as cooperative collections of objects. An object is a region of storage in a program and has a state, a behavior and an identity. Each object represents an instance of some class. A class is a set of objects that share a common structure and a common behavior. In an object-oriented programming language such as C++, a class is a user-defined type. A class declaration specifies the set of operations that can be applied to objects of the class.
An inheritance relationship unites a hierarchy of classes of a given program. A class can be derived from another class, and a class from which another class is derived is called a base class of the derived class. Further, a class may be derived from more than one class and inherits the operations and representation of each base class from which it is derived.
Given an object of some class, determining and choosing how to perform a dispatch (look-up) to the methods of the inherited classes is a problem. “Method” is a term which comes from Smalltalk, an object-oriented programming language, and is equivalent to “member functions” in C++. “Method” represents an operation declared as a member of a class.
In an interface inheritance, interfaces only inherit the definition of operations from other interfaces. In an implementation inheritance, interfaces inherit both the definition of the operation as well as the implementation of the operation from a base class definition. C++ uses implementation inheritance. Most C++ commercial products (compilers) use the concept of a vtable. A vtable is defined when an object is created, and has an entry for each method for each object requiring a dispatch to a possibly inherited implementation. A vtable typically consists of a list of pointers to methods. A Vtable typically also contains pointers to vtables for each of its base classes.
FIG. 1
illustrates one vtable implementation. The vtable implementation consists of BMW part
32
and its vtables
34
,
35
and
36
. BMW part
32
is derived from Vptr MW part
30
, Vptr BW part
31
and Vptr W part
33
. Vptr MW part
30
and BW part
31
are derived from Vptr W part
33
. (See
The Annotated C++ Reference Manual
by Margaret A. Ellis and Bjarne Stroupstrup, Addison-Wesley Publishing Co., Massachusetts, p. 235 §10.10
c.
)
Disadvantages of using vtables are varied. Vtables for the base methods must be filled in to perform implementation inheritance. In addition, vtables for the base classes are specific for the derived class that the vtables are actually in and the base class that vtables are referring to. For each new derived class, a separate base vtable for each base class must be created. Thus, vtable implementation requires many vtables.
Further, the pointers to the vtables are typically mixed in with the data for the instance value variables of the classes themselves. In a typical vtable implementation, pointers point to the methods as well as the base object instances themselves which creates difficulty in moving the data structure from one address space to a different address space. Hence, the limitations of vtables include the lack of the ability to map object instances between address spaces and the number and complexity of the vtable entries.
SUMMARY OF THE INVENTION
The invention provides a method and apparatus for invocation of objects with interface inheritance. More specifically, the invention provides mtables as dispatch mechanism for object references that support only interface inheritance. An object reference using mtables contains two parts, more specifically, a pointer to the data for an object and a pointer to the methods on the object. The methods on the object are represented by a collection of mtables.
An mtable for a given interface consists of pointers to mtables for inherited interfaces and pointers to functions implementing the operations declared in the interface. An mtable pointer in an object reference points to an mtable for an apparent interface of the object reference. Mtables for any inherited interfaces are reached by indirection from the mtable for the apparent interface in the preferred embodiment.
Unlike vtables, the structure for an mtable is simple and may be implemented in essentially any programming language. Object references have a well known structure and hence may be passed from one language to another without modification. In addition, the data for an object is separated from the pointers to the methods on the object in an mtable. This separation allows potential mapping of data for an instance from one address space to another.
To invoke an operation on an mtable object reference requires one indirection from the object reference to the mtable for the interface, and one indirect call through a function pointer in the mtable. An additional indirection is used in the embodiment of the present invention to invoke methods from inherited interfaces. The additional indirection is from the mtable of the apparent type to the mtable for the type which declared the operation.
Widening is the process of creating a less derived object reference from a more derived object reference and is implemented by constructing a new object reference that consists of the original representation pointer and a pointer to the mtable for the wider interface. Narrowing, which is the process of creating a more derived object reference from a less derived object reference is implemented by constructing a new object reference that consists of the original representation pointer and a pointer to the mtable for the narrower interface.
Advantages of using mtables over prior art object reference implementations are that mtables support alternate implementations, mtables may be used from multiple languages, and mtables are small and fast. In addition, the method of the present invention allows mapping of data. Further, data does not have to be altered for widening or narrowing, and there is no possibility of copying only a widened view of the data when copying a widened object reference as an instance of the wider interface.


REFERENCES:
patent: 5327562 (1994-07-01), Adcock
patent: 5339438 (1994-08-01), Conner et al.
patent: 5442793 (1995-08-01), Christian et al.
patent: 5566302 (1996-10-01), Khalidi et al.
patent: 5600838 (1997-02-01), Guillen et al.
patent: 5768588 (1998-06-01), Endicott et al.
patent: 5794038 (1998-08-01), Stutz et al.
patent: 5794041 (1998-08-01), Law et al.
patent: 5884316 (1999-03-01), Bernstein et al.
patent: 5907707 (1999-05-01), Ramalingam et al.
patent: 6044380 (2000-03-01), Gerard et al.
R. Connor et al, “An Object Addressing Mechanism for Statically Typed Languages wit Multiple Inheritance”, OOPSLA 89, pp. 279-285, 1989.*
OMG “Joint Submission on Interoperability and Initialization”, chapter 10, Mar. 1994.*
G. Hamilton, et al, Subcontract: A flexible base for distributed programming, ACM, SIGOPS, Nov. 1993, pp. 69-79.

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

Rate now

     

Profile ID: LFUS-PAI-O-2947057

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