RichWasm: Bringing Safe, Fine-Grained, Shared-Memory Interoperability Down to WebAssembly
-
Published:2024-06-20
Issue:PLDI
Volume:8
Page:1656-1679
-
ISSN:2475-1421
-
Container-title:Proceedings of the ACM on Programming Languages
-
language:en
-
Short-container-title:Proc. ACM Program. Lang.
Author:
Fitzgibbons Michael1ORCID,
Paraskevopoulou Zoe2ORCID,
Mushtak Noble1ORCID,
Thalakottur Michelle1ORCID,
Sulaiman Manzur Jose1ORCID,
Ahmed Amal1ORCID
Affiliation:
1. Northeastern University, Boston, USA
2. Ethereum Foundation, Berlin, Germany / Northeastern University, Boston, USA
Abstract
Safe, shared-memory interoperability between languages with different type systems and memory-safety guarantees is an intricate problem as crossing language boundaries may result in memory-safety violations. In this paper, we present RichWasm, a novel richly typed intermediate language designed to serve as a compilation target for typed high-level languages with different memory-safety guarantees. RichWasm is based on WebAssembly and enables safe shared-memory interoperability by incorporating a variety of type features that support fine-grained memory ownership and sharing. RichWasm is rich enough to serve as a typed compilation target for both typed garbage-collected languages and languages with an ownership-based type system and manually managed memory. We demonstrate this by providing compilers from core ML and L3, a type-safe language with strong updates, to RichWasm. RichWasm is compiled to regular Wasm, allowing for use in existing environments. We formalize RichWasm in Coq and prove type safety.
Funder
National Science Foundation
Defense Advanced Research Projects Agency
Publisher
Association for Computing Machinery (ACM)
Reference27 articles.
1. A step-indexed model of substructural state
2. A Linear Language with Locations;Ahmed Amal;Fundamenta Informaticae,2007
3. WasmFX developers. Efect handlers for WebAssembly. 2022. https://wasmfx.dev.
4. WebAssembly GitHub. Component Model Design and Specification. 2022. https://github.com/WebAssembly/ component-model/blob/main/design/mvp/Explainer.md.