Toy JVM that might be useful. Uses GNU Classpath.
- [o] Implement all opcodes
- Implement them correctly
- [o] Implement enough native methods to bootstrap the standard library
- [.] Implement enough of the JNI too
- Execute a simple `System.out.println" call
- Integration test rig to compare output to a reference implementation
- Fix all the bugs and unimplemented opcodes
- Fast, non-verifying interpreter optimised for speed
Not recommended in its current state
A nightly rust compiler is required for variadic functions in the JNI interface.
- Download, build and install GNU Classpath
- I had luck with the following commands:
CFLAGS="-w" ./configure --enable-load-library=yes --with-glibj=flat --enable-jni=yes --disable-gjdoc && make && make install
- I also had to install
antlr
3.5.2,gconf
2.6.0 and downgrade to a JDK that still hasjavah
(OpenJDK 8)
- I had luck with the following commands:
- Find/compile a simple
.java
file into a.class
cargo run -- <class name> --Xbootclasspath <colon separated list of paths to system classes> --cp <colon separated list of paths for non-system classes>
- Example:
cargo run -- com.me.MyClass --Xbootclasspath /gnuclasspath:../java --cp ../java
. This will (try to) run the main method of../java/com/me/MyClass.class
- See help menu for more:
cargo run -- --help
- Example: