lconst_1 0x0a
Pushes the long constant 1.
- Opcode
0x0a(10)- Family
- Constants
- Operands
- none
- Length
- 1 byte
- Operand stack
… → …, 1 (long)- Can throw
- nothing at run time (beyond linking errors)
- Spec name
lconst_<l>
What it does
Pushes the long 1L. 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_1 appears 987 times in 286 of its 7,391 classes: 0.05% of all instructions, the 109th most common of 194 opcodes in use. Some of the methods that use it: java.io.FileInputStream.traceRead0, java.io.FileOutputStream.traceWrite, java.io.InputStream.skipNBytes, java.io.ObjectInputStream.readObject0.
Examples
From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; lconst_1 is highlighted.
static long staticLong() in Increments, compiled by javac 25static long constants() in Tour, compiled by javac 25Related instructions
ldc2_w Pushes a long or double constant from the constant pool.
Specification: JVMS §6.5, lconst_<l> (Java SE 25).