Skip to content

Commit

Permalink
Merge branch 'master' into optim_effects
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo authored Dec 28, 2024
2 parents 0eeaafe + 4587ff5 commit 7161b7e
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 23 deletions.
12 changes: 9 additions & 3 deletions compiler/tests-full/dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
(rule
(targets stdlib.cma.js)
(enabled_if
(= %{ocaml_version} "5.2.0"))
(and
(>= %{ocaml_version} "5.2")
(< %{ocaml_version} "5.3")))
(action
(run
%{bin:js_of_ocaml}
Expand All @@ -14,7 +16,9 @@
(rule
(targets stdlib.cma.output.js)
(enabled_if
(= %{ocaml_version} "5.2.0"))
(and
(>= %{ocaml_version} "5.2")
(< %{ocaml_version} "5.3")))
(action
(with-stdout-to
%{targets}
Expand All @@ -23,7 +27,9 @@
(rule
(alias runtest)
(enabled_if
(= %{ocaml_version} "5.2.0"))
(and
(>= %{ocaml_version} "5.2")
(< %{ocaml_version} "5.3")))
(action
(diff stdlib.cma.expected.js stdlib.cma.output.js)))

Expand Down
30 changes: 15 additions & 15 deletions compiler/tests-full/stdlib.cma.expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -1121,8 +1121,8 @@
caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace,
caml_wrap_exception = runtime.caml_wrap_exception,
global_data = runtime.caml_get_global_data(),
ocaml_version = "5.2.0",
ocaml_release = [0, 5, 2, 0, 0],
ocaml_version = "5.2.1",
ocaml_release = [0, 5, 2, 1, 0],
Stdlib = global_data.Stdlib,
executable_name =
/*<<sys.ml.in:36:22>>*/ runtime.caml_sys_executable_name(0),
Expand Down Expand Up @@ -23571,26 +23571,26 @@
/*<<gc.ml:115:21>>*/ return caml_call2(Stdlib_Atomic[4], a, 0) /*<<gc.ml:115:39>>*/ ;
}
function create_alarm(f){
var _y_ = /*<<gc.ml:118:24>>*/ caml_call1(Stdlib_Atomic[1], 1);
/*<<gc.ml:119:2>>*/ caml_call1
var alarm = /*<<gc.ml:119:14>>*/ caml_call1(Stdlib_Atomic[1], 1);
/*<<gc.ml:120:2>>*/ caml_call1
(Stdlib_Domain[6],
function(param){
/*<<gc.ml:119:28>>*/ return delete_alarm(_y_) /*<<gc.ml:119:52>>*/ ;
/*<<gc.ml:120:28>>*/ return delete_alarm(alarm) /*<<gc.ml:120:46>>*/ ;
});
/*<<gc.ml:120:26>>*/ return _y_;
/*<<gc.ml:121:13>>*/ }
/*<<gc.ml:122:26>>*/ return alarm;
/*<<gc.ml:123:7>>*/ }
var
null_tracker =
/*<<?>>*/ [0,
function(param){ /*<<gc.ml:143:30>>*/ return 0; /*<<gc.ml:143:34>>*/ },
function(param){ /*<<gc.ml:144:30>>*/ return 0; /*<<gc.ml:144:34>>*/ },
function(param){ /*<<gc.ml:145:26>>*/ return 0; /*<<gc.ml:145:30>>*/ },
function(param){ /*<<gc.ml:146:32>>*/ return 0; /*<<gc.ml:146:34>>*/ },
function(param){ /*<<gc.ml:147:32>>*/ return 0; /*<<gc.ml:147:34>>*/ }];
function(param){ /*<<gc.ml:145:30>>*/ return 0; /*<<gc.ml:145:34>>*/ },
function(param){ /*<<gc.ml:146:30>>*/ return 0; /*<<gc.ml:146:34>>*/ },
function(param){ /*<<gc.ml:147:26>>*/ return 0; /*<<gc.ml:147:30>>*/ },
function(param){ /*<<gc.ml:148:32>>*/ return 0; /*<<gc.ml:148:34>>*/ },
function(param){ /*<<gc.ml:149:32>>*/ return 0; /*<<gc.ml:149:34>>*/ }];
function start(sampling_rate, opt, tracker){
var callstack_size = /*<<gc.ml:155:6>>*/ opt ? opt[1] : Stdlib[19];
/*<<gc.ml:158:6>>*/ return runtime.caml_memprof_start
(sampling_rate, callstack_size, tracker) /*<<gc.ml:158:50>>*/ ;
var callstack_size = /*<<gc.ml:157:6>>*/ opt ? opt[1] : Stdlib[19];
/*<<gc.ml:160:6>>*/ return runtime.caml_memprof_start
(sampling_rate, callstack_size, tracker) /*<<gc.ml:160:50>>*/ ;
}
var
Stdlib_Gc =
Expand Down
4 changes: 3 additions & 1 deletion dune
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@
%{dep:VERSION}
%{dep:tools/version/GIT-VERSION}))))

