prev next contents
swap

swap top two stack words

Jasmin Syntax


    swap

Stack

Before

After
word1
word2
word2
word1
...
...
Description

Swaps the top two single-word items on the stack. word1/word2 cannot belong to a long or double.

Bytecode

Type

Description
u1
swap opcode = 0x5F (95)
Notes

There is no swap2, although you could use:


    dup2_x2
    pop2
to achieve the same effect.


prev next contents
Java Virtual Machine, by Jon Meyer and Troy Downing, O'Reilly Associates