Rust JVM — 1

Introduction

No more bullshit, let’s begin the year with a bang!

Project Setup

The project will be hosted at Github, where eventually I’ll setup some Github actions to compile and test the code. For now you just need to access it through the following link:

https://github.com/pedrohjordao/justvm11

The name comes from an old project where I was implementing the JVM8 specification, but I’ll be starting this one from scratch (though with a lot of the experience from the other project in mind).

I’ll keep tags in the format “post-#” so you can follow along with the exact point where the project was in a given post. The tag “post-1” will contain the initialized project structure.

Project Structure

I’ll not be following the HotSpot structure. The project will use the workspaces feature from Cargo, and we will not care about os/cpu details unless where it is strictly necessary. The project contains the following workspaces:

  • class_reader will contain the code that parses .class files into a representation we can work with;

  • class_commons will contain the primitives we will be working with;

  • interpreter will contain the code that is able to parse the bytecode and execute it;

  • jni will contain the FFI interface through which eventually we will be able to plug our code into javac;

  • runtime contains the runtime code, that is, the runtime representation of classes, bytecode, class loaders, etc.

This is not a set in stone structure, but it is a nice starting point to split the project in a reasonable manner.

Contributing

Please, feel free to contribute to the project by forking it and creating PRs, creating issues and calling me out for mistakes I make.

Since this is meant to be a learning experience I need to keep in pace with the posts, so contributions might need to be reworked or split to follow the programming of the posts.

Finally, make sure you keep references to the specification in your documentation.

Conclusion

This was a short one, but as I promised we will start the year with a bang, so tomorrow we will have a new post with code!