VM Spec

Contents | Prev | Next | Index | The JavaTM Virtual Machine Specification

A B C D F G I J L M N P R S T W

## saload

Operation

> Load `short` from array

Format

> saload

Forms

> saload = 53 (0x35)

Operand Stack

> ..., arrayref, index ..., value

Description

> The arrayref must be of type `reference` and must refer to an array whose components are of type `short`. The index must be of type `int`. Both arrayref and index are popped from the operand stack. The component of the array at index is retrieved and sign-extended to an `int` value. That value is pushed onto the operand stack.

Runtime Exceptions

> If arrayref is `null`, saload throws a `NullPointerException`.

> Otherwise, if index is not within the bounds of the array referenced by arrayref, the saload instruction throws an `ArrayIndexOutOf` `BoundsException`.

## sastore

Operation

> Store into `short` array

Format

> sastore

Forms

> sastore = 86 (0x56)

Operand Stack

> ..., array, index, value ...

Description

> The arrayref must be of type `reference` and must refer to an array whose components are of type `short`. Both index and value must be of type `int`. The arrayref, index, and value are popped from the operand stack. The `int` value is truncated to a `short` and stored as the component of the array indexed by index.

Runtime Exceptions

> If arrayref is `null`, sastore throws a `NullPointerException`.

> Otherwise, if index is not within the bounds of the array referenced by arrayref, the sastore instruction throws an `ArrayIndexOutOf` `BoundsException`.

## sipush

Operation

> Push `short`

Format

> sipush
> byte1
> byte2

Forms

> sipush = 17 (0x11)

Operand Stack

> ... ..., value

Description

> The immediate unsigned byte1 and byte2 values are assembled into an intermediate `short` where the value of the short is (byte1 << 8) | byte2. The intermediate value is then sign-extended to an `int` value. That value is pushed onto the operand stack.

## swap

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 jvm@java.sun.com