Skip to content

Latest commit

 

History

History
50 lines (35 loc) · 2.14 KB

README.adoc

File metadata and controls

50 lines (35 loc) · 2.14 KB

BlazeVM - a "blazingly-fast" Java Virtual Machine

BlazeVM is intented to be a fun project to learn about the JVM internals. It is not intended to be used in production. BlazeVM does not attempt to be neither a full-featured JVM nor a high-performance one, the "blazingly-fast" comment is just humor. It is just a toy JVM.

Why reimplement a Java Virtual Machine?

I have been working with Java for quite a long time in the past, and also in other JVM-based languages like Scala and Kotlin. Moreover, I’m quite interested to know more about how a virtual machine like the JVM (or the Python VM) works, so with a bit of time in my hands I decided to start this project.

I might in the future try to create my own JVM-based language, but that is not the goal of this particular project. Nonetheless, if this idea ever comes to reality, I would know a lot more about the JVM intrinsics to create it. And it would be kinda cool to have a language that compiles to JVM bytecode but also run on my own JVM implementation. (Yeah i know, it’s basically creating a new interpreted language but with more steps and constraints. But it’s fun!)

How to run it?

Still the early days of this project, but you can now run some classes if they do not require native methods nor allocations nor String constants.

To run the example class MinimalClass you will need to retrieve a JRE rt.jar file and uncompressed it in a directory, here ./classpath.

Note

rt.jar do not exists anymore in Java 9 and later, so you will need to use one from a JRE 8 or earlier. On MacOS, this file is called classes.jar. You can found it in JAVA_HOME/jre/lib/rt.jar or JAVA_HOME/lib/rt.jar.

# Clone the repository
git clone https://github.com/fusetim/blazevm && cd blazevm

# Build the project
cargo build --release

# Run the example class
RUST_LOG=debug ./target/release/cmd -c ./reader/res/test -c .classpath MinimalClass

Enjoy! You successfully ran a class in BlazeVM, and also calculate the sum of 1 and 1 =).

License

This project is licensed under the CeCILL 2.1 license (GPL-compatible license).

See the LICENSE file for more details.