System and methods for optimizing object-oriented compilations
AssigneeBorland International, Inc.
InventorsAnders Hejlsberg, Jeffrey Stock, Peter Kukol, Alex Shtaygrud
Life of this patent
Estimating the term…
Abstract
An object-oriented development system of the present invention includes a language compiler having an optimizer for generating computer applications with improved speed and size. C++ optimization methods of the present invention are described, including virtual function and base optimization, using thunks for virtual member pointers, and passing classes by value. An object-oriented calling convention of the present invention, which affords rapid and efficient access to data and methods of objects, is also described.
Claims19
In a system for compiling C++ source listings into code for operating a computer, the source listings including C++ objects instantiated from C++ classes defining class methods and data members, the system including a memory and a processor having registers for loading segment and offset addresses of memory locations, a method for controlling access to said methods and data members, the method comprising:
- (a) defining a class of objects, said class including data members and methods operative on said data members;
- (b) creating an object of said defined class by storing data members for said object at a default data segment in said memory;
- (c) maintaining a segment address for said data segment in a data segment addressing register of said processor;
- and
- (d) accessing said data members by loading an offset into a selected register, whereupon said data members are accessed by combining said segment address stored in said data segment address register with said offset stored in said selected register.
A system for developing compiled computer code, the system comprising:
- a computer having a processor and a memory, said memory including a plurality of memory segments, and said processor including a data segment register for addressing a memory segment storing data;
- a compiler for generating computer code from source listings, said source listings including definitions of classes of objects having data members and methods operative on said data members, said source listings also including declarations of objects from said classes, whereby an object inherits data members and methods from at least one class;
- means, operably coupled to said compiler, for instructing said processor to create at least one object from said at least one class by storing data members of said at least one object in a single segment of the memory and loading said data segment register with a segment address of said single segment, said data members being stored at an offset in said single segment;
- and
- means, operably coupled to said compiler, for instructing said processor to access said stored data members of said at least one object by combining said segment address loaded in said data segment register with said offset.
In a system for compiling source listings into code for operating a computer, said computer including a processor and a memory, said source listings comprising C++ objects instantiated from C++ classes having C++ data members and C++ methods operative on said data members, an improved method for accessing said data members, the method comprising:
- (a) allocating a region from said memory as a default data segment, said default data segment being located in said memory at a particular segment address;
- (b) storing said C++ data members of said C++ objects in said default data segment, said C++ data members residing at an offset in said default data segment;
- (c) storing said particular segment address of said default data segment in a segment register of said processor, so that references to said C++ data members in said C++ source listings comprise near addresses, said near addresses including an implicit segment address to said default data segment;
- and
- (d) accessing said C++ data members during runtime execution of said C++ methods by combining said segment address of said default data segment stored in said segment register with said offset.
A computer program stored on a computer readable medium, comprising:
- code that receives object-oriented source code listings, said source code listings including a declaration of an object that is a member of a class, said declaration specifying data members of said object;
- code that stores said object including said data members at a first offset within a default data segment, wherein a data segment addressing register specifies a location of said default data segment;
- and
- code that accesses said data members of said object in said default data segment by combining said data segment addressing register with said first offset.
Dependencies are inferred from the claim text.