Thicket thicket
ocaml
REPOS 1

Tools covers builds, package management, editors, documentation and JavaScript compilation.

W44.2026 · 26 Oct – 1 Novocsigen/js_of_ocaml

Features

  • Wasm-JS boundary (#2563, merged): JavaScript values now use externref; floats pass as f64, integers as i32. A short-string cache (≤ 16 bytes) avoids repeated allocation; method-call overhead drops from ~16 ns to ~5 ns on V8.

  • Wasm exceptions (#2098, merged): Functions under a handler signal by storing in caml_exception and returning null; the caller tests with br_on_null. On ocamlc at --opt 2, run time drops 24% and Wasm exceptions thrown fall from 5.1 M to 9.5 k.

  • JS sentinel exceptions (#2582, open): The JS backend signals exceptions via a sentinel return value instead of throwing a JavaScript exception. On the ocamlc benchmark this cuts run time from 16.5 s to 8.9 s; enabled by default with --effects=disabled.

  • Binaryen optional (#2571, open): Without wasm-opt, wasm_of_ocaml uses internal passes (duplicate elimination, local coalescing) and emits a warning at --opt 2/3. The WASM_OF_OCAML build gate is removed; a plain dune build now compiles Wasm targets.

Fixes

  • Solver worklist stack overflow (#2568, merged): The dataflow solver traversal switches to an explicit stack beyond depth 1000, preventing a "Maximum call stack size exceeded" failure when compiling js_of_ocaml.bc to Wasm. Generated code is unchanged.

  • Require Binaryen ≥ 120 (#2580, merged): Version 119 incorrectly refines the type of the exported caml_exception global, causing link failures for programs using the null-return exception convention.

Compatibility and Releases

  • Skip wasm-opt at --opt 1 (#2238, merged): wasm_of_ocaml no longer invokes wasm-opt at --opt 1; internal passes (local coalescing, sink, reorder) replace it. Compilation time drops ~60% for the test suite; variable names are preserved for debugging.

  • ppx_devtools extracted (#2564, #2566, merged): ppx_devtools (optcomp + expect) moves to ppx_devtools; in-tree copies are removed. js_of_ocaml depends on the external package via pin-depends until its first opam release.