ifgt 0x9d
Pops an int; jumps if it is greater than zero.
- Opcode
0x9d(157)- Family
- Branches and switches
- Operands
- 2 bytes: signed branch offset
- Length
- 3 bytes
- Operand stack
…, value (int) → …- Can throw
- nothing at run time (beyond linking errors)
- Spec name
if<cond>
What it does
Pops an int and jumps if it is > 0. The offset is two signed bytes, relative to this instruction.
javac compiles an if statement as a jump past the then-part when the condition is false, so the instruction is usually the opposite of the source: if (x <= 0) becomes ifgt to the else-part. It also follows lcmp, fcmpl and the other compare instructions, which push an int for it to test.
How often javac uses it
In JDK 25.0.5's java.base module, ifgt appears 702 times in 345 of its 7,391 classes: 0.04% of all instructions, the 116th most common of 194 opcodes in use. Some of the methods that use it: java.io.BufferedInputStream.<init>, java.io.BufferedOutputStream.<init>, java.io.BufferedReader.<init>, java.io.BufferedWriter.<init>.
Related instructions
ifle Pops an int; jumps if it is less than or equal to zero.if_icmpgt Pops two ints; jumps if the first is greater than the second.lcmp Compares two longs and pushes -1, 0 or 1.
Specification: JVMS §6.5, if<cond> (Java SE 25).