laload 0x2f

Pops an array and an index; pushes the long element.

Opcode
0x2f (47)
Family
Arrays
Operands
none
Length
1 byte
Operand stack
…, arrayref, index → …, value (long)
Can throw
NullPointerException, ArrayIndexOutOfBoundsException

What it does

Pops an array (long[]) and an index; pushes the element at that index.

How often javac uses it

In JDK 25.0.5's java.base module, laload appears 7,327 times in 94 of its 7,391 classes: 0.38% of all instructions, the 51st most common of 194 opcodes in use. Some of the methods that use it: java.io.ObjectOutputStream$BlockDataOutputStream.writeLongs, java.io.ObjectStreamClass$FieldReflector.getPrimFieldValues, java.lang.classfile.AnnotationValue.of, java.lang.invoke.MethodHandleImpl$ArrayAccessor.getElementJ.

Example

From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; laload is highlighted.

static int arrays(int n) in Tour, compiled by javac 25
… 93 instructions before
69return (z[0] ? 1 : 0) + b[0] + c[0] + s[0] + i[0] + (int) l[0] + (int) f[0] + (int) d[0] + str[0].length() + grid[0][0] + grid.length;
135iaload
136iadd
137aload 6// l
140laload
141l2i
142iadd
143aload 7// f
146faload
147f2i
… 21 instructions after

Open in the viewer

Related instructions

lastore Pops an array, an index and a long value; stores the value in the array.arraylength Pops an array; pushes its length.newarray Pops a length; pushes a new array of a primitive type.

Specification: JVMS §6.5, laload (Java SE 25).