Wasm_of_ocaml
summary
Wasm_of_ocaml converts OCaml bytecode to WebAssembly using the WebAssembly garbage‑collection extension (available in Chrome and Firefox, Safari soon), reuses browser GC so no custom allocator is implemented, and keeps JavaScript interop by boxing/unboxing OCaml values and mapping JS classes (uses JS Map for shared structures). Benchmarks show up to 2x speedups over Js_of_ocaml, compiling the compiler itself yields ~2x faster end result, requires minimal source changes, but exceptions very slow on V8.
AI-written summary · about
chapters (16)
- 0:00Wasm_of_ocaml intro
- 1:53WebAssembly module structure
- 3:45JS interoperability challenges
- 5:35Reference types extension
- 7:06Motivation for OCaml to Wasm
- 10:01Compiler pipeline overview
- 13:19Implementing primitives in OCaml
- 17:10JS integration strategies
- 19:47OCaml to JS value interaction
- 23:07OCaml type handling
- 26:59Type checking and codegen
- 28:08Performance benchmarks
- 31:43CPS transformation
- 33:16OCaml backend comparison
- 34:45Production use and future
- 35:30Q&A








