CONSTANT_Long tag 5
A long constant, loaded with ldc2_w.
- Tag
5- Since
- class file 45.0 (Java 1.0)
- Size
- 9 bytes
- Loadable
- yes, with
ldc2_w - Referred to by
- ldc2_w
- ConstantValue of long fields
Layout
| Type | Field | What it holds |
|---|---|---|
u1 | tag | 5 |
u4 | high_bytes | upper 32 bits |
u4 | low_bytes | lower 32 bits |
What it is for
A long constant, loaded with ldc2_w. 0L and 1L have lconst instructions.
A Long takes two constant pool slots: if it is entry 7, the next entry is 9, and index 8 is unusable. The specification itself says that in retrospect this was a poor choice. It is why constant_pool_count is not simply the number of entries.
How common it is
JDK 25.0.5's java.base has 4,374 Long constants in 1,156 of its 7,391 classes: 0.41% of all 1,059,609 constants.
A real one, byte by byte
Constant #44 of Constants.class, compiled by javac 25:
| Offset | Bytes | Field | Value |
|---|---|---|---|
| 401 | 9 bytes | #44 Long | 1099511627776L |
| 401 | 05 | tag | 5 (Long) |
| 402 | 00 00 01 00 | high_bytes | 256 |
| 406 | 00 00 00 00 | low_bytes | 0 |
Specification: JVMS §4.4, CONSTANT_Long_info (Java SE 25).