ifge 0x9c
Pops an int; jumps if it is greater than or equal to zero.
- Opcode
0x9c(156)- 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 ifge 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, ifge appears 2,002 times in 667 of its 7,391 classes: 0.10% of all instructions, the 90th most common of 194 opcodes in use. Some of the methods that use it: java.io.BufferedInputStream.read, java.io.BufferedOutputStream.growIfNeeded, java.io.BufferedReader.skip, java.io.BufferedWriter.growIfNeeded.
Examples
From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; ifge is highlighted.
static boolean longLess(long a, long b) in Compare, compiled by javac 25static String sign(int x) in Conditions, compiled by javac 25Related instructions
iflt Pops an int; jumps if it is less than zero.if_icmpge Pops two ints; jumps if the first is greater than or equal to the second.lcmp Compares two longs and pushes -1, 0 or 1.
Specification: JVMS §6.5, if<cond> (Java SE 25).