sipush 0x11
Pushes a short, sign-extended to int.
- Opcode
0x11(17)- Family
- Constants
- Operands
- 2 bytes: signed short value
- Length
- 3 bytes
- Operand stack
… → …, value (int)- Can throw
- nothing at run time (beyond linking errors)
What it does
Pushes the signed two-byte operand as an int. javac uses it for int, short, byte and char constants from -32768 to 32767 that do not fit in a byte.
Larger constants go in the constant pool and are loaded with ldc.
How often javac uses it
In JDK 25.0.5's java.base module, sipush appears 34,361 times in 834 of its 7,391 classes: 1.8% of all instructions, the 19th most common of 194 opcodes in use. Some of the methods that use it: java.io.BufferedInputStream.<init>, java.io.BufferedOutputStream.initialBufferSize, java.io.BufferedReader.<init>, java.io.BufferedWriter.initialBufferSize.
Examples
From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; sipush is highlighted.
static int check(int n) in Constants, compiled by javac 25static int ints(int a, int b) in Tour, compiled by javac 25Related instructions
iconst_0 Pushes the int constant 0.bipush Pushes a byte, sign-extended to int.ldc Pushes a constant from the constant pool (index in one byte).
Specification: JVMS §6.5, sipush (Java SE 25).