∟What Is Constant Pool

This section provides a quick introduction of constant pool created in the bytecode file and loaded in the JVM method area.

What Is Constant Pool? Constant pool is a list of constants and their types stored in the bytecode file. It has following main features:

Here is an example of constant pool printed out by the "javap" command from Add.class used in previous tutorials.

Constant pool:
   #1 = Methodref          #2.#3     // java/lang/Object."<init>":()V
   #2 = Class              #4        // java/lang/Object
   #3 = NameAndType        #5:#6     // "<init>":()V
   #4 = Utf8               java/lang/Object
   #5 = Utf8               <init>
   #6 = Utf8               ()V
   #7 = Class              #8        // Add
   #8 = Utf8               Add
   #9 = Utf8               Code
  #10 = Utf8               LineNumberTable
  #11 = Utf8               add
  #12 = Utf8               (II)I
  #13 = Utf8               SourceFile
  #14 = Utf8               Add.java

The example shows 4 types of values:

Other value types are also supported by JVM like: Integer, Long, Float and Double.

Note that JVM uses the following shorthand conventions in descriptor values:

Shorthand  Java Type
---------  ---------
B          byte
C          char
D          double
F          float
I          int
J          long
S          short
V          void
Z          boolean
[t         array
Lclass;    object

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