-
Notifications
You must be signed in to change notification settings - Fork 188
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
Merge wasm_of_ocaml #1724
base: master
Are you sure you want to change the base?
Merge wasm_of_ocaml #1724
Conversation
In particular, include part of the string contents in the name for short strings.
We had to work around some Firefox limitations which are now fixed. This reverts commit 8ed4e18.
The call to 'eval' is usually optimized away. So only generate it if needed.
No file in compiler/lib depends on a file in compiler/lib/wasm, so we no longer need to compile these two directories together.
https://github.com/WebAssembly/js-string-builtins Enabled with flag --experimental-wasm-imported-strings in node, and through chrome://flags/#enable-experimental-webassembly-features in Chrome.
Implement mapping between source and wasm locations. To work, this requires a version of Binaryen compiled with Jérôme's patch WebAssembly/binaryen#6372. Single-stepping can jump around in slightly surprising ways in the OCaml code, due to the different order of operations in wasm. This could be improved by modifying Binaryen to support “no location” annotations. Another future improvement can be to support mapping Wasm identifiers to OCaml ones. Co-authored-by: Jérôme Vouillon <[email protected]>
Sourcemap support for wasm
Tuple syntax changes
We were just numbering them. This should make the output more readable since we are propagating names from the OCaml source code.
Directly use the name from the OCaml code if possible, with a suffix in case of ambiguity. Use short names for not explictly named variables.
Use Js string builtins when available
- more options - do not keep temp files - use a relative path as a sourcemap url
Minify runtime
Improve Wat output
When one of the fields is not used, we fill it with the float value 0. rather than using the generic placeholder `(ref.i31 (i32.const 0))`, which does not make sense.
Fix bad interaction of deadcode elimination and unboxed float records
Stricter float_of_string
Get latest changes from js_of_ocaml
Fix creation of float arrays
When the size of a piece of code changes, report that its end position changes, rather than its start position.
- Wasm AST: use a standalone event instruction to indicate code locations - Add location at end of functions - Hide code with no location
Source map improvements
So that we test whole-program compilation a bit.
@hhugo You can have a first look. Regarding the directory structure, the wasm-specific code of wasm_of_ocaml is in |
List.map ~f:(fun f -> f, Var.Map.find f arities) fun_lst | ||
in | ||
(* | ||
Format.eprintf "AAA"; |
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 wan't to keep this comment ?
| None -> assert false | ||
end | ||
(* | ||
parse |
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.
this could be dropped or moved to a test directory
let single f v = | ||
match v with | ||
| [ v ] -> f v | ||
| _ -> assert false |
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.
should this assert be invalid_arg
? same below ..
- ocp-indent: needed to support indentation in the toplevel | ||
- higlo: needed to support Syntax highlighting in the toplevel | ||
- cohttp: needed to build the toplevel webserver | ||
# Wasm_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.
Should we merge the two readmes ?
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, certainly.
@@ -37,7 +37,8 @@ | |||
}, | |||
"suspicious": { | |||
"noAssignInExpressions": "off", | |||
"noRedeclare": "off" | |||
"noRedeclare": "off", | |||
"noRedundantUseStrict": "off" |
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.
Why is this ?
@@ -0,0 +1,7 @@ | |||
(library | |||
(name wasm_of_ocaml_compiler) |
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.
how do you feel about moving this lib to compiler/lib-wasm ?
@@ -0,0 +1,39 @@ | |||
name: Automatic Merge with 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.
I presume this file is not meant for this repo
Sounds good |
; mutable pos : int | ||
} | ||
|
||
module Vlq = struct |
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.
This should probably be merged with the vlq module from lib
This aims to merge wasm_of_ocaml, currently hosted at https://github.com/ocaml-wasm/wasm_of_ocaml, back into this repo.
This is pending on Dune support ocaml/dune#11029. For now, Dune is pinned for the CI jobs.