lastore 0x50

Pops an array, an index and a long value; stores the value in the array.

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

What it does

Pops an array (long[]), an index and a value; stores the value at that index.

How often javac uses it

In JDK 25.0.5's java.base module, lastore appears 2,949 times in 80 of its 7,391 classes: 0.15% of all instructions, the 75th most common of 194 opcodes in use. Some of the methods that use it: java.io.ObjectInputStream$BlockDataInputStream.readLongs, java.io.ObjectStreamClass$FieldReflector.<init>, java.lang.invoke.MethodHandleImpl$ArrayAccessor.setElementJ, java.lang.invoke.VarHandleLongs$Array.set.

Example

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

static long assignLongElement(long[] a, long v) in Tour, compiled by javac 25
86return a[0] = v;
0aload_0 // a
2lload_1 // v

Open in the viewer

Related instructions

laload Pops an array and an index; pushes the long element.arraylength Pops an array; pushes its length.newarray Pops a length; pushes a new array of a primitive type.

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