JVM Tutorials - Herong's Tutorial Examples - v5.14, by Herong Yang
Bitwise Operation Instructions
This section describes JVM instructions that perform bitwise operations with operands on the stack: *sh*, *and, *or and *xor.
What Are Bitwise Operation Instructions? Bitwise operation instructions perform bitwise operations by taking operand(s) from the stack and push the result back to the stack. Their mnemonics have a pattern of *sh*, *and, *or or *xor.
The table below describes bitwise 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 ------------- -- -- -- -- ---------------------------------------- ishl 78 0 2 1 (32-bit) left shift by given distance lshl 79 0 2 1 (64-bit) left shift by given distance ishr 7A 0 2 1 (int) right shift by given distance lshr 7B 0 2 1 (long) right shift by given distance iushr 7C 0 2 1 (32-bit) right shift by given distance lushr 7D 0 2 1 (64-bit) right shift by given distance iand 7E 0 2 1 (32-bit) logical AND operation land 7F 0 2 1 (64-bit) logical AND operation ior 80 0 2 1 (32-bit) logical OR operation lor 81 0 2 1 (64-bit) logical OR operation ixor 82 0 2 1 (32-bit) logical XOR operation lxor 83 0 2 1 (64-bit) logical XOR operation
Note that there is no JVM instruction for logical NOT operation. You can use XOR with -1 to get the same result as NOT.
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