∟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

 About This Book

 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 Runtime Data Areas

 JVM Stack, Frame and Stack Overflow

 Thread Testing Program and Result

 CPU Impact of Multi-Thread Applications

 I/O Impact of Multi-Thread Applications

 CDS (Class Data Sharing)

 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

 OpenJ9 by Eclipse Foundation

 JRockit JVM 28.2.7 by Oracle Corporation

►JVM Bytecode and Instruction Set

 What Is JVM Bytecode

 What Is "javap" Command

 Walkthrough of "javap -c -v" Command Output

 JVM Method Frame Architecture

 What Is Constant Pool

 JVM Instruction Set

 Constant Loading Instructions

 Local Variable Array Instructions

 Shared Memory Instructions

 Arithmetic Operation Instructions

►Bitwise Operation Instructions

 Type Conversion Instructions

 Flow Control Instructions

 Method Invocation Instructions

 Miscellaneous Instructions

 JVM Assembler/Disassembler Tools

 Archived Tutorials

 References

 Index

 Full Version in PDF/EPUB