JVM Tutorials - Herong's Tutorial Examples - v5.14, by Herong Yang
Type Conversion Instructions
This section describes JVM instructions that convert an operand in one type to another type: *2*.
What Are Type Conversion Instructions? Type conversion instructions convert an operand in one type to another type. Their mnemonics have a pattern of *2*.
The table below describes type conversion 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 ------------- -- -- -- -- ---------------------------------------- i2l 85 0 1 2 Convert int to long i2f 86 0 1 1 Convert int to float i2d 87 0 1 2 Convert int to double l2i 88 0 2 1 Convert long to int l2f 89 0 2 1 Convert long to float l2d 8A 0 2 2 Convert long to double f2i 88 0 1 1 Convert float to int f2l 8C 0 1 2 Convert float to long f2d 8D 0 1 2 Convert float to double d2i 8E 0 2 1 Convert double to int d2l 8F 0 2 2 Convert double to long d2f 90 0 2 1 Convert double to float i2b 91 0 1 1 Convert int to byte i2c 92 0 1 1 Convert int to char i2s 93 0 1 1 Convert int to short
Note that there is no need to have instructions to convert byte, char or short to int, because they are automatically converted to int when they are loaded to the operand stack.
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