Java-to-JavaScript Translation via Structured Control Flow Reconstruction of Compiler IR
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 OctDisplayed time zone: Eastern Time (US & Canada) change
13:30 - 15:00 | |||
13:30 22mTalk | Compiling for Multi-Language Task Migration DLS | ||
13:52 22mTalk | High-Performance Cross-Language Interoperability in a Multi-Language Runtime DLS Matthias Grimmer Johannes Kepler University Linz, Chris Seaton Oracle Labs / University of Manchester, Roland Schatz Johannes Kepler University Linz, Thomas Wuerthinger Oracle Labs, Hanspeter Mössenböck Johannes Kepler University Linz | ||
14:15 22mTalk | Java-to-JavaScript Translation via Structured Control Flow Reconstruction of Compiler IR DLS David Leopoldseder Johannes Kepler University Linz, Lukas Stadler Oracle Labs, Christian Wimmer Oracle Labs, Hanspeter Mössenböck Johannes Kepler University Linz | ||
14:37 22mTalk | Language Independent Storage Strategies for Tracing JIT based VMs DLS Tim Felgentreff HPI, Germany, Tobias Pape Hasso-Plattner-Institute, Potsdam, Robert Hirschfeld HPI, CF Bolz-Tereick King's College London , Anton Gulenko TU Berlin |