Jack is a silly attempt to write a Java bytecode to C++ transpiler to allow ahead of time compilation of Java apps. I intend to use it to target platforms that don’t have a JVM or other restrictions, e.g. iOS, consoles etc.
Goals:
- Java 1.5 language compatibility
- reflection
- exceptions
- covariant return types (needed for generics)
- threading
- JNI and a custom native interface to ease wrapping C/C++ apis.
- minimal runtime library ala Avian VM
- debuggable (preserve class hierarchy, field and method names, inline Java source as comments for readability)
Non-Goals:
- run Eclipse
- Swing/AWT/EE support
- runtime bytecode loading
- full java memory model
Done
- translation of class hierarchy (that was no fun…)
- translation of method bodies (surprisingly simple)
- ordered class initialization (differs from JVM on the fly class initialization)
- GC (via Boehm GC for now)
- covariant return types
- basic class descriptors (instanceof etc., C++ dynamic_cast doesn’t quite cut it)
- String literals (they need special care…)
- Arrays (since they are special case in many respects)
- incremental compilation, so C++ compile times are quick as well.
- compiles the first iteration of the runtime library, ~220 classes.
Todo
- exceptions
- full reflection support
- threading & monitors
- JNI & custom native interface
- more work on the runtime library
I have a plan for each Todo and am confident that this can be realized within a reasonable time-frame.
I’d love to get input on what you guys thing the runtime library should contain at a minimum. I want to focus on things relevant to game development. The runtime can be extended later on, be it by including OpenJDK or devising custom runtime classes. I’d be in favor of keeping it simple.
Feedback welcome, if you fork it and want to contribute i’d be even happier. Note the disclaimer at the top of the README