|Contents | Prev | Next | Index||The JavaTM Virtual Machine Specification|
new = 187 (0xbb)
... ..., objectref
The unsigned indexbyte1 and indexbyte2 are used to construct an index into the runtime constant pool of the current class (§3.6), where the value of the index is (indexbyte1 << 8) | indexbyte2. The runtime constant pool item at the index must be a symbolic reference to a class, array, or interface type. The named class, array, or interface type is resolved (§18.104.22.168) and should result in a class type (it should not result in an array or interface type). Memory for a new instance of that class is allocated from the garbage-collected heap, and the instance variables of the new object are initialized to their default initial values (§2.5.1). The objectref, a
referenceto the instance, is pushed onto the operand stack.
On successful resolution of the class, it is initialized (§5.5) if it has not already been initialized.
During resolution of the symbolic reference to the class, array, or interface type, any of the exceptions documented in Section 22.214.171.124 can be thrown.
Otherwise, if the symbolic reference to the class, array, or interface type resolves to an interface or is an
abstractclass, new throws an
Otherwise, if execution of this new instruction causes initialization of the referenced class, new may throw an
Erroras detailed in Section 2.17.5.
The new instruction does not completely create a new instance; instance creation is not completed until an instance initialization method has been invoked on the uninitialized instance.
newarray = 188 (0xbc)
..., count ..., arrayref
The count must be of type
int. It is popped off the operand stack. The count represents the number of elements in the array to be created.
The atype is a code that indicates the type of array to create. It must take one of the following values:
Array Type atype
A new array whose components are of type atype and of length count is allocated from the garbage-collected heap. A
referencearrayref to this new array object is pushed into the operand stack. Each of the elements of the new array is initialized to the default initial value for the type of the array (§2.5.1).
If count is less than zero, newarray throws a
In Sun's implementation of the Java virtual machine, arrays of type
T_BOOLEAN) are stored as arrays of 8-bit values and are manipulated using the baload and bastore instructions, instructions that also access arrays of type
byte. Other implementations may implement packed
booleanarrays; the baload and bastore instructions must still be used to access those arrays.
nop = 0 (0x0)
Contents | Prev | Next | Index
The JavaTM Virtual Machine Specification
Copyright © 1999 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to [email protected]