lconst_0 0x09
Pushes the long constant 0.
- Opcode
0x09(9)- Family
- Constants
- Operands
- none
- Length
- 1 byte
- Operand stack
… → …, 0 (long)- Can throw
- nothing at run time (beyond linking errors)
- Spec name
lconst_<l>
What it does
Pushes the long 0L. Only 0 and 1 have one-byte instructions; any other long constant needs ldc2_w of a Long constant.
How often javac uses it
In JDK 25.0.5's java.base module, lconst_0 appears 2,402 times in 515 of its 7,391 classes: 0.12% of all instructions, the 81st most common of 194 opcodes in use. Some of the methods that use it: java.io.BufferedInputStream.skip, java.io.BufferedReader.skip, java.io.ByteArrayInputStream.skip, java.io.CharArrayReader.skip.
Example
From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; lconst_0 is highlighted.
static long constants() in Tour, compiled by javac 25… 5 instructions before
… 30 instructions after
Related instructions
ldc2_w Pushes a long or double constant from the constant pool.
Specification: JVMS §6.5, lconst_<l> (Java SE 25).