Affiliation:
1. University of British Columbia, Vancouver, Canada
2. University of Maryland, College Park, USA / University of British Columbia, Vancouver, Canada
Abstract
We present Wasm-prechk, a superset of WebAssembly (Wasm) that uses indexed types to express and check simple constraints over program values. This additional static reasoning enables safely removing dynamic safety checks from Wasm, such as memory bounds checks. We implement Wasm-prechk as an extension of the Wasmtime compiler and runtime, evaluate the run-time and compile-time performance of Wasm-prechk vs WebAssembly configurations with explicit dynamic checks, and find an average run-time performance gain of 1.71x faster in the widely used PolyBenchC benchmark suite, for a small overhead in binary size (7.18% larger) and type-checking time (1.4% slower). We also prove type and memory safety of Wasm-prechk, prove Wasm safely embeds into Wasm-prechk ensuring backwards compatibility, prove Wasm-prechk type-erases to Wasm, and discuss design and implementation trade-offs.
Publisher
Association for Computing Machinery (ACM)
Reference30 articles.
1. Bytecode Alliance. 2019. Wasmtime: A fast and secure runtime for WebAssembly. https://wasmtime.dev/ Accessed: 2023-06-29
2. Dependent types for JavaScript
3. STABILIZER
4. Emscripten Contributors. 2015. emscripten. https://emscripten.org/ Accessed: 2023-06-29