Final project for CIS 198 at Penn
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data Fix parsing of constant pool to account for unusable entries Apr 30, 2016
rt Fix Java and native impl bugs. Prints hello world. May 1, 2016
src Mark down all 198 opcodes May 1, 2016
tests Refactor MethodCode to support native methods in a better way May 1, 2016
.gitignore Support saner nested errors Apr 12, 2016
.travis.yml
Cargo.lock Fix attribute parser Apr 12, 2016
Cargo.toml Begin implementing the class file parser Apr 12, 2016
PROPOSAL.md Rename project proposal from README to PROPOSAL Jun 9, 2016
README.md
REPORT.md Add REPORT document to the repo as well Jun 9, 2016

README.md

rust-jvm

This project was submitted by Meyer Kizner, Max McCarthy, and David Xu as our final project for CIS 198 at the University of Pennsylvania in spring 2016.

Please note that because this project was completed for a course, it is not under active development. The code and documentation in this repository is available as-is, and we will not be providing support beyond what already exists here.

About

This project implements a considerable subset of a Java virtual machine, in accordance with the Java SE 7 specification. It consists of a parser, class loader, and interpreter, which together can be used to read an arbitrary class file (subject to certain restrictions on the Java bytecode it contains), load it (and other necessary classes from the Java runtime libraries) into an interpreter, and execute the main method.

We achieved near-completion of many of these features, but got stuck within initialization of the PrintWriter and FileDescriptor classes for the System.out.println method, since they used a number of JVM features (namely, loading the java.util.concurrent.atomic.AtomicInteger class) which we had not intended to support. For this reason, the minimum required parts of the Java Class Library (JCL) are reimplemented in the rt/ directory in terms of a RustStdout class, which calls a native method for writing to a file descriptor.

As it stands, the VM successfully executes a HelloWorld.class file. It has not been tested beyond that.

To find out more information about the project, please see PROPOSAL.md and REPORT.md for our initial project propsoal and final report.

Running Hello World

This project is organized around a single integration test: executing a compiled "Hello, world!" program from a .class file.

Our VM does not support Java 7 and 8 features (including lambdas and the invokedynamic instruction). You will need to compile the Java source code in the rt directory targeting source level 1.6, which can be accomplished with the following command:

$ cd rt/
$ javac -source 1.6 -target 1.6 HelloWorld.java

Then, run cargo test from the project root and you should see the test pass.

License

This software is freely available under the terms of the Apache License 2.0.