Contents | Prev | Next | Index | The JavaTM Virtual Machine Specification |
Operation
Loadshort
from array
Format
saload
Forms
saload = 53 (0x35)
Operand Stack
..., arrayref, index ..., value
Description
The arrayref must be of typereference
and must refer to an array whose components are of typeshort
. The index must be of typeint
. Both arrayref and index are popped from the operand stack. The component of the array at index is retrieved and sign-extended to anint
value. That value is pushed onto the operand stack.
Runtime Exceptions
If arrayref isnull
, saload throws aNullPointerException
.
Otherwise, if index is not within the bounds of the array referenced by arrayref, the saload instruction throws anArrayIndexOutOf
BoundsException
.
Operation
Store intoshort
array
Format
sastore
Forms
sastore = 86 (0x56)
Operand Stack
..., array, index, value ...
Description
The arrayref must be of typereference
and must refer to an array whose components are of typeshort
. Both index and value must be of typeint
. The arrayref, index, and value are popped from the operand stack. Theint
value is truncated to ashort
and stored as the component of the array indexed by index.
Runtime Exceptions
If arrayref isnull
, sastore throws aNullPointerException
.
Otherwise, if index is not within the bounds of the array referenced by arrayref, the sastore instruction throws anArrayIndexOutOf
BoundsException
.
Operation
Pushshort
Format
sipush byte1 byte2
Forms
sipush = 17 (0x11)
Operand Stack
... ..., value
Description
The immediate unsigned byte1 and byte2 values are assembled into an intermediateshort
where the value of the short is (byte1 << 8) | byte2. The intermediate value is then sign-extended to anint
value. That value is pushed onto the operand stack.
Operation
Swap the top two operand stack values
Format
swap
Forms
swap = 95 (0x5f)
Operand Stack
..., value2, value1 ..., value1, value2
Description
Swap the top two values on the operand stack.
The swap instruction must not be used unless value1 and value2 are both values of a category 1 computational type (§3.11.1).
Notes
The Java virtual machine does not provide an instruction implementing a swap on operands of category 2 computational types.
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]