Construct a new array of the indicated type and size. The type must be an array
type.
Details
Op & Format
Mnemonic / Syntax
Arguments
23 22c
new-array vA, vB, type@CCCC
A: destination register (8 bits) B: size register C: type index
Constraints
A and B must be valid register indices for the current stack frame.
Register vB must not contain a reference value.
Register vB must not be part of a register pair.
C must be a valid index into the type pool.
Type constant pool entry C must contain a valid array type descriptor.
Behavior
An attempt is made to get a reference to the class K the name of which is
contained in type pool entry C.
If K has not been loaded and resolved before, it is being loaded and
resolved. All exceptions that are possible during class loading can occur at
this point.
An attempt is made to create a new instance I of K and length B. All
exceptions that are possible during instantiation can occur at this point.
All elements of the new array are initialized to null (for object arrays) or
0 (for numeric arrays) or false (for boolean arrays).
A reference to the new array is moved to register vA, that is, vA' = I.
If v(A-1) is the lower half of a register pair, v(A-1)' becomes undefined.
If v(A+1) is the upper half of a register pair, v(A+1)' becomes undefined.
Exceptions
NegativeArraySizeException if vB < 0
All exceptions that are possible during class loading can occur.
All exceptions that are possible during instantiation can occur.