if_acmpeq 0xa5

Pops two references; jumps if they are the same object.

Opcode
0xa5 (165)
Family
Branches and switches
Operands
  • 2 bytes: signed branch offset
Length
3 bytes
Operand stack
…, value1 (reference), value2 (reference) → …
Can throw
nothing at run time (beyond linking errors)
Spec name
if_acmp<cond>

What it does

Pops two references and jumps if they are the same object. This is Java's == on references, which compares identity, not equals.

It is the instruction behind the classic Integer-cache surprise: two boxed Integers compare equal with == for small values (the same cached object) and unequal for large ones.

How often javac uses it

In JDK 25.0.5's java.base module, if_acmpeq appears 1,418 times in 521 of its 7,391 classes: 0.07% of all instructions, the 100th most common of 194 opcodes in use. Some of the methods that use it: java.io.BufferedInputStream.isTrusted, java.io.ByteArrayInputStream.transferTo, java.io.File.getParentFile, java.io.FilterOutputStream.close.

Related instructions

if_acmpne Pops two references; jumps if they are different objects.ifnull Pops a reference; jumps if it is null.ifnonnull Pops a reference; jumps if it is not null.

Specification: JVMS §6.5, if_acmp<cond> (Java SE 25).