JVM Concepts

How the JVM works under the hood, one concept at a time.

Sort

Compilation & Bytecode

1
🔬 Lab

The .class File Format: Header, Constant Pool, Fields, and Methods

How javac turns Java source into a structured binary .class file — magic number and version in the header, the constant pool's table of symbolic references, access flags, how fields and methods are laid out for the JVM to load and execute, and the one-letter descriptor codes (B/C/D/F/I/J/S/Z, L...;, [) that encode every type in the file.

2

JIT Compilation and Tiered Compilation: C1, C2, and Warm-Up

How the JVM compiles bytecode to native code while the program runs, why it waits for code to get "hot" before compiling it, and how tiered compilation combines a fast-starting compiler (C1) with a slower, smarter one (C2).

3

Bytecode Instructions: The Operand Stack, Arithmetic, and Type Conversions

How bytecode's stack-machine arithmetic works — the i/l/f/d mnemonic prefixes, why float and double comparisons need two opcodes to handle NaN correctly, and why narrowing conversions like d2i and i2b lose data silently instead of throwing.

4

Bytecode Instructions: Object Creation, Field Access, and Method Dispatch

Why 'new' is allocate-then-construct as two separate instructions, how field and array access split into distinct opcode families, and why the JVM has five different invoke* instructions instead of one — including why modern javac no longer emits invokespecial for private method calls.

5

Bytecode Instructions: Branching, Returns, and Synchronization

How conditional branches always compile to the inverse of the source condition, why == on objects is if_acmpeq (identity, never equals()), why a switch compiles to tableswitch or lookupswitch depending on label density, why return is six type-specific instructions instead of one, and why a synchronized block costs a compiler-generated exception table that a synchronized method never needs.

Memory & Performance

Garbage Collection

Concurrency & I/O

Profiling & Benchmarking

Database Integration