Special Talk

Location:
In Person - Gates Hillman 9115

Speaker:
CHRIS FALLIN , Principal Engineer, Fastly
https://cfallin.org/

wevaling the wasms: AOT JS Compilation (or: Stuffing a Dynamic Language onto a Very Static Platform)

WebAssembly (Wasm) is a simple, formally specified, low-level bytecode format that is designed to be a good compilation target for statically-typed languages such as C, C++, and Rust (among others). It has excellent sandboxing properties, and has thus seen adoption in applications where untrusted user code must run. Unfortunately, the story for dynamically-typed (and otherwise highly dynamic) languages such as JavaScript running on Wasm-based platforms is less well-developed: the state of the art is to embed an interpreter within a Wasm module and package it with bytecode.

In this talk, I walk through (i) background on Wasm-based platforms and why they are attractive; (ii) difficulties that Wasm, as a highly static environment, presents to languages traditionally accelerated by a JIT compiler; and (iii) outline one path to achieve ahead-of-time compilation of such languages to Wasm modules without JIT.

The key insight of this work is that WebAssembly provides a novel opportunity to apply partial evaluation to get a compiler “for free” out of an interpreter. I will outline how we first developed and upstreamed a new high-performance interpreter tier in the SpiderMonkey JS engine, then developed a partial evaluator called “weval” for Wasm that, together with the upstreamed interpreter with minimal changes, produces fully ahead-of-time-compiled code from JS source, encapsulating all remaining dynamism in the inline-cache mechanism. This results in a ~2x speedup overall, with ~4x on some microbenchmarks and potential for higher. 

Faculty Host: Fraser Brown CMU community welcomed.


Add event to Google
Add event to iCal