-
Notifications
You must be signed in to change notification settings - Fork 197
WASI runtime #1831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
WASI runtime #1831
Conversation
28a41a0 to
7a4d3ff
Compare
c1fc50d to
c9f7566
Compare
85a9891 to
25a5e68
Compare
391b19a to
f3efbd6
Compare
31610af to
2356554
Compare
30e67bf to
feb15af
Compare
ab16943 to
538d0ab
Compare
|
@hhugo Do you want to have a look? |
|
@hhugo Can I just merge this PR? Or would it be better to wait after the next release? |
| (fun k v -> | ||
| match k with | ||
| | "use-js-string" -> Config.Flag.set k (bool_of_string v) | ||
| | "use-js-string" | "wasi" -> Config.Flag.set k (bool_of_string v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does that mean we need to change dune rules as well ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, indeed. And for #1832 as well...
Maybe we should try to move some of the logic which is currently in dune to js_of_ocaml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have anything in mind ?
I was hoping we could do some kind of dynamic rule generation similar to what's done for ppxes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like adding to js_of_ocaml an option --output-config which would just output the path that dune should use, and an option --with-config that would decode the path and override other command line parameters.
Wasmtime only supports these instructions. We should eventually use instead of the legacy instructions, but they are not allowed by default in node.
You can produce a WASI binary by running
wasm_of_ocamlwith the--enable wasiflag:This produces some Wasm code that can be directly executed by the Wizard engine:
wasmtime does not support the legacy exception handling instructions. You can produce a binary that will work with wasmtime as well by adding the
--enable exnrefflag:You can then execute it with the following command:
Note that we keep the same output convention, at least for now: a JavaScript file
foo.jsand a directoryfoo.assetscontaining the Wasm code. The JavaScript file can be use to run the WASI binary withnode.