fstore 0x38

Pops a float into local variable (operand).

Opcode
0x38 (56)
Family
Stores
Operands
  • 1 byte: local variable index
Length
2 bytes
Operand stack
…, value (float) → …
Can throw
nothing at run time (beyond linking errors)

What it does

Pops a float into the local variable named by its operand.

Slots 0 to 3 have one-byte forms (fstore_0 to fstore_3); javac uses this form for slots 4 to 255, and wide for slots above 255.

How often javac uses it

In JDK 25.0.5's java.base module, fstore appears 54 times in 14 of its 7,391 classes: <0.01% of all instructions, the 167th most common of 194 opcodes in use. Some of the methods that use it: java.lang.classfile.AnnotationValue.of, java.lang.Float.float16ToFloat, java.nio.BufferMismatch.mismatch, java.nio.DirectByteBuffer.getFloat.

Example

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

static double convert(int i, long l, float f, double d) in Tour, compiled by javac 25
… 9 instructions before
41long il = i;
12iload_0 // i
13i2l
14lstore 9// il
42float lf = l;
16lload_1 // l
17l2f
18fstore 11// lf
43int fi = (int) f;
20fload_3 // f
21f2i
22istore 12// fi
44long dl = (long) d;
24dload 4// d
26d2l
27lstore 13// dl
… 63 instructions after

Open in the viewer

Related instructions

fload Pushes the float in local variable (operand).fstore_0 Pops a float into local variable 0.wide Makes the next instruction take a two-byte local index (and a two-byte iinc constant).

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