-
Notifications
You must be signed in to change notification settings - Fork 185
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
Target-specific code #1655
base: master
Are you sure you want to change the base?
Target-specific code #1655
Conversation
Turning into a draft until underlying PRs are merged |
@OlivierNicole, can you rebase, fix and undraft this PR |
3045d76
to
6820074
Compare
6820074
to
4a28c27
Compare
Done. |
Do we really need to pass target around ? It creates a lot of noise for few uses only. It could be turned into an global config like |
What I like about passing The readability does not seem too much impaired to me, but it’s not a strong opinion, if there’s opposition to it I’m OK with a global config parameter, since it’s not a value that is expected to change during a run. |
Looking at the diff, I find it hard to extract where the behavior depend on the target because there are so many targets passed around. I like that values are explicitly passed but I don't see a reason to treat backends differently from other "config" (e.g. use_js_string).
|
Wouldn’t a global flag make it harder to use the jsoo compiler as a library, which could be invoked many times with different targets? |
For example, an online ocaml repl, or a “godbolt explorer” output visualizer |
Sure, but we already have that issue with other flags, in particular, effects. |
1d48011
to
bb6474d
Compare
Done. |
@OlivierNicole, the CI is unhappy, and the diff has extra lines because of formatting. Can you run |
0a92618
to
5a9d1d2
Compare
There was a subtyping relation not being automatically used under 4.12. The CI should be happy now. |
6a45291
to
7482c31
Compare
| "caml_int_of_float", [ Float f ] -> Some (Int (Int32.of_float f)) | ||
| "caml_int_of_float", [ Float f ] -> | ||
Some | ||
(Int (Int32.of_float f |> Int.of_int32_warning_on_overflow |> Int.to_int32)) | ||
| "to_int", [ Float f ] -> Some (Int (Int32.of_float f)) |
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.
Int32 -> Int ?
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.
The Int
constructor takes an int32
, to be able to hold both JavaScript 32-bit integers and Wasm int31s
Co-authored-by: Olivier Nicole <[email protected]>
2ce8d51
to
b64108c
Compare
b64108c
to
2b9bb43
Compare
I just pushed a commit that fixes |
05e6198
to
b32eb93
Compare
b32eb93
to
9d08e70
Compare
Note: This PR depends on #1649 and #1654 and is based on top of them.
The proposed feature is contained only in the last commit.edit: These PRs have been merged.This PR contains @vouillon's work to have two distinct targets: Javascript and WebAssembly.
Dune support for the new Wasm backend has been proposed at ocaml/dune#10695.
This is part of a series of PRs intending to reduce the diff between js_of_ocaml and wasm_of_ocaml (see ocaml-wasm/wasm_of_ocaml#47).