Background of the Invention
1. Field of the Invention
The present patent application is closely related to U.S. patent application Ser. No. 266,429 which is a parent application of Ser. No. 647,271, now U.S. Pat. No. 4,661,903 and U.S. Ser. No. 266,424, which is a parent application of Ser. No. 580,772, now abandoned both filed on even date with the present application and assigned to the assignee of the present application.
The present invention relates generally to digital computer systems and more specifically co systems for representing data by means of operands and obtaining the address of the represented data from the operands.
2. Description of Prior Art
A recurring problem in the design of digital computer systems is the manner in which data to be processed by the computer system is to be represented in the instructions to which the processor responds. In order to process an item of data, the processor requires at a minimum the address of the item. However, it is generally impractical to simply include the address in the instruction. First, the locations of many items of data are not known until a program is actually executed, and consequently, cannot be included in the program's instructions. Second, when the address is included in the instruction, the instruction will operate correctly only in a single addressing environment. Such a restriction bars the sharing of programs by different users and further bars the use of procedures which may be called at various points in a program.
In the prior art, the above problems have been overcome by techniques such as base-displacement addressing and descriptions. In base-displacement addressing, utilized for example in the IBM 360-370 family of digital computer systems, the processor contains one or more base registers. Certain instructions permit the programmer to load the base registers with addresses obtained from memory or computed in the processor. Addresses of data may then be represented in instructions by specifying one of the base registers and a displacement from whatever address is currently stored in the base register. The address of the data is obtained by adding the specified displacement to the current value of the specified base register. Since the base registers may be set during execution of a program, addresses which are not known until the program is executed may be calculated by first setting a base register to the proper value and then specifying a displacement relative to the base address. Further, since the base registers may be set to different values for different executions of a program, programs are independent of a specific addressing environment.
Base-displacement addressing is not well-suited to dealing with data items whose addresses are determined by complex computations dependent on values which are not known until the program is executed. For example, the address of an array element is found by obtaining an index value from memory, multiplying the size of an element in the array by the index value, and adding the result to the address of the beginning of the array. In base-displacement addressing, sequences of instructions specifying these computations and setting the base registers to the proper values must be executed each time a program processes an element of an array. Consequently, programs dealing with data such as array elements are much longer than those dealing with data requiring less-complex address computations.
Descriptions, as implemented in the Burroughs B1700 processor and disclosed in U.S. Pat. No. 3,805,247, Zucker, et al., Apr. 16, 1974, entitled Description Driven Microprogrammable Multiprocessor System, solve the above-cited problems of base-displacement addressing schemes when complex address computations are required. In the system disclosed in Zucker et al., data items are represented in instructions by specifying a name register and a description address. Descriptions are data in memory which are associated with a specific execution of a program and which are used to calculate the addresses for that execution of the program. Where complex calculations are required, one description may refer to another. The name register specified in the instruction contains data allowing the specific location of a data item in an area specified by the description located by the description address. The address of the represented data item is computed using the information in the description specified in the instruction, descriptions referred to through that description, and the information in the name register specified in the instruction. Since one description may refer to another, no more instructions are needed in programs involving data items requiring complex address computations than in those requiring only simple address computations. Further, while instructions for complex address computations must be repeated each time the address computation is performed, a given description may be used to calculate addresses for many different instructions.
There are two disadvantages to descriptions: first, they must be created anew each time a program is executed; second, they contain memory management and protection information which is subject to change while a program is being executed; consequently, even though the address of a data item may remain the same throughout the execution of the program, the address cannot be easily encached.
The present invention provides data processing system improvements and features which solve the above-described problems and limitations.
Summary of the Invention
The present invention relates generally to digital computer systems and more specifically to apparatus for deriving the address of a data item from an operand representing the data item.
In the present invention, data items may be specified by means of names permanently associated with procedures. Each name corresponds to a name table entry permanently associated with the same procedure with which the name is associated. The corresponding name table entry indicates how a base address and a displacement may be derived. When the displacement is added to the base address, the result is the address of the item represented by the name.
The base address is specified with reference to a set of architectural base addresses whose values change only when the digital computer system executes a call instruction beginning an execution of a procedure or a return instruction terminating an execution of a procedure.
The operation of obtaining the address of data represented by a name from the name is called resolving the name. The operation is performed in the digital computer system of the present invention by name interpretation apparatus which operates under microde control. The name interpretation apparatus resolves a name by locating the name table entry associated with the name and using the information in the name table entry and the current values of the architectural base addresses to calculate the base address and the displacement and then obtain the address of the item represented by the name by adding the displacement to the base address. The name interpretation apparatus may further perform the operation of name evaluation. In name evaluation, the address resulting from the name resolve operation is provided to the memory system of the digital computer system and the data represented by the name fetched to the processor.
Name table entries in the present invention may themselves includes names associated with other name table entries in the the name table. For example, a name table entry may specify a base address by means of an included name representing a pointer. In this case, the name interpretation apparatus resolves the name corresponding to the name table entry by evaluating the included name to obtain the base address and then adding the displacement to the base address. The name table entry for the included name may itself contain included names, and thus, the resolution of a name may involve the resolution or evaluation of any number of names. The name interpretation apparatus deals with included names by evaluating or resolving them recursively.
The set of architectural base addresses in the present invention includes three addresses: a procedure base address from which locations in the procedure currently being executed are calculated, a frame address from which locations in the stack frame corresponding the the current execution are calculated, and a static data address from which locations in a static data area associated with a set of procedure executions performed by a single process are calculated. The static data area address and the procedure base address are derived from information in a procedure environment descriptor associated with each procedure. The frame address changes each time a call or return instruction is executed; the procedure base address and the static data area address may change only when a call or return commences or resumes execution of a procedure having a procedure environment descriptor different from that of the procedure containing the call instruction or the return instruction.
Other aspects of the present invention include the specification of base addresses in name table entries in the following fashions:
By means of an architectural base address specifier specifying one of the architectural base addresses.
By means of an architectural base address specifier and a pointer location specifier specifying the displacement of a pointer from the specifier architectural base address. The pointer is then the base address.
By means of an included name which is resolved to obtain the base address.
By means of an included name which is evaluated to obtain a pointer which is the base address.
Displacements, too, may be specified by means of included names. These included names are evaluated to obtain the displacement. In name table entries for array elements, finally, the displacement is calculated by multiplying an index value by an inter-element displacement value. In the present invention, either or both may be names.
In the following detailed description of the computer system in which the present invention is embodied, a description of a preferred embodiment of the present invention may be found in Chapter 3, Section B (pages 717, line 20 through 744, line 11) and in the figures referred to therein.
It is thus an object of the invention to provide an improved digital data processing system.
It is another object of the invention to provide improved means for representing data items in computer programs.
It is an additional object of the invention to provide improved means for computing the addresses of data items in computer programs.
It is a further object of the invention to provide means for computing the addresses of data items in computer programs which employ architectural base addresses which change only upon execution of call and return operations.
It is yet another object of the invention to provide improved means for specifying addresses of data items in terms of a base address and a displacement therefrom.
It is a further additional object of the invention to provide improved means for specifying addresses of elements of compound data items.
It is still another object of the invention to provide recursive means for calculating addresses of data items.
Other objects, advantages and features of the present invention will be understood by those of ordinary skill in the art, after referring to the following detailed description of the preferred embodiments and drawings wherein:
Brief Description of Drawings
The figure numbers in this application have two components, one indicating the chapter the figure refers to and the other the sequential number of the figure in the chapter. Thus, FIGS. 1 through 20 refer to the Introduction, 101 to 110 to Chapter 1, and so forth. There are no FIGS. 21-100, 111-200, 275-300, or 308-400 in the application.
FIG. 1 is a partial block diagram of a computer system incorporating the present invention.
This application incorporates by reference the entire application, Ser. No. 616,773, filed on May 31, 1984, of Bratt et al., (a continuation of Ser. No. 266,404, filed on May 22, 1981) now issued as U.S. Pat. No. 4,525,780, on June 25, 1985.
More particularly, attention is directed to FIGS. 3, 4, 6, 8-10, 101, 103, 270-272, 301-305, 468, 469 and 471 of the drawings in U.S. Pat. No. 4,525,780 and to that part of the descriptive portions of the specification thereof, particularly at columns 21, 22, 28-32, 54, 305-312, 320, 326-328, 332, 334-344, 348, 476-478 and 484-490 which relate to the subject matter of the claims herein.