Skip to content

Conversation

@vouillon
Copy link
Member

@vouillon vouillon commented Feb 6, 2025

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 #1831 to test the WASI runtime.

@vouillon vouillon force-pushed the native-effects branch 10 times, most recently from 49e1043 to f368877 Compare February 13, 2025 16:43
@vouillon vouillon added the wasm label Feb 14, 2025
@vouillon vouillon force-pushed the native-effects branch 13 times, most recently from 3b9ce6d to 3f4555c Compare February 19, 2025 20:03
@vouillon vouillon force-pushed the native-effects branch 2 times, most recently from a8763e2 to 4d6ce8e Compare February 26, 2025 17:15
@vouillon vouillon force-pushed the native-effects branch 3 times, most recently from 5c5211c to 41291bc Compare April 4, 2025 14:28
@vouillon vouillon force-pushed the native-effects branch 2 times, most recently from 2fd57df to 226063f Compare May 5, 2025 15:09
@vouillon vouillon force-pushed the native-effects branch 5 times, most recently from 0017456 to c27e0c1 Compare September 9, 2025 11:28
@vouillon vouillon force-pushed the native-effects branch 2 times, most recently from 13e9b8f to 9396373 Compare September 22, 2025 14:35
@vouillon vouillon force-pushed the native-effects branch 2 times, most recently from ab70126 to bf729a1 Compare November 4, 2025 13:47
@linxuanm
Copy link

Hi! We are working on Wizard's stack switching and would like to generate benchmarks with wasm_of_ocaml. I tried to build wasm_of_ocaml but it seems that it depends on binaryen-bin-1.19 while an external installation of binaryen-1.24 is needed. I was able to get around this by manually editing path but was wondering if there are any plans for removing the outdated binaryen-bin from dependency so that building wasm_of_ocaml wouldn't incorrectly use the outdated executables from opam path, or if there's a better way to streamline the installation for CI? Thank you!

Wasmtime only supports these instructions. We should eventually use
instead of the legacy instructions, but they are not allowed by default
in node.
@vouillon
Copy link
Member Author

Hi!

This was done in #2134. I have rebased the PR.

We originally forced a source install because prebuilt versions of binaryen 1.24+ weren't available. Now that they are, that step isn't needed anymore.

For a long time we this faked the installation of binaryen on the CI with opam install --fake binaryen-bin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants