Skip to content
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

Wasm text file preprocessor #1822

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Wasm text file preprocessor #1822

wants to merge 10 commits into from

Conversation

vouillon
Copy link
Member

@vouillon vouillon commented Jan 30, 2025

For a start, it is only used to manage runtime differences between OCaml versions, and to provide some syntactic sugar for strings. But I plan to use it for a WASI version of the runtime and to implement the use-js-string flag.

@vouillon vouillon force-pushed the preprocess branch 5 times, most recently from 22aa8ab to 408fc17 Compare January 31, 2025 11:54
@vouillon vouillon marked this pull request as ready for review January 31, 2025 12:57
@hhugo
Copy link
Member

hhugo commented Feb 1, 2025

Have you considered using this to add sugars to help write control flows (e.g having a switch instruction ) ?

@vouillon
Copy link
Member Author

vouillon commented Feb 3, 2025

Have you considered using this to add sugars to help write control flows (e.g having a switch instruction ) ?

That seems a good idea, indeed!

@@ -0,0 +1,17 @@
(executable
(name wasmoo_util)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you consider having subcommands inside wasm_of_ocaml instead ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the issue that wasmoo_util link is used to build the runtime which is then included in wasm_of_ocaml.
But maybe I can have an internal binary to do that and also expose the same functionality as a wasm_of_ocaml subcommand.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the runtime be linked later ? If we want to have it conditional on flags such as use-js-strings ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My current plan is to have a set of precompiled runtimes for the most common options, and to compile runtimes on the fly otherwise.
It's a bit slow to compile and link the runtime. That's especially noticeable when we have a large number of executables, like with the Js_of_ocaml test suite.
But maybe we could share the runtimes produced by wasm_of_ocaml build-runtime between executables, using a similar trick in dune as for ppxs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But maybe I can have an internal binary to do that and also expose the same functionality as a wasm_of_ocaml subcommand.

I have implemented this. Does this look good to you?

@vouillon vouillon force-pushed the preprocess branch 6 times, most recently from 32f8b5d to 28907d4 Compare February 10, 2025 13:06
@vouillon vouillon added the wasm label Feb 14, 2025
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.

2 participants