Module rust_jvm::vm::constant_pool [] [src]

The runtime constant pool.

Near the beginning of every Java class file is a section known as the constant pool. Broadly speaking, this constant pool contains two types of values: symbolic references and literals. Symbolic references are the names and signatures of classes, fields, and methods referred to in the file, which are resolved into their runtime representations by the JVM. Literals can be of primitive types or String literals, which are stored in a format called "modified UTF-8". The constant pool is defined in §4.4 of the specification.

One of the class loader's tasks is to construct a runtime constant pool from the constant pool contained in the class file. This module contains the structures representing that runtime constant pool, which are the structures actually used when constant pool entries are referred to in Java bytecode. More information about the runtime constant pool is found in §5.1 of the specification.

There are many instructions which refer to entries in the runtime constant pool. Any instruction which refers to a particular class, like the new instruction, refers to a symbolic reference in the runtime constant pool; any instruction referring to a field or method similarly also refers to a symbolic reference. In addition, the ldc, ldc_w, and ldc2_w instructions allow Java bytecode to directly load constant literals (and, if reflection were implemented, other constant pool entries as well) onto the stack for manipulation by the program.

Reexports

pub use model::class_file::constant_pool::constant_pool_index;

Structs

ModifiedUtf8String

Represents a modified UTF-8 string (§4.4.7). This structure is created directly from the bytes in the class file, and has not undergone any kind of validation.

RuntimeConstantPool

A runtime constant pool. This just consists of a OneIndexedVec of constant pool entries.

Enums

RuntimeConstantPoolEntry

An constant value in the runtime constant pool.