Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo committed Dec 5, 2024
1 parent 9ffdab1 commit 56069ff
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 9 deletions.
7 changes: 6 additions & 1 deletion compiler/tests-compiler/rec52.ml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ let%expect_test "let rec" =
in
let p = compile_and_parse p in
print_program p;
let s = [%expect.output] in
let s =
Str.global_replace (Str.regexp "runtime.caml_make_vect") "runtime.caml_array_make" s
in
print_endline s;
[%expect
{|
(function(globalThis){
Expand All @@ -61,7 +66,7 @@ let%expect_test "let rec" =
Stdlib_Hashtbl = global_data.Stdlib__Hashtbl,
letrec_function_context = [],
c = [],
d = runtime.caml_make_vect(5, 0),
d = runtime.caml_array_make(5, 0),
default$0 = 42;
function a(x){return b(x);}
function b(x){
Expand Down
8 changes: 4 additions & 4 deletions dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(env
(dev
(binaries
(tools/node_wrapper.sh as node))
(tools/node_wrapper.exe as node))
(wasm_of_ocaml
(runtest_alias runtest-wasm))
(js_of_ocaml
Expand All @@ -10,7 +10,7 @@
(:standard -w +a-4-40-41-42-44-48-58-66-70)))
(using-effects
(binaries
(tools/node_wrapper.sh as node))
(tools/node_wrapper.exe as node))
(wasm_of_ocaml
(runtest_alias runtest-wasm))
(js_of_ocaml
Expand All @@ -22,7 +22,7 @@
(:standard --enable effects))))
(bench_no_debug
(binaries
(tools/node_wrapper.sh as node))
(tools/node_wrapper.exe as node))
(flags
(:standard \ -g))
(ocamlc_flags
Expand All @@ -35,7 +35,7 @@
(js_of_ocaml
(runtest_alias runtest-js))
(binaries
(tools/node_wrapper.sh as node))))
(tools/node_wrapper.exe as node))))

(rule
(targets version.ml.in)
Expand Down
2 changes: 1 addition & 1 deletion ppx/ppx_deriving_json/tests/dune
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
(rule
(alias runtest)
(enabled_if
(>= %{ocaml_version} 5.1))
(>= %{ocaml_version} 5.2))
;; (package js_of_ocaml-ppx)
(action
(diff gen.mlt gen.mlt.corrected)))
3 changes: 3 additions & 0 deletions tools/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(executable
(name node_wrapper)
(libraries unix))
28 changes: 28 additions & 0 deletions tools/node_wrapper.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
let extra_args_for_wasoo =
[ "--experimental-wasm-imported-strings"
; "--experimental-wasm-stack-switching"
; "--stack-size=10000"
]

let () =
match Unix.getenv "PATH" with
| exception Not_found -> assert false
| path -> (
let sep = if Sys.win32 then ';' else ':' in
match String.split_on_char sep path with
| drop :: paths -> Unix.putenv "PATH" (String.concat (String.make 1 sep) paths)
| [] -> assert false)

let args =
match Array.to_list Sys.argv with
| exe :: argv ->
let argv =
match argv with
| file :: _ when Filename.check_suffix file ".wasm.js" ->
extra_args_for_wasoo @ argv
| _ -> argv
in
Array.of_list (exe :: argv)
| [] -> assert false

let () = Unix.execvp "node" args
3 changes: 0 additions & 3 deletions tools/node_wrapper.sh

This file was deleted.

0 comments on commit 56069ff

Please sign in to comment.