js_of_ocaml icon indicating copy to clipboard operation
js_of_ocaml copied to clipboard

Implementation of effects based on the Stack Switching proposal

Open vouillon opened this issue 10 months ago • 0 comments

To generate Wasm code that makes use of the Stack Switching proposal, you first need to install the development version of Binaryen (or version 124 once it is released).

Then, you need to run wasm_of_ocaml with the --enable wasi flag:

wasm_of_ocaml --enable wasi foo.byte -o foo.js

This produces some Wasm code that can be directly executed by the Wizard engine:

wizeng.x86-64-linux -ext:stack-switching -ext:legacy-eh foo.assets/code.wasm

Note that we keep the same output convention, at least for now: a JavaScript file foo.js and a directory foo.assets containing the Wasm code. The JavaScript file should be useful to run the tests with node once it supports this extension. It is used at the moment in https://github.com/ocsigen/js_of_ocaml/pull/1831 to test the WASI runtime.

vouillon avatar Feb 06 '25 09:02 vouillon