LIST 67 ============================================================================ 1.1 Supported Data Types The virtual machine data types include the basic data types of the Java language: byte // 1-byte signed 2's complement integer short // 2-byte signed 2's complement integer int // 4-byte signed 2's complement integer long // 8-byte signed 2's complement integer float // 4-byte IEEE 754 single-precision float double // 8-byte IEEE 754 double-precision float char // 2-byte unsigned Unicode character Other virtual machine data types include: object // 4-byte reference to a Java object returnAddress // 4 bytes, used with jsr/ret/jsr_w/ret_w instructions Note: Java arrays are treated as objects. 1.2 Registers Each method has memory space allocated for it to hold: * a set of local variables, referenced by a vars register, * an operand stack, referenced by an optop register, and * a execution environment structure, referenced by a frame register. All of these registers are 32 bits wide. 1.3 Local Variables Each Java method uses a fixed-sized set of local variables. They are addressed as word offsets from the vars register. Local variables are all 32 bits wide. 1.4 The Operand Stack The operand stack is 32 bits wide. It is used to pass parameters to methods and receive method results, as well as to supply parameters for operations and save operation results. In our description of the virtual machine instructions below, the effect of an instruction's execution on the operand stack is represented textually, with the stack growing from left to right, and each 32-bit word separately represented. Thus: Stack: ..., value1, value2 => ..., value3 The types long and double take two 32-bit words on the operand stack: Stack: ... => ..., value-word1, value-word2 1.5 Execution Environment 1.6 Garbage Collected Heap 1.7 Method Area ------------------------- 1.8 The Java Instruction Set An instruction in the Java instruction set consists of a one-byte opcode specifying the operation to be performed, and zero or more operands supplying parameters or data that will be used by the operation. Many instructions have no operands and consist only of an opcode. The inner loop of the virtual machine execution is effectively: do { fetch an opcode byte execute an action depending on the value of the opcode } while (there is more to do); The number and size of the additional operands is determined by the opcode. If an additional operand is more than one byte in size, then it is stored in big-endian order -- high order byte first. For example, a 16-bit parameter is stored as two bytes whose value is: first_byte * 256 + second_byte 1.9 Limitations The per-class constant pool has a maximum of 65535 entries. This acts as an internal limit on the total complexity of a single class. Besides this limit, the only other limitation of note is that the number of words of arguments in a method call is limited to 255. ============================================================================