proglangdesign.net

Java Virtual Machine

The JVM is a Virtual Machine that hosts the Java language by providing an abstracted machine that the Java compiler can target. By targetting the JVM, you can have your language run on multiple platforms while only needing to write a code generator for one. The instruction set the JVM uses is called JVM Bytecode.

The JVM is a stack based VM with a limited set of registers. It loads class files containing bytecode at runtime and compiles them using a Just-In-Time (JIT) compiler. The JVM has been optimized heavily over the years and can support allocating millions of objects.

Benefits

Leveraging the JVM provides a number of benefits for your language:

Caveats

Being a Virutal Machine that compiles bytecode at runtime means you have to ship your entire codebase in one jar file. This can be an issue for a number of reasons:

Libraries

There are a number of libraries that can produce JVM Bytecode, each offering a unique interface.

Resources for Learning