diff --git a/compiler/tests-jsoo/lib-effects/dune b/compiler/tests-jsoo/lib-effects/dune index c7267431d8..798bf06d24 100644 --- a/compiler/tests-jsoo/lib-effects/dune +++ b/compiler/tests-jsoo/lib-effects/dune @@ -1,10 +1,12 @@ (env (with-effects-double-translation) (with-effects) -; (wasi -; (wasm_of_ocaml -; (flags -; (:standard --enable effects)))) + (wasi + (wasm_of_ocaml + (enabled_if + (or + (= %{env:WASM_ENGINE=node} "wizard") + (= %{env:WASM_ENGINE=node} "wizard-fast"))))) (_ (js_of_ocaml (flags diff --git a/compiler/tests-ocaml/effect-syntax/dune b/compiler/tests-ocaml/effect-syntax/dune index e7322d3b63..9c0322729e 100644 --- a/compiler/tests-ocaml/effect-syntax/dune +++ b/compiler/tests-ocaml/effect-syntax/dune @@ -1,12 +1,12 @@ (env (with-effects-double-translation) (with-effects) -; (wasi -; (flags -; (:standard -w -38)) -; (wasm_of_ocaml -; (flags -; (:standard --enable=effects)))) + (wasi + (wasm_of_ocaml + (enabled_if + (or + (= %{env:WASM_ENGINE=node} "wizard") + (= %{env:WASM_ENGINE=node} "wizard-fast"))))) (_ (js_of_ocaml (flags diff --git a/compiler/tests-ocaml/effects/dune b/compiler/tests-ocaml/effects/dune index 0f434043c0..c9244e5b1a 100644 --- a/compiler/tests-ocaml/effects/dune +++ b/compiler/tests-ocaml/effects/dune @@ -1,12 +1,12 @@ (env (with-effects-double-translation) (with-effects) -; (wasi -; (flags -; (:standard -w -38)) -; (wasm_of_ocaml -; (flags -; (:standard --enable=effects)))) + (wasi + (wasm_of_ocaml + (enabled_if + (or + (= %{env:WASM_ENGINE=node} "wizard") + (= %{env:WASM_ENGINE=node} "wizard-fast"))))) (_ (js_of_ocaml (flags diff --git a/dune b/dune index 150a7dacbd..d00db59696 100644 --- a/dune +++ b/dune @@ -33,7 +33,7 @@ (wasi (wasm_of_ocaml (flags - (:standard --pretty --enable wasi)) + (:standard --pretty --enable wasi --enable trap-on-exception)) (compilation_mode whole_program)) (binaries (tools/node_wrapper.exe as node) diff --git a/tools/node_wrapper.ml b/tools/node_wrapper.ml index 15979975a8..583b72ab15 100644 --- a/tools/node_wrapper.ml +++ b/tools/node_wrapper.ml @@ -1,3 +1,17 @@ +let wizard_args = [ "-ext:stack-switching"; "--dir=." ] + +let wasmfxtime_args = + [ (*"-C" + ; "collector=null" + ; *) + "-W=exceptions,function-references,stack-switching,gc" + ; "--dir=." + ] + +let wasmtime_args = [ (*"-C" + ; "collector=null" + ; *) "-W=all-proposals=y"; "--dir=." ] + let extra_args_for_wasoo = [ "--experimental-wasm-imported-strings" ; "--experimental-wasm-stack-switching" @@ -23,16 +37,37 @@ let env = else e) env -let args = +let find_wasm file = + let dir = Filename.chop_extension file ^ ".assets" in + Filename.concat + dir + (List.find + (fun f -> Filename.check_suffix f ".wasm") + (Array.to_list (Sys.readdir dir))) + +let exe, args = match Array.to_list Sys.argv with | exe :: argv -> - let argv = + let exe', argv = match argv with - | file :: _ when Filename.check_suffix file ".wasm.js" -> - extra_args_for_wasoo @ argv - | _ -> extra_args_for_jsoo @ argv + | file :: _ when Filename.check_suffix file ".wasm.js" -> ( + match Sys.getenv_opt "WASM_ENGINE" with + | Some "wizard" -> + ( "/home/jerome/sources/wizard-engine/bin/wizeng.x86-linux" + , wizard_args @ (find_wasm file :: List.tl argv) ) + | Some "wizard-fast" -> + ( "/home/jerome/sources/wizard-engine/bin/wizeng.x86-64-linux" + , wizard_args @ (find_wasm file :: List.tl argv) ) + | Some "wasmfxtime" -> + ( "/home/jerome/sources/wasmfxtime/target/debug/wasmtime" + , wasmfxtime_args @ (find_wasm file :: List.tl argv) ) + | Some "wasmtime" -> + ( "/home/jerome/sources/wasmtime/target/debug/wasmtime" + , wasmtime_args @ (find_wasm file :: List.tl argv) ) + | _ -> "node", extra_args_for_wasoo @ argv) + | _ -> "node", extra_args_for_jsoo @ argv in - Array.of_list (exe :: argv) + exe', Array.of_list (exe :: argv) | [] -> assert false let () = @@ -45,4 +80,4 @@ let () = | _, WEXITED n -> exit n | _, WSIGNALED _ -> exit 9 | _, WSTOPPED _ -> exit 9 - else Unix.execvpe "node" args env + else Unix.execvpe exe args env