Next: Stack Manipulation Instructions
Up: The Instruction Set
Previous: Conversion Instructions
The instructions presented here create and manipulate class instances and
arrays.
The following instructions create an object or array:
- new. Create new class instance. Operands:
indexbyte1, indexbyte2. Stack: ...
..., objectref.
- newarray. Create new array. Operands:
atype. Stack: ..., count ..., arrayref.
- anewarray. Create new array of reference. Operands:
indexbyte1, indexbyte2. Stack: ..., count
..., arrayref.
- multianewarray. Create new multidimensional array. Operands:
indexbyte1, indexbyte2, dimensions. Stack:
..., count1, [count2, ...] ..., arrayref.
The following instructions access a field of a class or class instance:
- getfield. Load the value of a field of an object. Operands:
indexbyte1, indexbyte2. Stack: ..., objectref
..., value.
- putfield. Store a value in a field of an object. Operands:
indexbyte1, indexbyte2. Stack: ..., objectref, value
....
- getstatic. Load the value of a field of a class. Operands:
indexbyte1, indexbyte2. Stack: ... ..., value.
- putstatic. Store a value in a field of a class. Operands:
indexbyte1, indexbyte2. Stack: ..., value ....
The following instructions load or store values from or to an array:
- baload, caload, saload, iaload, faload,
laload, daload, aaload. Load a value of respectively type
byte or boolean, char, short, int, float,
long and double from an array. No operands. Stack:
..., arrayref, index ..., value.
- bastore, castore, sastore, iastore, fastore,
lastore, dastore, aastore. Store a value of respectively type
byte or boolean, char, short, int, float,
long and double in an array. No operands. Stack:
..., arrayref, index, value ....
There are also instructions to give the length of an array and do type checking
on objects.
Next: Stack Manipulation Instructions
Up: The Instruction Set
Previous: Conversion Instructions
mark@bottom.xs4all.nl