JVM Tutorials - Herong's Tutorial Examples - v5.14, by Herong Yang
Arithmetic Operation Instructions
This section describes JVM instructions that perform arithmetic operations with operand(s) on the stack: *add, *sub, *mul, *div, *rem and *neg.
What Are Arithmetic Operation Instructions? Arithmetic operation instructions perform arithmetic operations by taking operand(s) from the stack and push the result back to the stack. Their mnemonics have a pattern of *add, *sub, *mul, *div, *rem or *neg.
The table below describes arithmetic operation instructions. P. is the count of bytes following the opcode as operation parameters. I. is the count elements consumed from the operand stack as operation input. O. is the count elements added to the operand stack as operation output.
Mnemonic C. P. I. O. Description ------------- -- -- -- -- ---------------------------------------- iadd 60 0 2 1 (int) add two operands ladd 61 0 2 1 (long) add two operands fadd 62 0 2 1 (float) add two operands dadd 63 0 2 1 (double) add two operands isub 64 0 2 1 (int) subtract operand #2 from #1 lsub 65 0 2 1 (long) subtract operand #2 from #1 fsub 66 0 2 1 (float) subtract operand #2 from #1 dsub 67 0 2 1 (double) subtract operand #2 from #1 imul 68 0 2 1 (int) multiply two operands lmul 69 0 2 1 (long) multiply two operands fmul 6A 0 2 1 (float) multiply two operands dmul 6B 0 2 1 (double) multiply two operands idiv 6C 0 2 1 (int) divide operand #1 by #2 ldiv 6D 0 2 1 (long) divide operand #1 by #2 fdiv 6E 0 2 1 (float) divide operand #1 by #2 ddiv 6F 0 2 1 (double) divide operand #1 by #2 irem 70 0 2 1 (int) take remainder of idiv lrem 71 0 2 1 (long) take remainder of ldiv frem 72 0 2 1 (float) take remainder of fdiv drem 73 0 2 1 (double) take remainder of ddiv ineg 74 0 1 1 (int) negate the operand lneg 75 0 1 1 (long) negate the operand fneg 76 0 1 1 (float) negate the operand dneg 77 0 1 1 (double) negate the operand
Table of Contents
JVM (Java Virtual Machine) Specification
Java HotSpot VM - JVM by Oracle/Sun
java.lang.Runtime Class - The JVM Instance
java.lang.System Class - The Operating System
ClassLoader Class - Class Loaders
Class Class - Class Reflections
JVM Stack, Frame and Stack Overflow
Thread Testing Program and Result
CPU Impact of Multi-Thread Applications
I/O Impact of Multi-Thread Applications
Micro Benchmark Runner and JVM Options
Micro Benchmark Tests on "int" Operations
Micro Benchmark Tests on "long" Operations
Micro Benchmark Tests in JIT Compilation Mode
Micro Benchmark Tests on "float" and "double" Operations
JRockit JVM 28.2.7 by Oracle Corporation
►JVM Bytecode and Instruction Set
Walkthrough of "javap -c -v" Command Output
Local Variable Array Instructions
►Arithmetic Operation Instructions
Bitwise Operation Instructions
Method Invocation Instructions