(data_only_dirs _wikidoc doc-dev)
(data_only_dirs _wikidoc doc-dev jane-street)

(vendored_dirs)
2 changes: 1 addition & 1 deletion runtime/wasm/effect.wat
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
(func $caml_fresh_oo_id (param (ref eq)) (result (ref eq))))
(import "obj" "cont_tag" (global $cont_tag i32))
(import "stdlib" "caml_named_value"
(func $caml_named_value (param (ref $string)) (result (ref null eq))))
(func $caml_named_value (param (ref eq)) (result (ref null eq))))
(import "fail" "ocaml_exception" (tag $ocaml_exception (param (ref eq))))
(import "fail" "javascript_exception"
(tag $javascript_exception (param externref)))
Expand Down
15 changes: 14 additions & 1 deletion runtime/wasm/jslib.wat
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
(import "fail" "caml_failwith_tag"
(func $caml_failwith_tag (result (ref eq))))
(import "stdlib" "caml_named_value"
(func $caml_named_value (param (ref $string)) (result (ref null eq))))
(func $caml_named_value (param (ref eq)) (result (ref null eq))))
(import "obj" "caml_callback_1"
(func $caml_callback_1
(param (ref eq)) (param (ref eq)) (result (ref eq))))
Expand All @@ -89,6 +89,9 @@
(func $jsstring_of_string (param (ref $string)) (result anyref)))
(import "jsstring" "string_of_jsstring"
(func $string_of_jsstring (param anyref) (result (ref $string))))
(import "jsstring" "jsstring_of_substring"
(func $jsstring_of_substring
(param (ref $string) i32 i32) (result anyref)))
(import "int32" "caml_copy_int32"
(func $caml_copy_int32 (param i32) (result (ref eq))))
(import "int32" "Int32_val"
Expand Down Expand Up @@ -459,6 +462,16 @@
(local.set $s (ref.cast (ref $string) (local.get 0)))
(return (struct.new $js (call $jsstring_of_string (local.get $s)))))

(func (export "caml_jsstring_of_substring")
(param $s (ref eq)) (param $i (ref eq)) (param $l (ref eq))
(result (ref eq))
(return
(struct.new $js
(call $jsstring_of_substring
(ref.cast (ref $string) (local.get $s))
(i31.get_u (ref.cast (ref i31) (local.get $i)))
(i31.get_u (ref.cast (ref i31) (local.get $l)))))))

(func $caml_jsbytes_of_string (export "caml_jsbytes_of_string")
(param (ref eq)) (result (ref eq))
(local $s (ref $string))
Expand Down
2 changes: 1 addition & 1 deletion runtime/wasm/stdlib.wat
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
(br $loop))))

(func $caml_named_value (export "caml_named_value")
(param $s (ref $string)) (result (ref null eq))
(param $s (ref eq)) (result (ref null eq))
(block $not_found
(return
(struct.get $assoc 1
Expand Down
2 changes: 1 addition & 1 deletion tools/ci_setup.ml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ let () =
let branch =
if is_forked nm
then
if List.mem nm [ "bonsai"; "virtual_dom"; "async_js" ]
if List.mem nm [ "bonsai"; "virtual_dom"; "async_js"; "zarith_stubs_js" ]
then Some "jsoo-6"
else Some "wasm"
else None
Expand Down

0 comments on commit 7161b7e

Please sign in to comment.