Claude Opus co-wrote a JVM compiler from scratch — 11.7x faster than Java's default

A developer used Claude Opus as a true co-author to build a custom compiler that plugs directly into the Java runtime and generates native machine code for ARM chips. By reverse-engineering undocumented HotSpot internals together, they produced code that runs 11.7x faster than Java's built-in C2 compiler on a frequently-called method.

JVMCI is an interface that lets you replace Java's normal compiler with one you write yourself. This developer used it to generate raw AArch64 machine code — the instruction language understood by Apple Silicon and other modern ARM processors — and feed it straight into HotSpot, Java's main runtime engine. The hardest part was that HotSpot barely documents what code format it will accept, so the developer and Claude had to reverse-engineer those rules together by trial, analysis, and iteration. For the debugging phase, the developer ran multiple subagents in parallel, each testing a different theory at the same time, dramatically cutting the time spent on each dead end. The result: on one hot method (a function called thousands of times per second), the custom compiler produced code 11.7x faster than C2, Java's own highly-tuned optimizer. It's a striking proof that AI can contribute meaningfully even in obscure, low-level systems work with almost no documentation to lean on.

Key points

  • Claude Opus was used as a genuine co-author, not just a code assistant, to build a JVM compiler from scratch
  • Undocumented HotSpot internal protocols were reverse-engineered collaboratively with the AI
  • Parallel subagents tested multiple debugging hypotheses simultaneously, speeding up the process
  • The resulting compiler generated code 11.7x faster than Java's built-in C2 optimizer on a hot method
  • Demonstrates that AI tools can deliver real results even in low-level, undocumented systems programming

Quick term guide

native
Built using the operating system's own built-in tools, so the app feels at home on that platform and runs efficiently
HotSpot
Java's main runtime engine, which watches your code and compiles the frequently-used parts for speed.
Interface
The visual parts of a program that a human interacts with.
AArch64
The 64-bit instruction language used by Apple Silicon (M1/M2) and most modern ARM processors.
Apple Silicon
Apple's own line of chips (M1, M2, M3, M4, M5) used in Macs, known for performance and efficiency.
subagents
Smaller, specialized AI helpers that work under a main AI system to handle specific tasks.
testing
The process of checking that software does what it's supposed to do, usually by running it and looking for errors.
AI tools
Software that can help create text, code, images, or other work.

Sources covering this story (2)

Read original