Contents | Prev | Next | Index | The JavaTM Virtual Machine Specification |
Operation
Loadbyte
orboolean
from array
Format
baload
Forms
baload = 51 (0x33)
Operand Stack
..., arrayref, index ..., value
Description
The arrayref must be of typereference
and must refer to an array whose components are of typebyte
or of typeboolean
. The index must be of typeint
. Both arrayref and index are popped from the operand stack. If the components of the array are of typebyte
, the component of the array at index is retrieved and sign-extended to anint
value. If the components of the array are of typeboolean
, the component of the array at index is retrieved and zero-extended to anint
value. In either case the resulting value is pushed onto the operand stack.
Runtime Exceptions
If arrayref isnull
, baload throws aNullPointerException
.
Otherwise, if index is not within the bounds of the array referenced by arrayref, the baload instruction throws anArrayIndex
OutOfBoundsException
.
Notes
The baload instruction is used to load values from bothbyte
andboolean
arrays. In Sun's implementation of the Java virtual machine,boolean
arrays (arrays of typeT_BOOLEAN
; see §3.2 and the description of the newarray instruction in this chapter) are implemented as arrays of 8-bit values. Other implementations may implement packedboolean
arrays; the baload instruction of such implementations must be used to access those arrays.
Operation
Store intobyte
orboolean
array
Format
bastore
Forms
bastore = 84 (0x54)
Operand Stack
..., arrayref, index, value ...
Description
The arrayref must be of typereference
and must refer to an array whose components are of typebyte
or of typeboolean
. The index and the value must both be of typeint
. The arrayref, index, and value are popped from the operand stack. If the components of the array are of typebyte
, theint
value is truncated to abyte
and stored as the component of the array indexed by index. If the components of the array are of typeboolean
, theint
value is truncated to its low order bit then zero-extended to the storage size for components ofboolean
arrays used by the implementation. The result is stored as the component of the array indexed by index.
Runtime Exceptions
If arrayref isnull
, bastore throws aNullPointerException
.
Otherwise, if index is not within the bounds of the array referenced by arrayref, the bastore instruction throws an ArrayIndexOutOfBoundsException
.
Notes
The bastore instruction is used to store values into bothbyte
andboolean
arrays. In Sun's implementation of the Java virtual machine,boolean
arrays (arrays of typeT_BOOLEAN
; see §3.2 and the description of the newarray instruction in this chapter) are implemented as arrays of 8-bit values. Other implementations may implement packedboolean
arrays; in such implementations the bastore instruction must be able to storeboolean
values into packedboolean
arrays as well asbyte
values intobyte
arrays.
Operation
Pushbyte
Format
bipush byte
Forms
bipush = 16 (0x10)
Operand Stack
... ..., value
Description
The immediate byte is sign-extended to an int
value. That value is pushed onto the operand stack.
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]