Java Reference
In-Depth Information
D.5.4
Array Instructions
Mnemonic
Operation
Operand Stack
newarray Create new array
;count ) ;arrayref
anewarray Create new array of refer-
ence type
;count ) ;arrayref
The above instructions can be added to the code section of a method by sending the
CLEmitter instance the following message:
publicvoidaddArrayInstruction(intopcode,
Stringtype)
where opcode is the mnemonic of the instruction to be added, and type is the type descriptor
of the array.
Mnemonic
Operation
Operand Stack
multianewarray Create
new
multidimen-
;count1; [count2;]
) ;arrayref
sional array
The above instruction can be added to the code section of a method by sending the
CLEmitter instance the following message:
publicvoidaddMULTIANEWARRAYInstruction(Stringtype,
intdim)
where type is the type descriptor of the array, and dim is the number of dimensions.
Mnemonic
Operation
Operand Stack
baload Load byte or boolean
from array
;arrayref;index ) ;value
caload Load char from array ;arrayref;index ) ;value
saload Load short from array ;arrayref;index ) ;value
iaload Load int from array ;arrayref;index ) ;value
laload Load long from array ;arrayref;index ) ;value
faload Load float from array ;arrayref;index ) ;value
daload Load double from array ;arrayref;index ) ;value
aaload Load from reference array ;arrayref;index ) ;value
bastore Store into byte or
boolean array
;arrayref;index;value )
castore Store into char array ;arrayref;index;value )
sastore Store into short array ;arrayref;index;value )
iastore Store into int array ;arrayref;index;value )
lastore Store into long array ;arrayref;index;value )
fastore Store into float array ;arrayref;index;value )
dastore Store into double array ;arrayref;index;value )
aastore Store into reference array ;arrayref;index;value )
arraylength Get length of array
;arrayref ) ;length
The above instructions can be added to the code section of a method by sending the
CLEmitter instance the following message:
 
Search WWH ::




Custom Search