Typed intermediate language support for languages with multiple inheritance
AssigneeMicrosoft Corporation
InventorJuan Chen
Life of this patent
Estimating the term…
Abstract
A typed intermediate representation of source code written in a language that supports multiple inheritance is presented. The typed intermediate representation uses paths to represent objects embedded in other objects. For each class, an exact record type represents layout of complete objects of that class. An approximated record type describes layout of inner objects when the runtime types of the objects are statically unknown. Address arithmetic is represented by special instructions and type-checked to ensure proper pointer adjustment. Types are also given to “this” pointers of methods within classes. These “this” pointer types refer to the paths associated with the object.
Claims20
A computer implemented method for using an intermediately compiled source code program, the method comprising:
- using a path type to represent the type of an inner object within an outermost object, wherein the path type comprises a complete class inheritance path from the outermost object to a runtime type of the inner object.
At least one computer-readable medium having stored thereon instructions for executing a method of using a typed intermediate representation of a computer program, the computer program comprising at least one class which inherits a superclass at least twice, the instructions comprising assigning at least one path type to at least one inner object of the superclass, the path type comprising a sequence of class names representing the inheritance from the class to the superclass.
A computer system for using an intermediately compiled source code program, the computer system comprising:
- a path assigner which assigns a first path to a first object of a first class, the first object being an inner object of outermost second object of a second class, the path comprising an offset from the second object to the first object;
- a path checker which ensures that a method of the first object only accepts objects with the first path type;
- an offset locator which locates an offset between the first class and the second class by looking at a record in the second class which stores the offset between the first and second class when the first class is a direct virtual base of the second class, and
- a “this” pointer adjuster which casts the first object to the second object by subtracting from the first object the offset between the first class and the second class located by the displacement locator when a virtual method defined in the first class but overridden in the second class is called on the first object.
Dependencies are inferred from the claim text.