faload 0x30

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

Opcode
0x30 (48)
Family
Arrays
Operands
none
Length
1 byte
Operand stack
…, arrayref, index → …, value (float)
Can throw
NullPointerException, ArrayIndexOutOfBoundsException

What it does

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

How often javac uses it

In JDK 25.0.5's java.base module, faload appears 154 times in 13 of its 7,391 classes: <0.01% of all instructions, the 151st most common of 194 opcodes in use. Some of the methods that use it: java.io.ObjectOutputStream$BlockDataOutputStream.writeFloats, java.lang.classfile.AnnotationValue.of, java.lang.invoke.MethodHandleImpl$ArrayAccessor.getElementF, java.lang.invoke.VarHandleFloats$Array.get.

Example

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

static int arrays(int n) in Tour, compiled by javac 25
… 98 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;
140laload
141l2i
142iadd
143aload 7// f
146faload
147f2i
148iadd
149aload 8// d
152daload
153d2i
… 16 instructions after

Open in the viewer

Related instructions

fastore Pops an array, an index and a float 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, faload (Java SE 25).