A blog about programming topics, mostly JVM, Linux kernel, and x86 related things.

Saturday, January 9, 2010

Java Virtual Machine developer documentation

So you want to be a Java virtual machine hacker but don't know where to start? One obvious starting point is to navigate your way through the large body of developer documentation.

For a JVM developer, the most important document is the The Java Virtual Machine Specification and its companion document Clarifications and Amendments. The specification describes the ABI of the JVM but doesn't mandate how it is implemented. While you should read through the whole thing, the most interesting chapters to a JVM hacker are Chapter 4 ("The class File Format") and Chapter 6 ("The Java Virtual Machine Instruction Set"). It's also important to understand the JSR-133 ("Java memory model") which describes how threads in the JVM interact through memory. Doug Lea's The JSR-133 Cookbook for Compiler Writers has a pretty nice summary of the specification from a JVM hacker point of view.

There are two additional things that the JVM needs to run serious programs: JNI support and runtime classes. The Java Native Interface Specification describes the iteroperability interface to native code from the JVM. The Sun HotSpot comes with its own runtime classes but many open source JVMs use the GNU Classpath to provide essential classes for the JVM. The GNU Classpath Virtual Machine Integration Guide describes the API that a VM needs to implement to integrate with GNU Classpath.

While the above documentation describe what is needed for a JVM, it's also important to understand how real world JVMs are implemented to see the big picture. Design of the Java HotSpot Client Compiler for Java 6 and The Jalapeño Dynamic Optimizing Compiler for Java provide nice overview of how the HotSpot and Jikes RVM are implemented, respectively. There's a more extensive list of papers on the Jato home page but there's no substitute to reading JVM code if you really want to understand the implementation.

2 comments:

Chandu said...

Thanks for the info and the resources provided.

palak pal said...


A nice tutorial on
JVM Architecture Specification Basic The Heap Area Introduction, teach about the JVM Heap Area in details
http://www.youtube.com/watch?v=c-A7ZzxjWUI

JVM Architecture Specification Basic The Method Area explained, teach about the JVM method area
http://www.youtube.com/watch?v=a5GzF2fSSCE