Contents Prev Next Up

## The Java Virtual Machine

# Registers

The registers of the Java virtual machine maintain machine state during its operation. They are directly analogous to the registers of a microprocessor. The Java virtual machine's registers include:

- pc -- the Java program counter

- optop -- a pointer to the top of the Java operand stack

- frame -- a pointer to the execution environment of the currently executing method

- vars -- a pointer to the 0th local variable of the currently executing method

The Java virtual machine defines each of its registers to be 32 bits wide. Some Java implementations may not use all of these registers: e.g. a compiler from Java source to native code does not maintain pc.

The Java virtual machine is stack-based, so it does not define or use registers for passing or receiving parameters. This is again a conscious decision in favor of instruction set simplicity and compactness, and efficient implementation on host processors without many registers (e.g. Intel 486).

Contents Prev Next Up

Generated with CERN WebMaker