dup2

Duplicate top two operand stack words

Bytecode

Type Description
u1 dup2 opcode = 0x5C (92)

Stack ..., word2, word1 => ..., word2, word1, word2, word1

Description
Duplicates the top two words on the stack and pushes the duplicates onto the stack in the same order. You can use this to duplicate two single-word items (e.g. two integers, or an integer and an object reference) or one two-word item (i.e. a double or a long).

The top two words on the operand stack are duplicated and pushed onto the operand stack, in the original order.

The dup2 instruction must not be used unless each of word1 and word2 is a word that contains a 32-bit data type or both together are the two words of a single 64-bit datum.

Except for restrictions preserving the integrity of 64-bit data types, the dup2 instruction operates on untyped words, ignoring the types of the data they contain.