Tue 27 Oct 2015 14:15 - 14:37 at Grand Station 3 - Session 3, Compilation

We present an approach to cross-compile Java bytecodes to JavaScript, building on existing Java optimizing compiler technology. Static analysis determines which Java classes and methods are reachable. These are then translated to JavaScript using a re-configured Java just-in-time compiler with a new back end that generates JavaScript instead of machine code. Standard compiler optimizations such as method inlining and global value numbering, as well as advanced optimizations such as escape analysis, lead to compact and optimized JavaScript code. Compiler IR is unstructured, so structured control flow needs to be reconstructed before code generation is possible. We present details of our control flow reconstruction algorithm.

Our system is based on Graal, an open-source optimizing compiler for the Java HotSpot VM and other VMs. The modular and VM-independent architecture of Graal allows us to reuse the intermediate representation, the bytecode parser, and the high-level optimizations. Our custom back end first performs control flow reconstruction and then JavaScript code generation. The generated JavaScript undergoes a set of optimizations to increase readability and performance. Static analysis is performed on the Graal intermediate representation as well. Benchmark results for medium-sized Java benchmarks such as SPECjbb2005 run with acceptable performance on the V8 JavaScript VM.

Tue 27 Oct

13:30 - 15:00: DLS - Session 3, Compilation at Grand Station 3
dls201513:30 - 13:52
dls201513:52 - 14:15
Matthias GrimmerJohannes Kepler University Linz, Chris SeatonOracle Labs / University of Manchester, Roland SchatzJohannes Kepler University Linz, Thomas WuerthingerOracle Labs, Hanspeter MössenböckJohannes Kepler University Linz
dls201514:15 - 14:37
David LeopoldsederJohannes Kepler University Linz, Lukas StadlerOracle Labs, Christian WimmerOracle Labs, Hanspeter MössenböckJohannes Kepler University Linz
dls201514:37 - 15:00
Tim FelgentreffHPI, Germany, Tobias PapeHasso-Plattner-Institute, Potsdam, Robert HirschfeldHPI, Carl Friedrich Bolz-TereickKing's College London , Anton GulenkoTU Berlin