WO2002048864A2 - System registers for an object-oriented processor - Google Patents
System registers for an object-oriented processor Download PDFInfo
- Publication number
- WO2002048864A2 WO2002048864A2 PCT/US2001/043957 US0143957W WO0248864A2 WO 2002048864 A2 WO2002048864 A2 WO 2002048864A2 US 0143957 W US0143957 W US 0143957W WO 0248864 A2 WO0248864 A2 WO 0248864A2
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- class
- data structure
- current
- processor
- register
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45504—Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
- G06F9/45508—Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30181—Instruction operation extension or modification
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4488—Object-oriented
- G06F9/449—Object-oriented method invocation or resolution
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/48—Indexing scheme relating to G06F9/48
- G06F2209/481—Exception handling
Definitions
- the present invention generally relates to the execution of object-oriented instructions in object-oriented run-time systems, more particularly to methods and apparatuses for hardware execution or acceleration of object-oriented instructions in object-oriented run-time systems.
- JVM Java Virtual Machines
- JIT just-in-time compilers
- hardware accelerators or mere extensions to an existing processor's architecture.
- Java- enabling technology by far, is the provision of a Java Native Processor into a mobile device.
- the Java run-time environments, and other object-oriented run-time environments generally comprise an assortment of data structures for representing classes, objects, etc., the details of which generally vary from implementation to implementation.
- the JNM specifications e.g. J2ME (KNM), J2SE, J2EE, etc..
- J2ME J2ME
- J2SE J2SE
- J2EE etc.
- JNM J2ME
- J2SE J2SE
- J2EE etc.
- Java code e.g. J2ME (KNM), J2SE, J2EE, etc..
- a typical JNM runtime environment may include a set of loaded classes, a heap for storing objects data structures, and one or more stacks for maintaining method call chains.
- a class loader may also be included, the class loader, among other things, parses class files, loading them into the JNM runtime environment.
- Bytecode contained in class files provide executable bytecode, or instruction bytecode in any methods specified therein as well as information bytecodes for the linking of the class into the run-time system as well as other purposes.
- Each class may also include a "constant pool" to support dynamic linking.
- the constant pool comprises such information bytecodes, describing linkages between the class and other classes, methods, objects, fields, etc... with which the class interacts.
- Many object-oriented instructions for instance JNM instructions, may include an index into a class's constant pool.
- a hardware implementation of an object-oriented system may be required to interact with the constant pool as well as other run-time data structures such as class data structures and object instance data structures.
- the prior art teaches a Java processor, the picoJava II processor, which substitutes symbolic constant pool references with numeric constant pool references, and wherein the numeric references comprise actual data or references combined with the use of a constant pool pointer register which holds a pointer to the constant pool of the current method's class.
- One embodiment of the invention includes a processor for executing object-oriented instructions, the processor comprising: a memory comprising a class table data structure, a class data structure, and a method data structure; a class table register adapted to point to the class table; a current method value adapted to identify the method data structure associated with the method currently being executed by the processor; and a current class value to identify the class data structure of the class associated with the current method.
- the processor may further comprise a Current Class / Current Method (CC/CM) register containing both the current class value and the current method value.
- the processor may comprise a CC/CM register comprising a first part of the CC/CM register for storing the current class value and a second part of the CC/CM register storing the current method value.
- the processor may further comprise one or more object-oriented instructions for accessing the data structures, the instructions adapted to use the class table register, the current class value, and the current method value.
- the processor may further comprise: a stack data structure stored in the memory, the stack for holding method frames, the method frames containing a context; the processor comprising one or more context switch instructions, the processor adapted to execute the one or more context switching instructions, at least one of the context switching instructions for switching from a current context to a new context, adapted to build a new method frame on the stack and store the current context in the context of the new method frame, and at least one of the context switching instructions for switching instructions for switching from a current context to an old context, adapted to restore the old context from the context of a method frame on the stack.
- the context switching instructions for switching to a new context may comprise a method invocation instruction, and at least one of the context switching instructions for switching instructions for switching to an old context comprises a return instruction.
- One embodiment of the invention includes a system for executing one or more object- oriented instructions, the system comprising: a memory containing one or more data structures; and a class data structure stored in the memory, the class data structure comprising a first portion for storing class information that is not required to be altered at run-time, and a the second portion for storing modifiable class information, wherein the first portion may be stored in read-only memory, and object-oriented operations may be conducted on information in the first portion at run-time, while the second portion may be stored in volatile memory at run-time, and object-oriented operations may be condcuted on the information in the second portion.
- the first portion comprises a class data structure
- the second portion comprises a separate modifiable class data structure.
- One embodiment of the invention includes a system for executing object-oriented instructions comprising: a processor having at least one object-oriented instruction in its instruction set; a memory operatively coupled to the processor; a system class table for holding a system class table, the system class table residing in the memory, the system class table comprising references to a plurality of classes; a class table register for holding a reference to the system class table; a current class register for holding a class table index value representing a current class; and a current method register for identifying the method in which the system is operating.
- the system may also include the current class, current method, and class table memories being located in the processor.
- the system may also include, the current class, current method, and class table memories comprising registers.
- the system may also include the current class memory and current method memory comprising a single register.
- the system may be selected from the group comprising: a hardware Java system, a Java processor, or a Java accelerator.
- One embodiment of the invention includes a hardware Java apparatus comprising: a class table for identifying a plurality of classes loaded in the apparatus; a class table register for holding the base address of the class table; a current class register for holding a class index into the class table, the class index identifying an operating class; and a current method register for identifying an operating method within the operating class.
- One embodiment of the invention includes a processor for executing object-oriented instructions, the processor comprising: a memory comprising a class table data structure, a class data structure, a modifiable class data structure, and a method data structure; a class table register adapted to point to the class table; a current method value adapted to identify the method data structure associated with the method currently being executed by the processor; and a current class value to identify the class data structure and modifiable class data structure of the class associated with the current method.
- the processor may further comprise a CC/CM register containing both the current class value and the current method value.
- the processor may contain a CC/CM register comprising a first part of the CC/CM register for storing the current class value and a second part of the CC/CM register storing the current method value.
- the processor may also include a class data structure comprising class information that is not required to be altered by the processor at run-time, and wherein the modifiable class data structure comprises class information that must be alterable by the processor at run-time.
- the processor may also include one or more class files that are pre- processed, the one or more classes files each having a pre-processed class data structure and a pre-processed modifiable class data structure.
- the processor may further comprise a readonly memory and a volatile memory, the pre-processed class data structures stored in the read-only memory, and the pre-processed static data structures stored in the volatile memory.
- the processor class data structures for the one or more pre-processed classes and the modifiable class data structures for the one or more pre-processed classes may be stored in read-only memory, and the processor further comprising a system initialization routine adapted to copy the one or more modifiable class data structures to the volatile memory.
- One embodiment of the invention includes a class file pre-processing tool adapted to generate one or more pre-processed class files, to generate a class data structure for pre- processed classes and a modifiable class data structure for pre-processed classes, the class data structure comprising class information that is not required to be altered by the processor at run-time, the modifiable class data structure comprising class information that must be alterable at run-time.
- One object of the present invention is to provide methods and systems to permit an object-oriented processor to efficiently access object-oriented data structures and perform object-oriented operations upon classes, methods, constant pools, fields, etc.
- Finding the class data structures through the constant pool may require significant processing upon class loading and may require the replication of method data structures for inherited methods.
- Embodiments of the present invention may provide rapid access to the method for exception handling; rapid access to the class for static method invocations; rapid access to the class's static data for static data operations such as getstatic and putstatic.
- Figure 1 illustrates a block diagram of an object-oriented processor core that uses a constant pool register for performing object-oriented operations
- Figure 2 illustrates a typical run-time system for an object-oriented system
- Figure 3 illustrates a block diagram of an object-oriented processor core in accordance with an embodiment of the present invention
- Figure 4. illustrates the class table register and CC/CM register used to identify a current class
- Figure 5-1 illustrates a class table data structure and a detailed example of a class data structure
- Figure 5-2 illustrates details of a class information header of a class data structure
- Figure 6-1 illustrates the CC/CM register used to identify a current method
- Figure 6-2 illustrates details of a method entry pointer table in relation to a class inheritance structure
- Figure 7-1 illustrates a memory map of a run-time stack, the composition of method frame on the run-time stack, and elements of the return execution context segment of a method frame;
- Figure 7-2 illustrates an embodiment of an object data structure
- Figure 8-1 illustrates details of a method entry data structure and a method handlers table associated therewith
- Figure 8-2 illustrates details of a method handlers table
- Figure 9-1 illustrates details of a field entry pointer table in a class inheritance structure
- FIG. 9-2 illustrates details of field data structure
- Figure 10 illustrates a class table and a modifiable class data structure. Description
- FIG. 1 illustrates a conventional Java native processor core that may execute Java bytecode.
- Processor core 100 comprises a pre-fetch unit (PFU) 101, microsequencer unit (MSU) 102 having a microcode memory 110, and an instruction execution unit (IEU) 103 having a register file 120.
- PFU pre-fetch unit
- MSU microsequencer unit
- IEU instruction execution unit
- Processor core 100 is coupled to system memory 130, which contains one or more class files.
- System memory 130 is provided to class files as well as run-time data structures 165 such as run-time stack 140 (not shown).
- Run-time stack 140 is generally utilized for maintaining a call chain of method frames 150 (aka activation records)(not shown), for passing parameters to methods (or functions), returning results to callers, and for holding temporary results, etc.
- Run-time stacks are well known to those skilled in the art.
- Register file 120 may comprise a plurality of specific purpose registers, including a status flag (Flags) register 121 for indicating various conditions during execution; local variable pointer (LP) 122, for pointing the local variables of the current execution context; frame pointer (FP) 123, for pointing to the return execution context; stack pointer (SP) 124, for pointing to top of the stack (TOS)140 in system memory 130; stack limit pointer (SL) 125, for pointing to the end of the current stack 140; program counter (PC) 126, for pointing to the next instruction to be fetched, and constant pool register 160, for pointing to the constant pool of the class associated with the current method.
- Flags status flag
- Pre-fetch unit 101 fetches instructions from programs or method bytecode (not shown) in system memory 130 according to a value contained in program counter (PC) 126 register, or according to an instruction pre-fetch pointer stored in another register (not shown).
- PC program counter
- Microcode memory 110 receives a microprogram address 111 from PFU 101, corresponding to an opcode to be executed, to obtain one or more microinstructions comprising the microprogram that implements the opcode.
- the microinstructions are dispatched to IEU 103 to control the datapath and effect execution of the opcode.
- JNM run-time system 165 stored in memory 130, may include a class table 200, class data structures 210, method data structures 220, field data structures 230, run-time stacks 240, and object data structures 250.
- Other data structures may be provided such as interface data structures, a global string pool data structure, or other data structures which may be required by an object-oriented run-time system.
- Class table 200 contains references to loaded classes.
- a class loader may insert new class references to the class table 200 as new classes are loaded.
- Each class reference may point to a class data structure 210.
- Each class loaded by the system may be represented by a class data structure 210.
- Class data structure 210 maintains information related to its class such as the name of a super class, if the class files indicates inheritance from another class as well as the class's methods, fields, and interfaces.
- Class data structure 210 also includes the constant pool data structure(s) derived from the class file. Alternatively, class data structure may contain a reference to a constant pool data structure. Any methods associated with a class may be provided in a method data structure 220. The method data structure 220 may be accessed from the class data structure 210.
- the class data structure 210 may include references to multiple method data structures 220 where each method data structure 220 is associated with a single method. Alternatively, class data structure 210 may hold a reference to a data structure containing multiple references to the method data structures 220.
- Method data structures 220 may contain the executable instruction bytecode of the method, the name of the method (provided as a string and/or as a hash key into a global string pool) as well as information derived from the class file, such as access flags, the maximum stack size of the method frame, the number of arguments, the number of local variables, etc...
- Field data structures 230 which may also be known as field entries, may also be accessed from the class data structure 210, the field data structures containing information such as the name of the field (provided as a string and/or hash key into a global string pool), a reference to the class defining the type of the field, access flags, etc...
- Each thread in the JNM may be associated with a run-time stack 240.
- Stack 240 stores "stack frames" (or method frames), each comprising the execution context and related data of a single method invocation or function call.
- method frames are pushed on to the thread's stack 240.
- a local variable segment of method frames frequently contains a reference to the object that invoked the method associated with the frame.
- stack 240 may contain one or more references to object data structures 250.
- Object data structures 250 exist for every object instantiated in the JVM system. In one embodiment, multiple threads may share object data structures 250.
- Object data structures 250 may contain a reference to the class data structure representing the class of the object, a monitor or pointer to a monitor to provide threads with mutual exclusion on the object, data fields associated with the object, or other information.
- class data structure 210 may include within itself method data structure 220 and/or field data structure 230, wherein pointers to method data structures 220 and field data structures 230 comprise internal pointers to locations within class data structure 210 containing the respective method data structure 220 or field data structure 230.
- Object-oriented processor core 300 may generally comprise a similar design as processor core 100, with the exception of constant pool register 160 not being provided in processor core 300. Additionally, processor core 300 includes a class table (CT) register 305 to point to class table 200 in the JVM run-time system 165. The pointer held in class table register 305 may be initialized at system start-up. A current class / current method (CC/CM) register 310 is also provided in processor core 300. CC/CM register 310 may hold a value to identify a class table entry and a value to identify a method data structure 220. In one embodiment, the value identifying a class table entry is a current class index into class table 200, the current class being the class associated with the currently executing method.
- CT class table
- CC/CM current method
- embodiments may include two separate registers instead of the one CC/CM register 310 - one register containing the current class, and the second register containing the current method. Such embodiments are considered to be within the scope of the present invention, as described and cliamed herein. Those skilled in the art may adapt the teachings herein described to put such embodiments to practice.
- the embodiments that follow embody aspects of the present invention in the context of a single CC/CM register.
- the class data structure 210 associated with the current class may be accessed by generating an address into memory 130 by applying current class index to the contents of the class table register 305. Accessing the contents of this address in memory 130 will provide a class pointer to the class data structure 210. Elements contained in class data structure 210 may be accessed by applying pre-determined offset values. In this way, information contained in and available through class data structure 210 may be accessed, including the constant pool 215.
- Class data structure 210 includes a class information header 501 which may be of known size.
- Figure 5-2 illustrates elements that may be contained in class information header 501.
- class information header 501 may include constant pool pointer 502, to locate the constant pool of the class.
- the constant pool of each class may be stored externally to class data structure 210 with constant pool pointer 502 pointing to the external location comprising the constant pool.
- Class data structure 210 as illustrated includes a method entries pointer table 500, which comprises a array of method pointers, each pointing to a method data structure 220.
- array of pointers 500 is located adjacent to class information header 500, which may be of a known, pre-determined size.
- class information header 500 which may be of a known, pre-determined size.
- the array of pointers 500 may be easily found by applying an offset corresponding to the known, pre-determined size. In one embodiment this offset may be available in an address calculation unit in IEU 103.
- Class data structure 210 may also comprise an interface pointer table 503; for pointing to interface data structures associated with the class; a field entries pointer table 504, for pointing to field data structures associated with the class; and any other structures required to support run-time object- oriented operation upon the class.
- the value contained in CC/CM register 310 to identify a method data structure may comprise an index into a list of pointers to one or more method data structures 220 associated with the current method.
- Figure 6-1 illustrates how the current method value may be used to access the method data structure 220 of the current method.
- Class data structure 210 of the current class may first be found (as described above), and the current method index may be applied to the class data structure 210.
- the method entry pointer table 500 to method data structures may be located at a fixed location (e.g. a known, predetermined offset for the base of the class data structure) within class data structures 210.
- method entry pointer table 500 is located adjacent to class information header 501, the latter having a known size.
- class data structures 210 may include an internal pointer to an array of one or more pointers to method data structures contained in the class data structure.
- class data structures contain a pointer to an intermediate data structure containing pointers to one or more method data structures.
- the current method index may be applied to an array of pointers to method data structures 220, to identify and provide access to the method data structure 220 associated with the currently executing method.
- class data structure 210- A of a class the class data structure 210-B of the class's super class, and the class data structure 210-C of the super class's super class are shown.
- Class A may inherit from Class B, which in turn inherits from Class C.
- Class data structure 210-A contains a method entry pointer table 500- A with method pointers to 'N' methods, where 'N' represents some integer value.
- Method entry pointer table 500- A in class data structure 210-A of Figure 6-1 is expanded to show the multiple pointers to the method data structures 220 of each method associated with the class.
- Each class data structure 210 may contain method data structures 220, as illustrated.
- method data structures 220 may be located externally to the class data structures 210, for instance in a method area of memory 130.
- Class data structure 210-A contains "method 0" and "method 1", inherited from Class C through Class B; "method 2" and “method N”, comprising new or overridden methods in Class A; "method 3", inherited from Class B; and where N > 4, other methods between 4 to (N-l) (not shown).
- method entry pointer table 500-A includes "method 0" pointer and "method 1" pointer, both pointing to their respective method data structures 220-0 and 220-1 in class data structure 210-C; "method 2" pointer and “method N” pointer, pointing to their respective method data structures 220-2 and 220-N in class data structure 220- A; and "method 3" pointer, pointing to method data structure 220-3 in class data structure 220-B.
- object-oriented methods including those provided through a class inheritance scheme, may be accessed by instructions executed in object-oriented processor core 300.
- Threads executing on object-oriented processor core 300 may create a call chain of method invocations, causing the execution context thereof to change as method invocation and return instructions are executed thereon. Accordingly, a history of execution contexts may be persevered to restore the proper execution context upon the execution of a return instruction or the like.
- Stack 140 of each thread may include multiple method frames 150 as a call chain is developed.
- the method frame 150 of the current method may be identified by one or more pointers. Referring to Figure 7-1, a local variable pointer 122, frame pointer 123, and a stack pointer 124 may point into the method frame 150 associated with the current method. Additionally, a stack limit pointer 125 may be maintained to indicate the end of allocated memory in memory 130 provided for stack 140. In one embodiment any or all of pointers local variable pointer 122, frame pointer 123, stack pointer 124, and stack limit pointer 125 may be maintain in dedicated registers in object-oriented processor 300.
- the exact structure of the method frames 150 are defined by the nature of the system architecture, and the data required to reinstate the execution context on processor core 300.
- method frame 150 comprises three method frame segments: local variable segment 151, "return execution context" segment 152, and local stack operand segment 153.
- Local variable segment 151 may comprise local variables required for the execution of the method. Local variable segment 151 may also include any parameters passed to the method by its caller. If parameters are passed to a method from its caller, the caller will first push the parameters onto its local operand stack segment 153 in stack memory 140. When the caller invokes a Java method, an invoke instruction is executed. The invoke instruction may include construction of a new Java frame 150 for the invoked method on stack memory 140, such that new Java frame 150 overlaps with any parameters in the local stack operand segment 153 in the caller's method frame. Accordingly, the invoked Java method may access the parameters as local variables.
- the return execution context segment 152 typically contains the information required to restore the execution context of the caller when the method returns program control thereto (i.e. upon the execution of a return instruction).
- execution context segment 152 will include a plurality of elements, including a return program counter (PC) 1522, return frame pointer (FP) 1524, return local variable pointer (LP) 1523, and a return CC/CM value 1521 containing both the current class index and the current method index.
- PC return program counter
- FP return frame pointer
- LP return local variable pointer
- the return execution context segment 152 may be constructed by pushing each of its elements onto stack memory 140.
- Local stack operand segment 153 is defined in Java frame 150 to accommodate temporary results and to pass parameters to methods and receive return values from methods invoked by the method associated with the current context. In Java environments, these temporary operands are known as local operands, stack operands, or local stack operands. Local stack operands may comprise constants, for example, local variables, fields, references, results, etc. As processor core 300 executes instructions of a method, local stack operand segment 153 may grow and shrink as certain instructions, such as the JNM opcodes i_const0, aload, astore, and the like, push and pop local stack operands onto stack memory 140.
- the JNM iadd instruction pops the top two elements off local operand stack segment 153, adds the two elements in an ALU in processor 100 and generates a sum, and pushes the sum onto the local operand segment 153 (i.e.: the top of stack).
- the sum may be subsequently stored in a local variable, serve as an operand to a subsequent instruction, or be returned to the caller as a return value.
- Stack pointer 124 indicates the location of the top element (TOS) of the local stack operand. Memory locations beyond stack pointer 124 contain invalid data.
- the return routine may pop the return CC/CM value 1521 from the current method frame 150, writing the value to CC/CM register 310.
- Method invocation routines may push the contents of the CC/CM register 310 onto stack 140 when building a return execution context segment 152 on the stack 140. Method invocation routines may then update the content of the CC/CM register 310 with the correct value for the invoked method.
- a return CC/CM value 1521 may be preserved when a thread is moved out of the running state to another non-running state.
- the return CC/CM value may be pushed onto its own stack for reinstatement upon the thread returning to the running state.
- Class table register 305 and CC/CM register 310 may be utilized by various operations executed in object-oriented processor 300. Such operations may involve the accessing of various run-time data structures including class data structures 210, method data structures 220, field data structures 230, object data structures 250, interface data structures (not illustrated), and the like.
- Object data structure 250 may include an object class pointer 2501 for pointing to the class data structure 210 of the class from which the object was instantiated; a monitor 2502 (or pointer to a monitor) for permitting mutual exclusion upon the object by a thread; and any data fields 2503 associated with the object, the data field 2503 comprising data or references to object data structure comprising a field.
- Other embodiments may represent objects using a different object data structure formats without departing from the scope of the present invention as claimed herein.
- Object data structure 250 may be accessed as a local variable comprising a reference to the object, the local variable in local variable segment 151 on a stack 140; as a stack operand in the stack operand segment 153 on a stack 140; as a field
- a detailed embodiment of an exemplary method data structure 220 is provided in Figure 8-1.
- a method entry pointer table 500 in a class data structure 210 contains 'N' method pointers, where 'N' is an integer value. "Method 1" pointer in table 500 points to method data structure 220-1.
- Method data structure 220-1 includes a method information header which is of a fixed, pre-determined size, followed by a bytecode array 805 comprising executable instruction bytecode of the method. For object-oriented processor 300 to handle exceptions which may be thrown during the execution of a method, object-oriented processor 300 may need to access one or more method handlers.
- the method information header of method data structure 220-1 may include a method handlers table pointer 800 to method handlers table 810.
- Method handlers table 810 contains method handler data structures 815 for each of the method handlers that may be required by a method.
- Figure 8-2 illustrates details of an exemplary method handler data structure 815X in method handler table 81 OX, associated with a method
- Each method handler may also be associated with executable instruction bytecode, provided for the execution of the method handler, which may be included in bytecode array 805 of the method, for instance at the end of the bytecode array 805.
- executable instruction bytecode provided for the execution of the method handler, which may be included in bytecode array 805 of the method, for instance at the end of the bytecode array 805.
- Class data structure 210 includes a field entry pointer table 504, containing field pointers to the field data structures 230 of the fields associated with the class.
- a given class may inherit fields from an inheritance tree of other classes.
- Class data structure 210-A contains a field entry pointer table 504 comprising an array of pointers to 'N' field data structures 230, where 'N' represents some integer value.
- Field entry pointer table 504 A in Figure 9-1 is expanded to show the multiple pointers to each field contained therein.
- Each class data structure 210 may contain field data structures 230, as illustrated.
- field data structures 230 may be located externally to the class data structures
- Class data structure 210-A contains "field
- field entry pointer table 504-A includes
- fields including those provided through a class inheritance scheme, may be accessed by instructions executed in object-oriented processor core 300.
- FIG. 9-2 An exemplary embodiment of a field data structure 230 is illustrated in Figure 9-2.
- a field entry pointer table 504 includes N fields, where N is an integer value, is shown in Figure 9-2.
- "Field 1" pointer points to field data structure 230-1, illustrated in detail. Elements of the field data structure 230-1 may be utilized by various object-oriented operations by object-oriented processor 300, described further below.
- Figure 10 illustrates an embodiment wherein class information and data that must remain modifiable by object-oriented processor 300 at run-time, is maintained in a modifiable class data structure 1000.
- Modifiable Class data structure 1000 may contain class information that must remain modifiable at run-time, such as the class's static fields and a monitor or pointer to a monitor associated with the class (as opposed to a particular object, or instance, of the class). Other embodiments may include other class information or data may be included in modifiable class data structure 1000.
- Modifiable Class data structure 1000 contains a pointer to the class data structure 210. Modifiable Class data structure 1000 may be accessed through a class table 1020.
- Class table 1020 contains two references for every loaded class: the class pointer, pointing to the class data structure 210 of the class; and modifiable class pointer 1010, pointing to the modifiable class data structure 1000 of the class.
- An advantage of this embodiment is that the information required for a class is split into two sections: a class data structure 210 which contains information that is not required to be altered by object-oriented processor 300 during run-time, and a modifiable class data structure 1000 which contains information that must be alterable at run-time by object- oriented processor 300.
- a pre-processing tool such as a ROMizer, may be implemented with a substantial portion of its class information loaded into read-only memory (ROM) at run-time.
- class table entries for pre-loaded classes may comprise a class pointer pointing to the class data structure 210 stored in read-only memory, and a modifiable class pointer 1010 pointing to the modifiable class data structure 1000, located in memory such as RAM.
- a class file pre-processing tool for an object-oriented processor may pre- process one or more class files to be pre-loaded onto a read-only memory that may be coupled to object-oriented processor 300.
- class pre-processing tool may build a class table 1020, class data structure 200 (including within it method data structures 220 and field data structures 230), and a modifiable class data structure 1000.
- Class table 1020 may contain class pointers to class data structures 210 of the pre-loaded classes, and modifiable class pointers 1010 to modifiable class data structures 1000 of the pre-loaded classes.
- the class table 1020, class data structure 210 of the pre-loaded classes, and the modifiable class data structures 1000 of the pre-loaded classes may then be stored in the read-only memory for later use.
- An object-oriented processor making use of the pre-loaded class may then copy the class table 1020 and the modifiable class data structures 1000 to locations in a volatile memory, the modifiable class pointers 1010 of the pre-loaded classes being updated to point to the locations in volatile memory.
- a bootstrap routine or other system initialization routine may perform the copy step and updating of modifiable class pointers 1010.
- the pre-processing tool may create Unicode string objects referenced by constant pool entries tagged as CONSTANT_String entries in the constant pools 215 of the pre-loaded classes.
- the Unicode string objects may then be stored in locations in the read-only memory and the constant pool entries associated with the CONSTANT_String tags may reference to the Unicode string object in read-only memory.
- the pre-processing tool may generate and copy to read-only memory, a global string pool for CONSTANTJLJTF8 constant pool entries, and other string data that may be used in run- time data structures 165.
- the pre-processing tool may build the global string pool, inserting all string data from CONSTANT_UTF8 constant pool entries and string data found in the run-time data structures 165 of the pre-loaded classes. Thus, the global string pool entries for this string data will be copied to read-only memory.
- the global string pool may be copied to volatile memory to permit further growth of the global string pool during run-time.
- Key references located in class data structures 210, method data structures 220, and field data structures 230 do not need to be changed with the copying of the string pool to volatile memory as the key values need not change.
- global string pool entries generated by the pre-processing tool for preloaded classes may remain in read-only memory, while the global string pool structure (such as a hash table) that links to the entries is copied to volatile memory.
- Global string pool entries generated at run-time may then be inserted to the global string pool by updating links (pointers) within the pool such that any entries located in read-only memory comprise the last elements in a linked-list, within a hash-table or the like.
- JNM instructions make reference to constant pool entries to specify a method, class, field, or the like.
- constant pool references may be used by method invocation instructions, getfield and putfield instructions, etc....
- Such instructions typically include an operand that is an index into the current class's constant pool. The index into the constant pool provides the instruction with a "hook" to access the desired method, class, field, or the like.
- Instructions need to "resolve” their constant pool references by accessing and sometimes recursing into the constant pool to obtain constant data or one or more string values, such as a key to identify an entry in a global string pool. These may then be used to find and identify the desired method, class, field, or the like, by comparing the string value(s) to strings stored in the various data structures representing methods, classes, fields, etc...
- the constant pool contains self-referential entries and symbolic references in the form of strings.
- Each constant pool entry comprises a one-byte constant pool entry tag value to indicate one of many constant pool entry types, followed by one or more bytes of constant pool entry data, the constant pool entry data being type-specific
- Constant pool tags and their meaning are known to those skilled in the art.
- the following constant pool tags may be found in the constant pool of class files:
- a constant pool array and a constant pool tag array are provided for maintaining constant pool info of a JVM run-time system.
- the constant pool of each loaded class may be stored in system memory 130, in one or more data structures as part of the run-time system 165.
- the loaded constant pool of a class is stored in the class data structure 210.
- a global string pool is maintained in a run-time system wherein constant pool entries containing string data may be stored in the global string pool. Strings stored in run-time data structures such as class, method, field and other data structures may also be stored in the global string pool.
- the global string pool comprises a hash table. Accordingly, in embodiments utilizing a global string pool as described, a class loader may perform an insertion function to insert any strings in the constant pool entries contained in a class file being loaded, the loaded constant pool entries corresponding to strings comprising a key into the global string pool.
- object-oriented operations to be performed by object-oriented processor 300 may require constant pool resolution of one or more items associated with a constant pool reference. Examples of such operations are described below. The examples provided below correspond to the embodiment illustrated in Figure 10, using class table 1020. Simple constant resolution
- CONSTANTJnteger CONSTANT Float
- CONSTANT_Long CONSTANTJnteger
- CONSTANTJDouble may be resolved by just being loaded into constant pool 215 as they may directly contain the data.
- CONSTANT_String can be resolved by substituting the CONSTANT_String entry found in the class file into a reference to a memory location where a Unicode string object is located, the string object represented by data structure.
- the data structure representing a Unicode string object comprises a fixed length header, followed by Unicode-encoded string data.
- the CONSTANT_String entry in constant pool 215 may be stored as a length value indicating the length of the string data, followed by the string data. This set of resolutions can be performed at load time.
- a Class may be tested for presence by hashing a key located at the constant pool 215 entry at a CONSTANT_Class index into the global string pool.
- Class data structures 210 linked in the system Class Table 1020 may be searched to check a "Constant Pool Name and Key Reference", which may be stored in the class data structure 210 of each Class, to try and find a matching index. If a match is found, the class had already been loaded and the Class Pointer from the entry in the system Class Table 1020 is returned. If no match is found, then a class loader may load the class.
- a getfield instruction is encountered with the following state.
- the stack contains the object reference that is the target of the getfield.
- the bytecode for the getfield is followed by two operand bytes containing an index into the current class' constant pool 215 to a CONSTANT_Fieldref entry. The following steps may be used to resolve the getfield:
- the field is a 64-bit field then use the Field Offset (stored in field data structure 230) * 4 + 12 (the 4 provided to scale the value to bytes, the 12 provided to skip 8 bytes comprising the class pointer and the monitor, stored in the object data structure 250, and to skip a further 4 bytes to access the lowest 32-bits of the 64-bit field) and offset into the referenced object to access the low 32-bits of the data and push it on the stack.
- the Field Offset stored in field data structure 230
- 12 the 4 provided to scale the value to bytes, the 12 provided to skip 8 bytes comprising the class pointer and the monitor, stored in the object data structure 250, and to skip a further 4 bytes to access the lowest 32-bits of the 64-bit field
- a putfield instruction is encountered with the following state.
- the stack contains one or two words of data and the object reference that is the target of the putfield.
- the byte code for the putfield is followed by two operand bytes containing an index into the current class' constant pool to the Fieldref entry. The following steps may be used to resolve the putfield:
- a getstatic is encountered with the following state.
- the stack contains no data for the getstatic.
- the byte code for the getstatic is followed by two operand bytes containing an index into the current class' constant pool to the Fieldref entry. The following steps may be used to resolve the getstatic:
- the field is a 64-bit field then use the Field Offset * 4 + 12 and offset into the class static data structure 1000 to access the low 32-bits of the data and push it on the stack.
- a putstatic is encountered with the following state.
- the stack contains one or two words of data for the putstatic.
- the byte code for the putstatic is followed by two operand bytes containing an index into the current class' constant pool to the Fieldref entry. The following steps may be used to resolve the getstatic:
- the field is a 64-bit field then pop 32 bits of data off the stack and use the Field Offset * 4 + 12 and offset into the class static data structure 1000 to write the data.
- the stack contains the object reference that is the target of the virtual invocation and the set of calling parameters.
- the byte code for the invokevirtual is followed by two operand bytes containing an index into the current class' constant pool to the CONSTANTJVIethodref entry. The following steps may be used to resolve the invocation:
- Method Entry Access Flags (in method data structure 220) indicate a synchronous method then perform the following subsequence: a. If the Object Monitor Pointer is Null, allocate a monitor to the Object. b. If the Monitor Depth is greater than 0, block the thread on this monitor. c Set the Monitor Depth to 1 (Assume unblocked from above), d. Set Monitor Owner to the Class Table Current Thread (available in class table information header).
- An invokestatic is encountered with the following state.
- the stack contains the set of calling parameters.
- the byte code for the invokestatic is followed by two operand bytes containing an index into the current class' constant pool to the Methodref entry. The following steps may be used to resolve the invocation:
- Method Entry Access Flags stored in method data structure 220
- Method data structure 220 If the Method Entry Access Flags (stored in method data structure 220) indicate a synchronous method then perform the following subsequence: a. If the Class Object Monitor Pointer is Null, allocate a monitor to the Object. b. If the Monitor Depth is greater than 0, block the thread on this monitor, c Set the Monitor Depth to 1 (Assume unblocked from above). d. Set Monitor Owner to the Class Table Current Thread.
- Exception processing involves several steps to locate the exception (method) handler and invoke the method handler bytecodes. The process may involve the following steps:
- the system may be shut down.
- the scope of the shut down could be just the thread, the application, or the whole NM.
- the NM is terminated with a console error message.
- aspects of the invention are discussed herein in the context of an object-oriented processor core, the aspects may also benefit object-oriented instruction hardware accelerators, such as Java technology-based instruction translation accelerators for translating Java bytecode into sequences of native instructions.
- object-oriented instruction hardware accelerators such as Java technology-based instruction translation accelerators for translating Java bytecode into sequences of native instructions.
- aspects of the present invention have been described herein in the context of a specific JVM run-time architecture, aspects of the present invention may be applied to various object-oriented technologies, and various JVM run-time architectures. Details of specific data structures and inter-relationships between various data structures, are provided only to illustrate broader aspects of the present invention.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Advance Control (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
Description
Claims
Priority Applications (7)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| AU2002226968A AU2002226968A1 (en) | 2000-11-20 | 2001-11-20 | Data processor having multiple operating modes |
| AU2002241507A AU2002241507A1 (en) | 2000-11-20 | 2001-11-20 | System registers for an object-oriented processor |
| AU2002241505A AU2002241505A1 (en) | 2000-11-20 | 2001-11-20 | Methods and devices for caching method frame segments in a low-power stack-based processor |
| AU2002230445A AU2002230445A1 (en) | 2000-11-20 | 2001-11-20 | Interpretation loop for object oriented processor |
| PCT/US2001/043444 WO2002042898A2 (en) | 2000-11-20 | 2001-11-20 | Interpretation loop for object oriented processor |
| PCT/US2001/043829 WO2002045385A2 (en) | 2000-11-20 | 2001-11-20 | Methods and devices for caching method frame segments in a low-power stack-based processor |
| PCT/US2001/044031 WO2002071211A2 (en) | 2000-11-20 | 2001-11-20 | Data processor having multiple operating modes |
Applications Claiming Priority (12)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US25217000P | 2000-11-20 | 2000-11-20 | |
| US60/252,170 | 2000-11-20 | ||
| US25655000P | 2000-12-18 | 2000-12-18 | |
| US60/256,550 | 2000-12-18 | ||
| US27637501P | 2001-03-16 | 2001-03-16 | |
| US60/276,375 | 2001-03-16 | ||
| US32302201P | 2001-09-14 | 2001-09-14 | |
| US60/323,022 | 2001-09-14 | ||
| US09/956,130 | 2001-09-20 | ||
| US09/956,130 US20040015912A1 (en) | 2000-11-20 | 2001-09-20 | Method of byte code quickening: quick instructions for method invocation |
| PCT/US2001/043444 WO2002042898A2 (en) | 2000-11-20 | 2001-11-20 | Interpretation loop for object oriented processor |
| USPCT/US01/43444 | 2001-11-20 |
Publications (3)
| Publication Number | Publication Date |
|---|---|
| WO2002048864A2 true WO2002048864A2 (en) | 2002-06-20 |
| WO2002048864A8 WO2002048864A8 (en) | 2002-09-26 |
| WO2002048864A3 WO2002048864A3 (en) | 2004-02-26 |
Family
ID=27540310
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/US2001/043957 WO2002048864A2 (en) | 2000-11-20 | 2001-11-20 | System registers for an object-oriented processor |
Country Status (2)
| Country | Link |
|---|---|
| AU (1) | AU2002241507A1 (en) |
| WO (1) | WO2002048864A2 (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7146479B2 (en) | 2001-07-18 | 2006-12-05 | City U Research Limited | Method and apparatus of storage allocation/de-allocation in object-oriented programming environment |
| US7487507B1 (en) | 2001-07-18 | 2009-02-03 | City U Research Limited | Secure control transfer in information system |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5815718A (en) * | 1996-05-30 | 1998-09-29 | Sun Microsystems, Inc. | Method and system for loading classes in read-only memory |
| US6003038A (en) * | 1997-03-31 | 1999-12-14 | Sun Microsystems, Inc. | Object-oriented processor architecture and operating method |
| GB2336919A (en) * | 1998-04-30 | 1999-11-03 | Ibm | Pre-emptive threading in a virtual machine |
-
2001
- 2001-11-20 AU AU2002241507A patent/AU2002241507A1/en not_active Abandoned
- 2001-11-20 WO PCT/US2001/043957 patent/WO2002048864A2/en not_active Application Discontinuation
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7146479B2 (en) | 2001-07-18 | 2006-12-05 | City U Research Limited | Method and apparatus of storage allocation/de-allocation in object-oriented programming environment |
| US7487507B1 (en) | 2001-07-18 | 2009-02-03 | City U Research Limited | Secure control transfer in information system |
Also Published As
| Publication number | Publication date |
|---|---|
| AU2002241507A1 (en) | 2002-06-24 |
| WO2002048864A3 (en) | 2004-02-26 |
| WO2002048864A8 (en) | 2002-09-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US6003038A (en) | Object-oriented processor architecture and operating method | |
| US5999732A (en) | Techniques for reducing the cost of dynamic class initialization checks in compiled code | |
| KR100466722B1 (en) | An array bounds checking method and apparatus, and computer system including this | |
| EP3314422B1 (en) | Extending a virtual machine instruction set architecture | |
| Venners | The java virtual machine | |
| US5923878A (en) | System, method and apparatus of directly executing an architecture-independent binary program | |
| KR100529416B1 (en) | Method and apparatus of instruction folding for a stack-based machine | |
| KR100618756B1 (en) | Processors and computer systems that execute instruction sets received from network or local memory | |
| US6880155B2 (en) | Token-based linking | |
| US6792612B1 (en) | Java runtime system with modified constant pool | |
| US6338160B1 (en) | Constant pool reference resolution method | |
| US6704927B1 (en) | Static binding of dynamically-dispatched calls in the presence of dynamic linking and loading | |
| Yellin et al. | The java virtual machine specification | |
| KR20010006995A (en) | Application management | |
| US9038039B2 (en) | Apparatus and method for accelerating java translation | |
| US7003768B2 (en) | Method and apparatus for class intialization barriers and access to class variables in multitasking virtual machines | |
| US20040015912A1 (en) | Method of byte code quickening: quick instructions for method invocation | |
| US20020133638A1 (en) | Method and apparatus to facilitate sharing optimized instruction code in a multitasking virtual machine | |
| Aslam et al. | Introducing TakaTuka: a Java virtualmachine for motes | |
| Case | Implementing the Java virtual machine | |
| WO2002048864A2 (en) | System registers for an object-oriented processor | |
| US20040015873A1 (en) | Identifying references to objects during bytecode verification | |
| US6934726B2 (en) | Storing and retrieving of field descriptors in Java computing environments | |
| WO2002071211A2 (en) | Data processor having multiple operating modes | |
| Bracha et al. | Cldc byte code typechecker specification |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| AK | Designated states |
Kind code of ref document: A2 Designated state(s): AE AG AL AM AT AU AZ BA BB BG BR BY BZ CA CH CN CO CR CU CZ DE DK DM DZ EC EE ES FI GB GD GE GH GM HR HU ID IL IN IS JP KE KG KP KR KZ LC LK LR LS LT LU LV MA MD MG MK MN MW MX MZ NO NZ PH PL PT RO RU SD SE SG SI SK SL TJ TM TR TT TZ UA UG US UZ VN YU ZA ZW |
|
| AL | Designated countries for regional patents |
Kind code of ref document: A2 Designated state(s): GH GM KE LS MW MZ SD SL SZ TZ UG ZM ZW AM AZ BY KG KZ MD RU TJ TM AT BE CH CY DE DK ES FI FR GB GR IE IT LU MC NL PT SE TR BF BJ CF CG CI CM GA GN GQ GW ML MR NE SN TD TG |
|
| AK | Designated states |
Kind code of ref document: C1 Designated state(s): AE AG AL AM AT AU AZ BA BB BG BR BY BZ CA CH CN CO CR CU CZ DE DK DM DZ EC EE ES FI GB GD GE GH GM HR HU ID IL IN IS JP KE KG KP KR KZ LC LK LR LS LT LU LV MA MD MG MK MN MW MX MZ NO NZ PH PL PT RO RU SD SE SG SI SK SL TJ TM TR TT TZ UA UG US UZ VN YU ZA ZW |
|
| AL | Designated countries for regional patents |
Kind code of ref document: C1 Designated state(s): GH GM KE LS MW MZ SD SL SZ TZ UG ZM ZW AM AZ BY KG KZ MD RU TJ TM AT BE CH CY DE DK ES FI FR GB GR IE IT LU MC NL PT SE TR BF BJ CF CG CI CM GA GN GQ GW ML MR NE SN TD TG |
|
| CFP | Corrected version of a pamphlet front page | ||
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application | ||
| REG | Reference to national code |
Ref country code: DE Ref legal event code: 8642 |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: COMMUNICATION PURSUANT TO RULE 69 EPC (EPO FORM 1205A OF 030903) |
|
| 122 | Ep: pct application non-entry in european phase | ||
| NENP | Non-entry into the national phase |
Ref country code: JP |
|
| WWW | Wipo information: withdrawn in national office |
Country of ref document: JP |