1
+ let wizard_args = [ " -ext:stack-switching" ; " -stack-size=2M" ; " --dir=." ; " --dir=/tmp" ]
2
+
3
+ let wasmtime_args =
4
+ [ (* "-C"; "collector=null"; *) " -W=all-proposals=y" ; " --dir=." ; " --dir=/tmp" ]
5
+
6
+ let wasmedge_args =
7
+ [ " --enable-gc"
8
+ ; " --enable-exception-handling"
9
+ ; " --enable-tail-call"
10
+ ; " --dir=."
11
+ ; " --dir=/tmp"
12
+ ]
13
+
1
14
let extra_args_for_wasoo =
2
15
[ " --experimental-wasm-imported-strings"
3
16
; " --experimental-wasm-stack-switching"
17
+ ; " --experimental-wasm-exnref"
4
18
; " --stack-size=10000"
5
19
]
6
20
@@ -23,16 +37,32 @@ let env =
23
37
else e)
24
38
env
25
39
26
- let args =
40
+ let environment_args () =
41
+ List. filter
42
+ (fun e -> not (String. contains e ',' ))
43
+ (Array. to_list (Array. map (fun e -> " --env=" ^ e) env))
44
+
45
+ let wasm_file file =
46
+ Filename. concat (Filename. chop_extension file ^ " .assets" ) " code.wasm"
47
+
48
+ let common_args file argv = environment_args () @ (wasm_file file :: List. tl argv)
49
+
50
+ let exe, args =
27
51
match Array. to_list Sys. argv with
28
52
| exe :: argv ->
29
- let argv =
53
+ let exe', argv =
30
54
match argv with
31
- | file :: _ when Filename. check_suffix file " .wasm.js" ->
32
- extra_args_for_wasoo @ argv
33
- | _ -> extra_args_for_jsoo @ argv
55
+ | file :: _ when Filename. check_suffix file " .wasm.js" -> (
56
+ match Sys. getenv_opt " WASM_ENGINE" with
57
+ | Some "wizard" -> " wizeng.x86-linux" , wizard_args @ common_args file argv
58
+ | Some "wizard-fast" ->
59
+ " wizeng.x86-64-linux" , wizard_args @ common_args file argv
60
+ | Some "wasmtime" -> " wasmtime" , wasmtime_args @ common_args file argv
61
+ | Some "wasmedge" -> " wasmedge" , wasmedge_args @ common_args file argv
62
+ | _ -> " node" , extra_args_for_wasoo @ argv)
63
+ | _ -> " node" , extra_args_for_jsoo @ argv
34
64
in
35
- Array. of_list (exe :: argv)
65
+ exe', Array. of_list (exe :: argv)
36
66
| [] -> assert false
37
67
38
68
let () =
@@ -45,4 +75,4 @@ let () =
45
75
| _ , WEXITED n -> exit n
46
76
| _ , WSIGNALED _ -> exit 9
47
77
| _ , WSTOPPED _ -> exit 9
48
- else Unix. execvpe " node " args env
78
+ else Unix. execvpe exe args env
0 commit comments