From 68962e09d72d3f98c3b208bb3db5e70f8ae1d7e6 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Thu, 5 Jun 2025 13:12:10 +0200 Subject: [PATCH 1/7] Misc: pin dune --- .github/workflows/js_of_ocaml.yml | 3 +++ .github/workflows/wasm_of_ocaml.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/js_of_ocaml.yml b/.github/workflows/js_of_ocaml.yml index ce3b29c07b..d25fd9df6e 100644 --- a/.github/workflows/js_of_ocaml.yml +++ b/.github/workflows/js_of_ocaml.yml @@ -156,6 +156,9 @@ jobs: # It's faster to use a cached version run: opam install --fake binaryen-bin + - name: pin dune + run: opam pin add dune https://github.com/hhugo/dune.git#jsoo-shape2 + - run: opam install . --best-effort --solver builtin-mccs+glpk if: ${{ matrix.skip-test }} diff --git a/.github/workflows/wasm_of_ocaml.yml b/.github/workflows/wasm_of_ocaml.yml index 96e4bb010c..b3a0f76890 100644 --- a/.github/workflows/wasm_of_ocaml.yml +++ b/.github/workflows/wasm_of_ocaml.yml @@ -111,6 +111,9 @@ jobs: - run: opam install conf-pkg-config conf-mingw-w64-gcc-i686 conf-mingw-w64-g++-x86_64 if: runner.os == 'Windows' + - name: pin dune + run: opam pin add dune https://github.com/hhugo/dune.git#jsoo-shape2 + - name: Pin wasm_of_ocaml working-directory: ./wasm_of_ocaml run: opam pin . -n --with-version dev From 4487db160924abc7bd1d31d0db048b52ce7f1ec6 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Fri, 25 Oct 2024 21:45:57 +0200 Subject: [PATCH 2/7] Compiler: consume hints for immutable blocks --- compiler/lib/ocaml_compiler.ml | 2 + compiler/lib/ocaml_compiler.mli | 2 + compiler/lib/parse_bytecode.ml | 133 ++++- compiler/tests-compiler/gh747.ml | 2 +- compiler/tests-full/stdlib.cma.expected.js | 651 ++++++++++----------- 5 files changed, 438 insertions(+), 352 deletions(-) diff --git a/compiler/lib/ocaml_compiler.ml b/compiler/lib/ocaml_compiler.ml index 0c4ed37a34..9b396c1e9d 100644 --- a/compiler/lib/ocaml_compiler.ml +++ b/compiler/lib/ocaml_compiler.ml @@ -283,4 +283,6 @@ module Cmo_format = struct let imports (t : t) = t.cu_imports let force_link (t : t) = t.cu_force_link + + let hints_pos (t : t) = t.cu_hint end diff --git a/compiler/lib/ocaml_compiler.mli b/compiler/lib/ocaml_compiler.mli index 0c4c31dd8a..4f69e6197e 100644 --- a/compiler/lib/ocaml_compiler.mli +++ b/compiler/lib/ocaml_compiler.mli @@ -73,4 +73,6 @@ module Cmo_format : sig val force_link : t -> bool val imports : t -> (string * string option) list + + val hints_pos : t -> int end diff --git a/compiler/lib/parse_bytecode.ml b/compiler/lib/parse_bytecode.ml index 4f089e7f61..3ab9042875 100644 --- a/compiler/lib/parse_bytecode.ml +++ b/compiler/lib/parse_bytecode.ml @@ -333,6 +333,63 @@ end = struct StringSet.of_list (List.concat paths) end +module Hints = struct + module Primitive = struct + type boxed_integer = + | Pnativeint + | Pint32 + | Pint64 + + type native_repr = + | Same_as_ocaml_repr + | Unboxed_float + | Unboxed_integer of boxed_integer + | Untagged_immediate + + type description = + { prim_name : string (* Name of primitive or C function *) + ; prim_arity : int (* Number of arguments *) + ; prim_alloc : bool (* Does it allocates or raise? *) + ; prim_native_name : string (* Name of C function for the nat. code gen. *) + ; prim_native_repr_args : native_repr list + ; prim_native_repr_res : native_repr + } + [@@ocaml.warning "-unused-field"] + end + + type optimization_hint = + | Hint_immutable + | Hint_unsafe + | Hint_int of Primitive.boxed_integer + | Hint_array of Lambda.array_kind + | Hint_bigarray of + { unsafe : bool + ; elt_kind : Lambda.bigarray_kind + ; layout : Lambda.bigarray_layout + } + | Hint_primitive of Primitive.description + + type t = { hints : optimization_hint Int.Hashtbl.t } + + let equal (a : optimization_hint) b = Poly.equal a b + + let create () = { hints = Int.Hashtbl.create 17 } + + let read t ~orig ic = + let l : (int * optimization_hint) list = input_value ic in + + List.iter l ~f:(fun (pos, hint) -> Int.Hashtbl.add t.hints ((pos + orig) / 4) hint) + + let read_section t ic = + let len = input_binary_int ic in + for _i = 0 to len - 1 do + let orig = input_binary_int ic in + read t ~orig ic + done + + let find t pc = Int.Hashtbl.find_all t.hints pc +end + (* Block analysis *) (* Detect each block *) module Blocks : sig @@ -864,6 +921,7 @@ type compile_info = ; code : string ; limit : int ; debug : Debug.t + ; hints : Hints.t } let string_of_addr debug_data addr = @@ -886,9 +944,11 @@ let string_of_addr debug_data addr = in Printf.sprintf "%s:%s-%s %s" file (pos loc.loc_start) (pos loc.loc_end) kind) -let is_immutable _instr _infos _pc = (* We don't know yet *) Maybe_mutable +let is_immutable _instr infos pc = + let hints = Hints.find infos.hints pc in + if List.mem ~eq:Hints.equal Hints.Hint_immutable hints then Immutable else Maybe_mutable -let rec compile_block blocks joins debug_data code pc state : unit = +let rec compile_block blocks joins hints debug_data code pc state : unit = match Addr.Map.find_opt pc !tagged_blocks with | Some old_state -> ( (* Check that the shape of the stack is compatible with the one used to compile the block *) @@ -920,7 +980,7 @@ let rec compile_block blocks joins debug_data code pc state : unit = let state = if Addr.Set.mem pc joins then State.start_block pc state else state in tagged_blocks := Addr.Map.add pc state !tagged_blocks; let instr, last, state' = - compile { blocks; joins; code; limit; debug = debug_data } pc state [] + compile { blocks; joins; code; limit; debug = debug_data; hints } pc state [] in assert (not (Addr.Map.mem pc !compiled_blocks)); (* When jumping to a block that was already visited and the @@ -959,10 +1019,10 @@ let rec compile_block blocks joins debug_data code pc state : unit = !compiled_blocks; match last with | Branch (pc', _) -> - compile_block blocks joins debug_data code pc' (adjust_state pc') + compile_block blocks joins hints debug_data code pc' (adjust_state pc') | Cond (_, (pc1, _), (pc2, _)) -> - compile_block blocks joins debug_data code pc1 (adjust_state pc1); - compile_block blocks joins debug_data code pc2 (adjust_state pc2) + compile_block blocks joins hints debug_data code pc1 (adjust_state pc1); + compile_block blocks joins hints debug_data code pc2 (adjust_state pc2) | Poptrap (_, _) -> () | Switch (_, _) -> () | Raise _ | Return _ | Stop -> () @@ -1289,7 +1349,7 @@ and compile infos pc state (instrs : instr list) = let params, state' = State.make_stack nparams state' in if debug_parser () then Format.printf ") {@."; let state' = State.clear_accu state' in - compile_block infos.blocks infos.joins infos.debug code addr state'; + compile_block infos.blocks infos.joins infos.hints infos.debug code addr state'; if debug_parser () then Format.printf "}@."; compile infos @@ -1347,7 +1407,14 @@ and compile infos pc state (instrs : instr list) = let params, state' = State.make_stack nparams state' in if debug_parser () then Format.printf ") {@."; let state' = State.clear_accu state' in - compile_block infos.blocks infos.joins infos.debug code addr state'; + compile_block + infos.blocks + infos.joins + infos.hints + infos.debug + code + addr + state'; if debug_parser () then Format.printf "}@."; Let ( x @@ -1759,9 +1826,9 @@ and compile infos pc state (instrs : instr list) = let it = Array.init isize ~f:(fun i -> base + gets code (base + i)) in let bt = Array.init bsize ~f:(fun i -> base + gets code (base + isize + i)) in Array.iter it ~f:(fun pc' -> - compile_block infos.blocks infos.joins infos.debug code pc' state); + compile_block infos.blocks infos.joins infos.hints infos.debug code pc' state); Array.iter bt ~f:(fun pc' -> - compile_block infos.blocks infos.joins infos.debug code pc' state); + compile_block infos.blocks infos.joins infos.hints infos.debug code pc' state); match isize, bsize with | _, 0 -> instrs, Switch (x, Array.map it ~f:(fun pc -> pc, [])), state | 0, _ -> @@ -1828,10 +1895,18 @@ and compile infos pc state (instrs : instr list) = interm_addr (Some handler_ctx_state, [], Pushtrap ((body_addr, []), x, (handler_addr, []))) !compiled_blocks; - compile_block infos.blocks infos.joins infos.debug code handler_addr handler_state; compile_block infos.blocks infos.joins + infos.hints + infos.debug + code + handler_addr + handler_state; + compile_block + infos.blocks + infos.joins + infos.hints infos.debug code body_addr @@ -1850,6 +1925,7 @@ and compile infos pc state (instrs : instr list) = compile_block infos.blocks infos.joins + infos.hints infos.debug code addr @@ -2539,7 +2615,7 @@ type one = ; debug : Debug.summary } -let parse_bytecode code globals debug_data = +let parse_bytecode code globals hints debug_data = let immutable = Code.Var.Hashtbl.create 0 in let state = State.initial globals immutable in Code.Var.reset (); @@ -2550,7 +2626,7 @@ let parse_bytecode code globals debug_data = then ( let start = 0 in - compile_block blocks' joins debug_data code start state; + compile_block blocks' joins hints debug_data code start state; let blocks = Addr.Map.mapi (fun _ (state, instr, last) -> @@ -2674,6 +2750,7 @@ let from_exe ?(debug = false) ic = let debug_data = Debug.create ~include_cmis debug in + let hints = Hints.create () in let toc = Toc.read ic in let primitives = read_primitives toc ic in let primitive_table = Array.of_list primitives in @@ -2720,6 +2797,11 @@ let from_exe available.@."); if times () then Format.eprintf " read debug events: %a@." Timer.print t; + (try + ignore (Toc.seek_section toc ic "HINT"); + Hints.read_section hints ic + with Not_found -> ()); + let globals = make_globals (Array.length init_data) init_data primitive_table in if linkall then @@ -2727,7 +2809,7 @@ let from_exe Ocaml_compiler.Symtable.GlobalMap.iter symbols ~f:(fun id n -> globals.named_value.(n) <- Some (Ocaml_compiler.Symtable.Global.name id); globals.is_exported.(n) <- true); - let p = parse_bytecode code globals debug_data in + let p = parse_bytecode code globals hints debug_data in (* register predefined exception *) let body = List.fold_left predefined_exceptions ~init:[] ~f:(fun body (i, name) -> @@ -2835,6 +2917,7 @@ let from_exe (* As input: list of primitives + size of global table *) let from_bytes ~prims ~debug (code : bytecode) = let debug_data = Debug.create ~include_cmis:false true in + let hints = Hints.create () in let t = Timer.make () in if Debug.names debug_data then @@ -2857,7 +2940,7 @@ let from_bytes ~prims ~debug (code : bytecode) = t in let globals = make_globals 0 [||] prims in - let p = parse_bytecode code globals debug_data in + let p = parse_bytecode code globals hints debug_data in let gdata = Var.fresh_n "global_data" in let need_gdata = ref false in let find_name i = @@ -2989,7 +3072,7 @@ module Reloc = struct globals end -let from_compilation_units ~includes:_ ~include_cmis ~debug_data l = +let from_compilation_units ~includes:_ ~include_cmis ~hints ~debug_data l = let reloc = Reloc.create () in List.iter l ~f:(fun (compunit, code) -> Reloc.step1 reloc compunit code); List.iter l ~f:(fun (compunit, code) -> Reloc.step2 reloc compunit code); @@ -2998,7 +3081,7 @@ let from_compilation_units ~includes:_ ~include_cmis ~debug_data l = let l = List.map l ~f:(fun (_, c) -> Bytes.to_string c) in String.concat ~sep:"" l in - let prog = parse_bytecode code globals debug_data in + let prog = parse_bytecode code globals hints debug_data in let gdata = Var.fresh_n "global_data" in let need_gdata = ref false in let body = @@ -3050,12 +3133,20 @@ let from_cmo ?(includes = []) ?(include_cmis = false) ?(debug = false) compunit seek_in ic compunit.Cmo_format.cu_debug; Debug.read_event_list debug_data ~crcs:[] ~includes ~orig:0 ic); if times () then Format.eprintf " read debug events: %a@." Timer.print t; - let p = from_compilation_units ~includes ~include_cmis ~debug_data [ compunit, code ] in + let hints = Hints.create () in + if Ocaml_compiler.Cmo_format.hints_pos compunit <> 0 + then ( + seek_in ic (Ocaml_compiler.Cmo_format.hints_pos compunit); + Hints.read hints ~orig:0 ic); + let p = + from_compilation_units ~includes ~include_cmis ~hints ~debug_data [ compunit, code ] + in Code.invariant p.code; p let from_cma ?(includes = []) ?(include_cmis = false) ?(debug = false) lib ic = let debug_data = Debug.create ~include_cmis debug in + let hints = Hints.create () in let orig = ref 0 in let t = ref 0. in let units = @@ -3068,12 +3159,16 @@ let from_cma ?(includes = []) ?(include_cmis = false) ?(debug = false) lib ic = then ( seek_in ic compunit.Cmo_format.cu_debug; Debug.read_event_list debug_data ~crcs:[] ~includes ~orig:!orig ic); + if Ocaml_compiler.Cmo_format.hints_pos compunit <> 0 + then ( + seek_in ic (Ocaml_compiler.Cmo_format.hints_pos compunit); + Hints.read hints ~orig:!orig ic); t := !t +. Timer.get t0; orig := !orig + compunit.Cmo_format.cu_codesize; compunit, code) in if times () then Format.eprintf " read debug events: %.2f@." !t; - let p = from_compilation_units ~includes ~include_cmis ~debug_data units in + let p = from_compilation_units ~includes ~include_cmis ~hints ~debug_data units in Code.invariant p.code; p diff --git a/compiler/tests-compiler/gh747.ml b/compiler/tests-compiler/gh747.ml index c94af5cb4e..c51b386885 100644 --- a/compiler/tests-compiler/gh747.ml +++ b/compiler/tests-compiler/gh747.ml @@ -222,7 +222,7 @@ end 1: 2: //# unitInfo: Provides: Test 3: //# unitInfo: Requires: Stdlib__Printf - 4: //# shape: Test:[N,N,[N],N,N,N,N,N,N,N,N,N,N,F(2),F(2),[F(4)]] + 4: //# shape: Test:[N,N,[N],N,N,N,N,N,N,N,N,N,[N,N],F(2),F(2),[F(4)]] 5: (function 6: (globalThis){ 7: "use strict"; diff --git a/compiler/tests-full/stdlib.cma.expected.js b/compiler/tests-full/stdlib.cma.expected.js index 6fd214a2e7..812bfc2dd3 100644 --- a/compiler/tests-full/stdlib.cma.expected.js +++ b/compiler/tests-full/stdlib.cma.expected.js @@ -350,7 +350,7 @@ //# unitInfo: Provides: Stdlib //# unitInfo: Requires: CamlinternalFormatBasics -//# shape: Stdlib:[F(1),F(1),N,N,N,N,N,N,N,N,N,N,N,N,N,F(2)*,F(2)*,F(1)*,N,N,F(1)*,N,N,N,N,N,N,F(2)*,F(1),F(1)*,F(1)*,F(1),F(1)*,F(1),F(1),F(1),F(2),N,N,N,F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(3),F(1),F(1),F(2),F(2),F(2),F(4),F(4),F(2),F(2),F(2),F(2),F(1),F(1),F(1),F(1),F(2),F(1),F(1),F(3),F(1),F(1),F(4),F(4),F(2),F(1),F(1),F(1),F(2),F(1),F(1),F(1),F(1),F(2),N,F(1)*,F(2),F(1),F(1),F(1),F(4),F(1),N] +//# shape: Stdlib:[F(1),F(1),[N,N],N,N,N,N,N,N,N,N,N,N,N,N,F(2)*,F(2)*,F(1)*,N,N,F(1)*,N,N,N,N,N,N,F(2)*,F(1),F(1)*,F(1)*,F(1),F(1)*,F(1),F(1),F(1),F(2),N,N,N,F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(3),F(1),F(1),F(2),F(2),F(2),F(4),F(4),F(2),F(2),F(2),F(2),F(1),F(1),F(1),F(1),F(2),F(1),F(1),F(3),F(1),F(1),F(4),F(4),F(2),F(1),F(1),F(1),F(2),F(1),F(1),F(1),F(1),F(2),[F(2),F(1),F(1),F(2),F(1),F(1)],F(1)*,F(2)->[N,N],F(1),F(1),F(1),F(4),F(1),N] (function (globalThis){ "use strict"; @@ -977,7 +977,7 @@ (globalThis)); //# unitInfo: Provides: Stdlib__Either -//# shape: Stdlib__Either:[F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(2),F(2),F(3),F(3),F(3),F(3),F(4),F(4)] +//# shape: Stdlib__Either:[F(1)*->[N],F(1)*->[N],F(1)*,F(1)*,F(1)*,F(1)*,F(2),F(2),F(3)->[N],F(3),F(3),F(3),F(4),F(4)] (function (globalThis){ "use strict"; @@ -1095,7 +1095,7 @@ //# unitInfo: Provides: Stdlib__Sys //# unitInfo: Requires: Stdlib -//# shape: Stdlib__Sys:[N,F(1),N,N,[N],N,N,N,N,N,N,N,N,N,F(2)*,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,F(1)*,N,N,N,F(1),F(1),[F(2)*]] +//# shape: Stdlib__Sys:[N,F(1),N,N,[N],N,N,N,N,N,N,N,N,N,F(2)*,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,[N,N],F(1)*,N,N,N,F(1),F(1),[F(2)*->[N]]] (function (globalThis){ "use strict"; @@ -1104,8 +1104,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.3.0", - ocaml_release = [0, 5, 3, 0, 0], + ocaml_version = "5.3.1+dev0-2025-01-06", + ocaml_release = [0, 5, 3, 1, [0, [0, 0, "dev0-2025-01-06"]]], Stdlib = global_data.Stdlib, executable_name = /*<>*/ runtime.caml_sys_executable_name(0), @@ -1191,7 +1191,7 @@ Break, catch_break, ocaml_version, - 0, + 1, ocaml_release, runtime.caml_ml_enable_runtime_warnings, runtime.caml_ml_runtime_warnings_enabled, @@ -1203,7 +1203,7 @@ //# unitInfo: Provides: Stdlib__Obj //# unitInfo: Requires: Stdlib, Stdlib__Sys -//# shape: Stdlib__Obj:[F(1)*,F(2),F(3),N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,[F(1),F(1)*,F(1)*],N] +//# shape: Stdlib__Obj:[F(1)*,F(2),F(3),N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,[F(1),F(1)*,F(1)*],[F(1),F(1)*,F(2),F(2),F(3),F(2),F(2),F(5),F(1),F(1),F(2),F(1),F(1),F(2),N]] (function (globalThis){ "use strict"; @@ -1376,7 +1376,7 @@ //# unitInfo: Provides: Stdlib__Type //# unitInfo: Requires: Stdlib__Obj -//# shape: Stdlib__Type:[[F(1)*,F(1),F(2)*]] +//# shape: Stdlib__Type:[[F(1)*->[[N,N]],F(1),F(2)*]] (function (globalThis){ "use strict"; @@ -1443,7 +1443,7 @@ //# unitInfo: Provides: CamlinternalLazy //# unitInfo: Requires: Stdlib, Stdlib__Obj -//# shape: CamlinternalLazy:[N,F(1),F(2)] +//# shape: CamlinternalLazy:[[N,N],F(1),F(2)] (function (globalThis){ "use strict"; @@ -1520,7 +1520,7 @@ //# unitInfo: Provides: Stdlib__Lazy //# unitInfo: Requires: CamlinternalLazy, Stdlib, Stdlib__Obj -//# shape: Stdlib__Lazy:[N,F(2)*,F(1),F(1),F(2),F(1),F(1)] +//# shape: Stdlib__Lazy:[[N,N],F(2)*,F(1),F(1),F(2),F(1),F(1)] (function (globalThis){ "use strict"; @@ -1611,7 +1611,7 @@ //# unitInfo: Provides: Stdlib__Seq //# unitInfo: Requires: CamlinternalLazy, Stdlib, Stdlib__Atomic, Stdlib__Lazy -//# shape: Stdlib__Seq:[F(1),F(1),F(1),F(2),F(3),F(2),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(4),F(3),F(3),F(3),F(3),F(1)*,F(2)*,F(3)*,F(2),F(3),F(2)*,F(2),F(2),F(2)*->F(1)*,F(3),F(2)*->F(1),F(3),F(3),F(3)*->F(1)*,F(2),F(2),F(3),F(3),F(3),F(1)->F(1),N,F(1)*->F(1),F(2),F(3),F(2),F(3),F(3),F(3),F(4),F(3),F(4),F(2)*,F(3)*->F(1),F(1)*,F(1)*,F(2)*,F(2)*,F(1)*->F(1),F(1)*->F(1),F(2)*] +//# shape: Stdlib__Seq:[F(1),F(1),F(1),F(2),F(3),F(2),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(4),F(3),F(3),F(3),F(3),F(1)*,F(2)*->[N,F(1)*],F(3)*->[N,N],F(2),F(3),F(2)*->[N,F(1)],F(2)->[N,F(1)],F(2),F(2)*->F(1)*->[N,F(1)],F(3),F(2)*->F(1),F(3),F(3),F(3)*->F(1)*->[N,F(1)],F(2),F(2),F(3),F(3),F(3),F(1)->F(1),[N,N],F(1)*->F(1),F(2),F(3),F(2),F(3),F(3),F(3),F(4),F(3),F(4),F(2)*,F(3)*->F(1),F(1)*->[F(1),F(1)],F(1)*->[F(1),F(1)],F(2)*->[F(1),F(1)],F(2)*->[F(1),F(1)],F(1)*->F(1),F(1)*->F(1),F(2)*->[N,F(1)]] (function (globalThis){ "use strict"; @@ -2532,7 +2532,7 @@ //# unitInfo: Provides: Stdlib__Option //# unitInfo: Requires: Stdlib, Stdlib__Seq -//# shape: Stdlib__Option:[N,F(1)*,F(2)*,F(1),F(2),F(1)*,F(2),F(3),F(2),F(1)*,F(1)*,F(3),F(3),F(2)*,F(1)*,F(1)*->F(1)*] +//# shape: Stdlib__Option:[N,F(1)*->[N],F(2)*,F(1),F(2),F(1)*,F(2),F(3),F(2),F(1)*,F(1)*,F(3),F(3),F(2)*->[N],F(1)*,F(1)*->F(1)*] (function (globalThis){ "use strict"; @@ -2661,7 +2661,7 @@ //# unitInfo: Provides: Stdlib__Result //# unitInfo: Requires: Stdlib, Stdlib__Seq -//# shape: Stdlib__Result:[F(1)*,F(1)*,F(2)*,F(1),F(1),F(2),F(1)*,F(2),F(2),F(3),F(2),F(2),F(1)*,F(1)*,F(4),F(4),F(1)*,F(1)*,F(1)*->F(1)*] +//# shape: Stdlib__Result:[F(1)*->[N],F(1)*->[N],F(2)*,F(1),F(1),F(2),F(1)*,F(2),F(2),F(3),F(2),F(2),F(1)*,F(1)*,F(4),F(4),F(1)*,F(1)*,F(1)*->F(1)*] (function (globalThis){ "use strict"; @@ -3123,7 +3123,7 @@ //# unitInfo: Provides: Stdlib__List //# unitInfo: Requires: Stdlib -//# shape: Stdlib__List:[F(1),F(2),F(2),F(1)*,F(2)*,F(1),F(1),F(2),F(2),F(1),F(2),F(2),F(2),F(1),F(1),F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(3),F(3),F(4),F(4),F(2),F(2),F(3),F(3),F(2),F(2),F(2),F(2),F(1)*->F(1),F(2),F(1)*->F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(3),F(1)*->F(1)*,F(1)] +//# shape: Stdlib__List:[F(1),F(2),F(2),F(1)*,F(2)*->[N,N],F(1),F(1),F(2),F(2),F(1),F(2),F(2),F(2),F(1),F(1),F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(3)->[N,N],F(3),F(3),F(3),F(3),F(3),F(4),F(4),F(2),F(2),F(3),F(3),F(2),F(2),F(2),F(2),F(1)*->F(1),F(2),F(1)*->F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2)->[N,N],F(2)->[N,N],F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(3),F(1)*->F(1)*,F(1)] (function (globalThis){ "use strict"; @@ -4805,7 +4805,7 @@ //# unitInfo: Provides: Stdlib__Bytes //# unitInfo: Requires: Stdlib, Stdlib__Char, Stdlib__Int, Stdlib__Seq, Stdlib__Sys, Stdlib__Uchar -//# shape: Stdlib__Bytes:[F(2),F(2),N,F(1),F(1),F(1),F(3),F(3),F(3),F(4),F(5),F(5),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(2),F(2),F(1),F(1),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(2),F(3),F(3),F(1),F(1),F(1),F(1),F(2)*,F(2)*,F(2),F(2),F(1),F(1)*,F(2),F(1)*->F(1),F(1)*->F(1),F(1),F(2),F(3),F(1),F(2),F(3),F(1),F(2),F(3),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(1)] +//# shape: Stdlib__Bytes:[F(2),F(2),N,F(1),F(1),F(1),F(3),F(3),F(3),F(4),F(5),F(5),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(2),F(2),F(1),F(1),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(2),F(3),F(3),F(1),F(1),F(1),F(1),F(2)*,F(2)*,F(2),F(2),F(1),F(1)*,F(2)->[N,N],F(1)*->F(1),F(1)*->F(1),F(1),F(2),F(3),F(1),F(2),F(3),F(1),F(2),F(3),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(1)] (function (globalThis){ "use strict"; @@ -6365,7 +6365,7 @@ //# unitInfo: Provides: Stdlib__String //# unitInfo: Requires: Stdlib, Stdlib__Bytes -//# shape: Stdlib__String:[F(2),F(2),N,F(1),F(1),F(5),F(2),F(2)*,F(2)*,F(2)*,F(2),F(2),F(3),F(3),F(2),F(3),F(2),F(2),F(2),F(3),F(3),F(2),F(2),F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(2),F(3),F(3),F(3),F(3),F(2),F(2),F(2),F(2),F(1)*,F(1)*,F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(2)] +//# shape: Stdlib__String:[F(2),F(2),N,F(1),F(1),F(5),F(2),F(2)*,F(2)*,F(2)*,F(2),F(2),F(3),F(3),F(2),F(3),F(2)->[N,N],F(2),F(2),F(3),F(3),F(2),F(2),F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(2),F(3),F(3),F(3),F(3),F(2),F(2),F(2),F(2),F(1)*,F(1)*,F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(2)] (function (globalThis){ "use strict"; @@ -7022,7 +7022,7 @@ //# unitInfo: Provides: Stdlib__Array //# unitInfo: Requires: Stdlib, Stdlib__Seq, Stdlib__String -//# shape: Stdlib__Array:[F(2),F(3),F(3),F(2)*,F(1)*,F(3),F(1)*,F(4),F(5),F(1),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(3),F(2),F(2),F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(1)*->F(1)*,F(1)*->F(1)*,F(1),[]] +//# shape: Stdlib__Array:[F(2),F(3),F(3),F(2)*,F(1)*,F(3),F(1)*,F(4),F(5),F(1),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3)->[N,N],F(3),F(3),F(3),F(2),F(2),F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(1)->[N,N],F(2),F(2),F(2),F(2),F(2),F(1)*->F(1)*,F(1)*->F(1)*,F(1),[]] (function (globalThis){ "use strict"; @@ -7980,7 +7980,7 @@ //# unitInfo: Provides: Stdlib__Float //# unitInfo: Requires: Stdlib, Stdlib__Array, Stdlib__List, Stdlib__Seq -//# shape: Stdlib__Float:[N,N,N,F(1)*,F(1)*,N,N,N,N,N,N,N,N,N,F(1)*,F(1)*,F(1)*,F(1)*,F(1),F(1),F(2)*,F(2)*,F(2)*,F(2)*,F(2)*,F(2)*,F(2)*,F(2)*,F(2)*,F(1)*,N,N] +//# shape: Stdlib__Float:[N,N,N,F(1)*,F(1)*,N,N,N,N,N,N,N,N,N,F(1)*,F(1)*,F(1)*,F(1)*,F(1),F(1),F(2)*,F(2)*,F(2)*,F(2)*,F(2)*->[N,N],F(2)*,F(2)*,F(2)*->[N,N],F(2)*,F(1)*,[F(1)*,F(2),F(3),F(2)*,F(1)*,F(2),F(3),F(3),F(2)*,F(1),F(3),F(1)*,F(4),F(5),F(1),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1)*->F(1)*,F(1)*->F(1)*,F(1),F(2),F(2)],[F(1)*,F(2),F(3),F(2)*,F(1)*,F(2),F(3),F(3),F(2)*,F(1),F(3),F(1)*,F(4),F(5),F(1),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1)*->F(1)*,F(1)*->F(1)*,F(1),F(2),F(2)]] (function (globalThis){ "use strict"; @@ -9765,7 +9765,7 @@ //# unitInfo: Provides: Stdlib__Parsing //# unitInfo: Requires: Stdlib, Stdlib__Array, Stdlib__Lexing, Stdlib__Obj -//# shape: Stdlib__Parsing:[F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),N,F(1),N,F(4),F(2),F(1),F(1)*] +//# shape: Stdlib__Parsing:[F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),[N,N],F(1),[N,N],F(4),F(2),F(1),F(1)*] (function (globalThis){ "use strict"; @@ -10013,7 +10013,7 @@ //# unitInfo: Provides: Stdlib__Set //# unitInfo: Requires: Stdlib, Stdlib__List, Stdlib__Seq -//# shape: Stdlib__Set:[F(1)*] +//# shape: Stdlib__Set:[F(1)*->[N,F(2),F(1)*->[N,N,N,N],F(2),F(2),F(2),F(2),F(2),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(2),F(2),F(2),F(2),F(2),F(1)*,F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(1),F(2)->F(1),F(1)->F(1),F(1)->F(1),F(2),F(1)]] (function (globalThis){ "use strict"; @@ -11065,7 +11065,7 @@ //# unitInfo: Provides: Stdlib__Map //# unitInfo: Requires: Stdlib, Stdlib__List, Stdlib__Seq -//# shape: Stdlib__Map:[F(1)*] +//# shape: Stdlib__Map:[F(1)*->[N,F(3),F(3),F(3),F(2)*->[N,N,N,N,N],F(2),F(3),F(3),F(1),F(1),F(1)->[N,N],F(1),F(1)->[N,N],F(1),F(1)->[N,N],F(1),F(2),F(2),F(2)->[N,N],F(2),F(2)->[N,N],F(2),F(2),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(1)*,F(2),F(3),F(3),F(2),F(2),F(1),F(1),F(1)->F(1),F(1)->F(1),F(2)->F(1),F(2),F(1)]] (function (globalThis){ "use strict"; @@ -12109,7 +12109,7 @@ //# unitInfo: Provides: Stdlib__Stack //# unitInfo: Requires: Stdlib__List, Stdlib__Seq -//# shape: Stdlib__Stack:[N,F(1)*,F(2),F(1),F(1),F(1),F(1),F(1)*,F(1),F(1)*,F(1)*,F(1)*,F(2),F(3),F(1)*,F(2),F(1)] +//# shape: Stdlib__Stack:[[N,N],F(1)*,F(2),F(1),F(1),F(1),F(1),F(1)*,F(1),F(1)*,F(1)*,F(1)*,F(2),F(3),F(1)*,F(2),F(1)] (function (globalThis){ "use strict"; @@ -12230,7 +12230,7 @@ //# unitInfo: Provides: Stdlib__Queue //# unitInfo: Requires: Stdlib__Seq -//# shape: Stdlib__Queue:[N,F(1)*,F(2),F(2),F(1),F(1),F(1),F(1),F(1)*,F(1),F(1),F(1),F(1),F(1)*,F(1)*,F(2),F(3),F(2),F(1)*->F(1)*,F(2),F(1)] +//# shape: Stdlib__Queue:[[N,N],F(1)*,F(2),F(2),F(1),F(1),F(1),F(1),F(1)*,F(1),F(1),F(1),F(1),F(1)*,F(1)*,F(2),F(3),F(2),F(1)*->F(1)*,F(2),F(1)] (function (globalThis){ "use strict"; @@ -13241,7 +13241,7 @@ //# unitInfo: Provides: Stdlib__Domain //# unitInfo: Requires: Stdlib, Stdlib__Array, Stdlib__Atomic, Stdlib__Condition, Stdlib__List, Stdlib__Mutex -//# shape: Stdlib__Domain:[F(1),F(1),F(1)*,F(1),F(1),F(1),F(1),F(1),F(1),F(1),N] +//# shape: Stdlib__Domain:[F(1)->[N,N],F(1),F(1)*,F(1),F(1),F(1),F(1),F(1),F(1),F(1),[F(2)->[N,N],F(1),F(2)]] (function (globalThis){ "use strict"; @@ -13506,7 +13506,7 @@ //# unitInfo: Provides: CamlinternalFormat //# unitInfo: Requires: CamlinternalFormatBasics, Stdlib, Stdlib__Buffer, Stdlib__Bytes, Stdlib__Char, Stdlib__Int, Stdlib__String, Stdlib__Sys -//# shape: CamlinternalFormat:[F(2),F(1),F(1),F(2),F(1),F(2)*,F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1)*,F(1),F(1),F(1),F(1),F(1),F(2),F(2)] +//# shape: CamlinternalFormat:[F(2),F(1),F(1),F(2),F(1),F(2)*->[N],F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1)*,F(1),F(1),F(1),F(1),F(1),F(2),F(2)] (function (globalThis){ "use strict"; @@ -20612,7 +20612,7 @@ //# unitInfo: Provides: Stdlib__Arg //# unitInfo: Requires: Stdlib, Stdlib__Array, Stdlib__Buffer, Stdlib__Int, Stdlib__List, Stdlib__Printf, Stdlib__String, Stdlib__Sys -//# shape: Stdlib__Arg:[F(3),F(3),F(5),F(5),F(5),F(3),N,N,F(2),F(2),F(2),N,F(1),F(1),F(2),F(2)] +//# shape: Stdlib__Arg:[F(3),F(3),F(5),F(5),F(5),F(3),[N,N],[N,N],F(2),F(2),F(2),N,F(1),F(1),F(2),F(2)] (function (globalThis){ "use strict"; @@ -21463,7 +21463,7 @@ //# unitInfo: Provides: Stdlib__Printexc //# unitInfo: Requires: Stdlib, Stdlib__Atomic, Stdlib__Buffer, Stdlib__Obj, Stdlib__Printf -//# shape: Stdlib__Printexc:[F(1),F(1),F(2),F(2),F(1),F(1),F(1),F(1),F(1),F(1),F(1)*,F(1)*,F(2),F(1),F(2),F(1),F(1),F(1),N,F(1)*,F(2),F(1),F(1),F(1),F(1),F(1)] +//# shape: Stdlib__Printexc:[F(1),F(1),F(2),F(2),F(1),F(1),F(1),F(1),F(1),F(1),F(1)*,F(1)*,F(2),F(1),F(2),F(1),F(1),F(1),[F(1)*,F(1)*,F(1)*,F(1)*,F(2)],F(1)*,F(2),F(1),F(1),F(1),F(1),F(1)] (function (globalThis){ "use strict"; @@ -22086,7 +22086,7 @@ //# unitInfo: Provides: Stdlib__Fun //# unitInfo: Requires: Stdlib, Stdlib__Printexc -//# shape: Stdlib__Fun:[F(2)*,F(3),F(3),F(2),F(2),N] +//# shape: Stdlib__Fun:[F(2)*,F(3),F(3),F(2),F(2),[N,N]] (function (globalThis){ "use strict"; @@ -22185,7 +22185,7 @@ //# unitInfo: Provides: Stdlib__Gc //# unitInfo: Requires: Stdlib, Stdlib__Atomic, Stdlib__Domain, Stdlib__Fun, Stdlib__Printf, Stdlib__Sys -//# shape: Stdlib__Gc:[F(1),F(1),F(2)*,F(2),F(1)*,F(1),F(1),F(1)*,F(1)*,N] +//# shape: Stdlib__Gc:[F(1),F(1),F(2)*,F(2),F(1)*,F(1),F(1),F(1)*,F(1)*,[[F(1)*,F(1)*,F(1)*,F(1)*,F(1)*],F(3),F(1),F(1)]] (function (globalThis){ "use strict"; @@ -22394,7 +22394,7 @@ //# unitInfo: Provides: Stdlib__In_channel //# unitInfo: Requires: Stdlib, Stdlib__Bytes, Stdlib__Fun, Stdlib__Sys -//# shape: Stdlib__In_channel:[N,F(1),F(1),F(3),F(2),F(2),F(4),F(1),F(1),F(1),F(1),F(1),F(2),F(1),F(1),F(4),F(4),F(4),F(4),F(3),N,N,N,F(2),F(1),F(1)] +//# shape: Stdlib__In_channel:[N,F(1),F(1),F(3),F(2),F(2),F(4),F(1),F(1),F(1),F(1),F(1),F(2),F(1),F(1),F(4),F(4),F(4),F(4),F(3),F(2),F(1),F(1),F(2),F(1),F(1)] (function (globalThis){ "use strict"; @@ -22740,7 +22740,7 @@ //# unitInfo: Provides: Stdlib__Out_channel //# unitInfo: Requires: Stdlib, Stdlib__Fun -//# shape: Stdlib__Out_channel:[N,N,F(1),F(1),F(3),F(2),F(2),F(4),F(1),F(1),F(2),F(2),F(2),F(2),F(4),F(4),F(4),F(1),F(1),N,N,N,F(2),F(1),F(2),F(1),F(1)] +//# shape: Stdlib__Out_channel:[N,N,F(1),F(1),F(3),F(2),F(2),F(4),F(1),F(1),F(2),F(2),F(2),F(2),F(4),F(4),F(4),F(1),F(1),F(2),F(1),F(1),F(2),F(1),F(2),F(1),F(1)] (function (globalThis){ "use strict"; @@ -22851,7 +22851,7 @@ //# unitInfo: Provides: Stdlib__Digest //# unitInfo: Requires: Stdlib, Stdlib__Bytes, Stdlib__Char, Stdlib__In_channel, Stdlib__Int, Stdlib__String -//# shape: Stdlib__Digest:[F(2)*,F(2)*,F(1),F(1),F(3),F(3),F(2),F(1),F(2),F(1),F(1),F(1),F(1),N,N,N,N] +//# shape: Stdlib__Digest:[F(2)*,F(2)*,F(1),F(1),F(3),F(3),F(2),F(1),F(2),F(1),F(1),F(1),F(1),N,N,N,[N,F(2)*,F(2)*,F(1),F(1),F(3),F(3),F(2),F(1),F(2),F(1),F(1),F(1)]] (function (globalThis){ "use strict"; @@ -23162,7 +23162,7 @@ //# unitInfo: Provides: Stdlib__Bigarray //# unitInfo: Requires: Stdlib, Stdlib__Array, Stdlib__Sys -//# shape: Stdlib__Bigarray:[N,N,N,N,N,N,N,N,N,N,N,N,N,N,F(1)*,N,N,N,N,N,N,N,F(1),F(1),F(1),F(1),F(2),F(1),F(2),F(3),F(4)] +//# shape: Stdlib__Bigarray:[N,N,N,N,N,N,N,N,N,N,N,N,N,N,F(1)*,N,N,[F(4),F(1),F(1)],[F(2),F(3),F(2),F(1),F(1),F(1)*->F(1),F(3)],[F(3),F(4),F(2),F(1),F(2),F(3)],[F(4),F(5),F(2),F(1),F(2),F(2),F(3)],[F(5),F(6),F(2),F(1),F(3),F(3),F(2),F(2),F(3)],F(1),F(1),F(1),F(1),F(2),F(1),F(2),F(3),F(4)] (function (globalThis){ "use strict"; @@ -23789,7 +23789,7 @@ //# unitInfo: Provides: Stdlib__Random //# unitInfo: Requires: Stdlib, Stdlib__Bigarray, Stdlib__Bytes, Stdlib__Digest, Stdlib__Domain, Stdlib__Int32, Stdlib__Int64, Stdlib__Nativeint, Stdlib__String, Stdlib__Sys -//# shape: Stdlib__Random:[F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(1),F(1),F(1),F(1),N,F(1),F(1),F(1)] +//# shape: Stdlib__Random:[F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(1),F(1),F(1),F(1),[F(1),F(1),F(1),F(1)*,F(2),F(2),F(3),F(2),F(3),F(2),F(3),F(2),F(3),F(2),F(1)*,F(1)*,F(1)*,F(1)*,F(1),F(1),F(1)],F(1),F(1),F(1)] (function (globalThis){ "use strict"; @@ -23811,23 +23811,7 @@ caml_lxm_next = runtime.caml_lxm_next, caml_mod = runtime.caml_mod, caml_notequal = runtime.caml_notequal, - caml_sys_random_seed = runtime.caml_sys_random_seed; - function caml_call1(f, a0){ - return (f.l >= 0 ? f.l : f.l = f.length) === 1 - ? f(a0) - : runtime.caml_call_gen(f, [a0]); - } - function caml_call2(f, a0, a1){ - return (f.l >= 0 ? f.l : f.l = f.length) === 2 - ? f(a0, a1) - : runtime.caml_call_gen(f, [a0, a1]); - } - function caml_call3(f, a0, a1, a2){ - return (f.l >= 0 ? f.l : f.l = f.length) === 3 - ? f(a0, a1, a2) - : runtime.caml_call_gen(f, [a0, a1, a2]); - } - var + caml_sys_random_seed = runtime.caml_sys_random_seed, global_data = runtime.caml_get_global_data(), serialization_prefix = "lxm1:", Stdlib_Domain = global_data.Stdlib__Domain, @@ -23846,7 +23830,7 @@ _d_ = caml_int64_create_lo_mi_hi(2, 0, 0), _e_ = caml_int64_create_lo_mi_hi(1, 0, 0); function create(param){ - /*<>*/ return caml_call3(Stdlib_Bigarray[20][1], 7, 0, 4) /*<>*/ ; + /*<>*/ return Stdlib_Bigarray[20][1].call(null, 7, 0, 4) /*<>*/ ; } function set(s, i1, i2, i3, i4){ /*<>*/ /*<>*/ caml_ba_set_1 @@ -24182,102 +24166,101 @@ } var random_key = - /*<>*/ caml_call2 - (Stdlib_Domain[11][1], [0, split], mk_default); + /*<>*/ Stdlib_Domain[11][1].call + (null, [0, split], mk_default); function bits$0(param){ /*<>*/ return /*<>*/ bits - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key)) /*<>*/ ; + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key)) /*<>*/ ; } function int$0(bound){ /*<>*/ return /*<>*/ int - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key), bound) /*<>*/ ; } function full_int$0(bound){ /*<>*/ return /*<>*/ full_int - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key), bound) /*<>*/ ; } function int_in_range$0(min, max){ /*<>*/ return /*<>*/ int_in_range - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key), min, max) /*<>*/ ; } function int32$0(bound){ /*<>*/ return /*<>*/ int32 - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key), bound) /*<>*/ ; } function int32_in_range$0(min, max){ /*<>*/ return /*<>*/ int32_in_range - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key), min, max) /*<>*/ ; } function nativeint$0(bound){ /*<>*/ return /*<>*/ nativeint - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key), bound) /*<>*/ ; } function nativeint_in_range$0(min, max){ /*<>*/ return /*<>*/ nativeint_in_range - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key), min, max) /*<>*/ ; } function int64$0(bound){ /*<>*/ return /*<>*/ int64 - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key), bound) /*<>*/ ; } function int64_in_range$0(min, max){ /*<>*/ return /*<>*/ int64_in_range - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key), min, max) /*<>*/ ; } function float$0(scale){ /*<>*/ return /*<>*/ float - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key), scale) /*<>*/ ; } function bool$0(param){ /*<>*/ return /*<>*/ bool - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key)) /*<>*/ ; + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key)) /*<>*/ ; } function bits32$0(param){ /*<>*/ return /*<>*/ bits32 - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key)) /*<>*/ ; + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key)) /*<>*/ ; } function bits64$0(param){ var - s = - /*<>*/ caml_call1(Stdlib_Domain[11][2], random_key); + s = /*<>*/ Stdlib_Domain[11][2].call(null, random_key); /*<>*/ return caml_lxm_next(s) /*<>*/ ; } function nativebits$0(param){ /*<>*/ return /*<>*/ nativebits - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key)) /*<>*/ ; + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key)) /*<>*/ ; } function full_init(seed){ /*<>*/ return /*<>*/ reinit - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key), seed) /*<>*/ ; } function init(seed){ @@ -24289,18 +24272,18 @@ } function split$0(param){ /*<>*/ return /*<>*/ split - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key)) /*<>*/ ; + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key)) /*<>*/ ; } function get_state(param){ /*<>*/ return /*<>*/ copy - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], random_key)) /*<>*/ ; + ( /*<>*/ Stdlib_Domain[11][2].call + (null, random_key)) /*<>*/ ; } function set_state(src){ var dst = - /*<>*/ caml_call1(Stdlib_Domain[11][2], random_key); + /*<>*/ Stdlib_Domain[11][2].call(null, random_key); /*<>*/ return caml_ba_blit(src, dst) /*<>*/ ; } var @@ -24356,7 +24339,7 @@ //# unitInfo: Provides: Stdlib__Hashtbl //# unitInfo: Requires: Stdlib, Stdlib__Array, Stdlib__Atomic, Stdlib__Domain, Stdlib__Int, Stdlib__Random, Stdlib__Seq, Stdlib__String, Stdlib__Sys -//# shape: Stdlib__Hashtbl:[F(2),F(1),F(1),F(1),F(3),F(2),F(2),F(2),F(2),F(2),F(3),F(2),F(2),F(3),F(1)*,F(1),F(1),F(2),F(1),F(1)*->F(1),F(1)*->F(1),F(1)*->F(1),F(2),F(2),F(1),F(1)*,F(1)*,F(1)*,F(2)*,F(3)*,F(4)*] +//# shape: Stdlib__Hashtbl:[F(2),F(1),F(1),F(1),F(3),F(2),F(2),F(2),F(2),F(2),F(3),F(2),F(2),F(3),F(1)*,F(1),F(1),F(2),F(1)->[N,N,N,N],F(1)*->F(1),F(1)*->F(1),F(1)*->F(1),F(2),F(2),F(1),F(1)*->[F(1),N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,F(1)],F(1)*->[F(2),F(1),F(1),F(1),F(3),F(2),F(2),F(2),F(2),F(3),F(2),F(2),F(2),F(3),F(1)*,F(1)->[N,N,N,N],F(1)*->F(1),F(1)*->F(1),F(1)*->F(1),F(2),F(2),F(1)],F(1)*,F(2)*,F(3)*,F(4)*] (function (globalThis){ "use strict"; @@ -24445,8 +24428,8 @@ } var prng_key = - /*<>*/ caml_call2 - (Stdlib_Domain[11][1], 0, Stdlib_Random[19][2]); + /*<>*/ Stdlib_Domain[11][1].call + (null, 0, Stdlib_Random[19][2]); function power_2_above(x$1, n){ var x = /*<>*/ x$1; for(;;){ @@ -24467,10 +24450,11 @@ /*<>*/ if(random) var _K_ = - /*<>*/ caml_call1(Stdlib_Domain[11][2], prng_key), + /*<>*/ Stdlib_Domain[11][2].call(null, prng_key), seed = - /*<>*/ /*<>*/ caml_call1 - (Stdlib_Random[19][4], _K_); + /*<>*/ /*<>*/ Stdlib_Random[19] + [4].call + (null, _K_); else var seed = /*<>*/ 0; /*<>*/ return [0, 0, caml_array_make(s, 0), seed, s] /*<>*/ ; @@ -25137,11 +25121,11 @@ add_seq = include[20], replace_seq = include[21]; function create(sz){ - /*<>*/ return caml_call2(_g_, _a_, sz) /*<>*/ ; + /*<>*/ return _g_(_a_, sz) /*<>*/ ; } function of_seq(i){ - var tbl = /*<>*/ caml_call2(_g_, _a_, 16); - /*<>*/ caml_call2(replace_seq, tbl, i); + var tbl = /*<>*/ _g_(_a_, 16); + /*<>*/ replace_seq(tbl, i); /*<>*/ return tbl; /*<>*/ } /*<>*/ return [0, @@ -25431,10 +25415,12 @@ /*<>*/ if(random) var _c_ = - /*<>*/ caml_call1(Stdlib_Domain[11][2], prng_key), + /*<>*/ Stdlib_Domain[11][2].call(null, prng_key), seed = - /*<>*/ /*<>*/ caml_call1 - (Stdlib_Random[19][4], _c_); + /*<>*/ /*<>*/ Stdlib_Random + [19] + [4].call + (null, _c_); else var seed = /*<>*/ 4 <= h.length - 1 ? h[3] : 0; var @@ -25489,7 +25475,7 @@ //# unitInfo: Provides: Stdlib__Weak //# unitInfo: Requires: Stdlib, Stdlib__Array, Stdlib__Int, Stdlib__Obj, Stdlib__Sys -//# shape: Stdlib__Weak:[F(1),F(1)*,F(3),F(2),F(2),F(2),F(4),F(5),F(1)] +//# shape: Stdlib__Weak:[F(1),F(1)*,F(3),F(2),F(2),F(2),F(4),F(5),F(1)->[F(1)*,F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(1),F(1)->[N,N,N,N,N,N]]] (function (globalThis){ "use strict"; @@ -26049,7 +26035,7 @@ //# unitInfo: Provides: Stdlib__Format //# unitInfo: Requires: CamlinternalFormat, Stdlib, Stdlib__Array, Stdlib__Buffer, Stdlib__Bytes, Stdlib__Domain, Stdlib__Int, Stdlib__List, Stdlib__Queue, Stdlib__Seq, Stdlib__Stack, Stdlib__String -//# shape: Stdlib__Format:[F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(4),F(3),F(2),F(1),F(3),F(2),F(5),F(4),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2)*,F(2),F(1),F(2),F(1),F(3),F(2),F(3),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),N,F(2),F(1),F(2)*,F(1),F(2),F(1),F(2)*,F(1),F(1)*,F(3),F(2),F(3),F(2),F(2),F(1),F(2)*,F(1),F(2),F(1),F(2)*,F(1),F(2)*,F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(3),F(2),F(2),F(1),F(2)*,F(1),N,F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2)*,F(1),F(2)*,F(1),F(2),F(1),F(3),F(2),F(2)*,F(1),F(2),F(1),F(2)*,F(1),F(2),F(1),F(2)*,F(1),F(1),F(1),N,F(1),N,F(1),F(1),N,F(1),N,F(1),F(1),F(2),F(2),F(1),F(1)*,F(1),F(1),F(1),F(2),F(1),F(5),F(4),F(4),F(4),F(2),F(4),F(4),F(4),F(1)*->F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(3),F(2),F(3),F(2),F(2)] +//# shape: Stdlib__Format:[F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(4),F(3),F(2),F(1),F(3),F(2),F(5),F(4),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2)*,F(2),F(1),F(2),F(1),F(3),F(2),F(3),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),N,F(2),F(1),F(2)*,F(1),F(2),F(1),F(2)*,F(1),F(1)*,F(3),F(2),F(3),F(2),F(2),F(1),F(2)*->[N,N],F(1),F(2),F(1),F(2)*,F(1),F(2)*,F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(3),F(2),F(2),F(1),F(2)*,F(1),[N,N],F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2)*,F(1),F(2)*,F(1),F(2),F(1),F(3),F(2),F(2)*->[N,N],F(1),F(2),F(1),F(2)*->[N,N,N,N,N],F(1),F(2),F(1),F(2)*->[N,N,N,N],F(1),F(1),F(1),N,F(1),N,F(1),F(1),N,F(1),N,F(1),F(1),F(2),F(2),F(1),F(1)*,F(1),F(1),F(1),F(2),F(1),F(5),F(4),F(4),F(4),F(2),F(4),F(4),F(4),F(1)*->F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(3),F(2),F(3),F(2),F(2)] (function (globalThis){ "use strict"; @@ -27010,31 +26996,30 @@ /*<>*/ formatter_of_out_channel(Stdlib[40]), str_formatter = /*<>*/ formatter_of_buffer(stdbuf), stdbuf_key = - /*<>*/ caml_call2 - (Stdlib_Domain[11][1], 0, pp_make_buffer); - /*<>*/ caml_call2 - (Stdlib_Domain[11][3], stdbuf_key, stdbuf); + /*<>*/ Stdlib_Domain[11][1].call + (null, 0, pp_make_buffer); + /*<>*/ Stdlib_Domain[11][3].call + (null, stdbuf_key, stdbuf); var str_formatter_key = - /*<>*/ caml_call2 - (Stdlib_Domain[11][1], + /*<>*/ Stdlib_Domain[11][1].call + (null, 0, function(param){ /*<>*/ return /*<>*/ formatter_of_buffer - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], stdbuf_key)) /*<>*/ ; + ( /*<>*/ Stdlib_Domain[11][2].call + (null, stdbuf_key)) /*<>*/ ; }); - /*<>*/ caml_call2 - (Stdlib_Domain[11][3], str_formatter_key, str_formatter); + /*<>*/ Stdlib_Domain[11][3].call + (null, str_formatter_key, str_formatter); function buffered_out_string(key, str, ofs, len){ - var - _P_ = /*<>*/ caml_call1(Stdlib_Domain[11][2], key); + var _P_ = /*<>*/ Stdlib_Domain[11][2].call(null, key); /*<>*/ return Stdlib_Buffer[18].call (null, _P_, str, ofs, len) /*<>*/ ; } function buffered_out_flush(oc, key, param){ var - buf = /*<>*/ caml_call1(Stdlib_Domain[11][2], key), + buf = /*<>*/ Stdlib_Domain[11][2].call(null, key), len = /*<>*/ Stdlib_Buffer[7].call(null, buf), str = /*<>*/ Stdlib_Buffer[2].call(null, buf); /*<>*/ Stdlib[69].call(null, oc, str, 0, len); @@ -27043,24 +27028,24 @@ } var std_buf_key = - /*<>*/ caml_call2 - (Stdlib_Domain[11][1], + /*<>*/ Stdlib_Domain[11][1].call + (null, 0, function(param){ /*<>*/ return Stdlib_Buffer[1].call (null, pp_buffer_size) /*<>*/ ; }), err_buf_key = - /*<>*/ caml_call2 - (Stdlib_Domain[11][1], + /*<>*/ Stdlib_Domain[11][1].call + (null, 0, function(param){ /*<>*/ return Stdlib_Buffer[1].call (null, pp_buffer_size) /*<>*/ ; }), std_formatter_key = - /*<>*/ caml_call2 - (Stdlib_Domain[11][1], + /*<>*/ Stdlib_Domain[11][1].call + (null, 0, function(param){ var @@ -27097,12 +27082,12 @@ }); /*<>*/ return ppf; /*<>*/ }); - /*<>*/ caml_call2 - (Stdlib_Domain[11][3], std_formatter_key, std_formatter); + /*<>*/ Stdlib_Domain[11][3].call + (null, std_formatter_key, std_formatter); var err_formatter_key = - /*<>*/ caml_call2 - (Stdlib_Domain[11][1], + /*<>*/ Stdlib_Domain[11][1].call + (null, 0, function(param){ var @@ -27139,23 +27124,23 @@ }); /*<>*/ return ppf; /*<>*/ }); - /*<>*/ caml_call2 - (Stdlib_Domain[11][3], err_formatter_key, err_formatter); + /*<>*/ Stdlib_Domain[11][3].call + (null, err_formatter_key, err_formatter); function get_std_formatter(param){ - /*<>*/ return caml_call1 - (Stdlib_Domain[11][2], std_formatter_key) /*<>*/ ; + /*<>*/ return Stdlib_Domain[11][2].call + (null, std_formatter_key) /*<>*/ ; } function get_err_formatter(param){ - /*<>*/ return caml_call1 - (Stdlib_Domain[11][2], err_formatter_key) /*<>*/ ; + /*<>*/ return Stdlib_Domain[11][2].call + (null, err_formatter_key) /*<>*/ ; } function get_str_formatter(param){ - /*<>*/ return caml_call1 - (Stdlib_Domain[11][2], str_formatter_key) /*<>*/ ; + /*<>*/ return Stdlib_Domain[11][2].call + (null, str_formatter_key) /*<>*/ ; } function get_stdbuf(param){ - /*<>*/ return caml_call1 - (Stdlib_Domain[11][2], stdbuf_key) /*<>*/ ; + /*<>*/ return Stdlib_Domain[11][2].call + (null, stdbuf_key) /*<>*/ ; } function flush_buffer_formatter(buf, ppf){ /*<>*/ pp_flush_queue(ppf, 0); @@ -27166,16 +27151,16 @@ function flush_str_formatter(param){ var stdbuf = - /*<>*/ caml_call1(Stdlib_Domain[11][2], stdbuf_key), + /*<>*/ Stdlib_Domain[11][2].call(null, stdbuf_key), str_formatter = - /*<>*/ caml_call1 - (Stdlib_Domain[11][2], str_formatter_key); + /*<>*/ Stdlib_Domain[11][2].call + (null, str_formatter_key); /*<>*/ return flush_buffer_formatter (stdbuf, str_formatter) /*<>*/ ; } function make_synchronized_formatter(output, flush){ - /*<>*/ return caml_call2 - (Stdlib_Domain[11][1], + /*<>*/ return Stdlib_Domain[11][1].call + (null, 0, function(param){ var @@ -27254,70 +27239,70 @@ } function open_hbox(v){ /*<>*/ return /*<>*/ pp_open_hbox - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function open_vbox(v){ /*<>*/ return /*<>*/ pp_open_vbox - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function open_hvbox(v){ /*<>*/ return /*<>*/ pp_open_hvbox - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function open_hovbox(v){ /*<>*/ return /*<>*/ pp_open_hovbox - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function open_box(v){ /*<>*/ return /*<>*/ pp_open_box - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function close_box(v){ /*<>*/ return /*<>*/ pp_close_box - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function open_stag(v){ /*<>*/ return /*<>*/ pp_open_stag - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function close_stag(v){ /*<>*/ return /*<>*/ pp_close_stag - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function print_as(isize, w){ var state = - /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key); + /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key); /*<>*/ return pp_print_as_size(state, isize, w) /*<>*/ ; } function print_string(v){ /*<>*/ return /*<>*/ pp_print_string - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function print_substring(pos, len, v){ var state = - /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key); + /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key); /*<>*/ return pp_print_substring_as (pos, len, state, len, v) /*<>*/ ; } @@ -27325,272 +27310,272 @@ /*<>*/ return /*<>*/ pp_print_substring_as (pos, len, - /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), as_len, v) /*<>*/ ; } function print_bytes(v){ /*<>*/ return /*<>*/ pp_print_bytes - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function print_int(v){ /*<>*/ return /*<>*/ pp_print_int - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function print_float(v){ /*<>*/ return /*<>*/ pp_print_float - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function print_char(v){ /*<>*/ return /*<>*/ pp_print_char - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function print_bool(v){ /*<>*/ return /*<>*/ pp_print_bool - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function print_break(v, w){ /*<>*/ return /*<>*/ pp_print_break - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v, w) /*<>*/ ; } function print_cut(v){ /*<>*/ return /*<>*/ pp_print_cut - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function print_space(v){ /*<>*/ return /*<>*/ pp_print_space - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function force_newline(v){ /*<>*/ return /*<>*/ pp_force_newline - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function print_flush(v){ /*<>*/ return /*<>*/ pp_print_flush - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function print_newline(v){ /*<>*/ return /*<>*/ pp_print_newline - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function print_if_newline(v){ /*<>*/ return /*<>*/ pp_print_if_newline - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function open_tbox(v){ /*<>*/ return /*<>*/ pp_open_tbox - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function close_tbox(v){ /*<>*/ return /*<>*/ pp_close_tbox - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function print_tbreak(v, w){ /*<>*/ return /*<>*/ pp_print_tbreak - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v, w) /*<>*/ ; } function set_tab(v){ /*<>*/ return /*<>*/ pp_set_tab - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function print_tab(v){ /*<>*/ return /*<>*/ pp_print_tab - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function set_margin(v){ /*<>*/ return /*<>*/ pp_set_margin - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function get_margin(v){ var state = - /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key); + /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key); /*<>*/ return state[6]; /*<>*/ } function set_max_indent(v){ /*<>*/ return /*<>*/ pp_set_max_indent - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function get_max_indent(v){ var state = - /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key); + /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key); /*<>*/ return state[8]; /*<>*/ } function set_geometry(max_indent, margin){ /*<>*/ return /*<>*/ pp_set_geometry - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), max_indent, margin) /*<>*/ ; } function safe_set_geometry(max_indent, margin){ /*<>*/ return /*<>*/ pp_safe_set_geometry - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), max_indent, margin) /*<>*/ ; } function get_geometry(v){ /*<>*/ return /*<>*/ pp_get_geometry - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function update_geometry(v){ /*<>*/ return /*<>*/ pp_update_geometry - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function set_max_boxes(v){ /*<>*/ return /*<>*/ pp_set_max_boxes - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function get_max_boxes(v){ var state = - /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key); + /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key); /*<>*/ return state[15]; /*<>*/ } function over_max_boxes(v){ /*<>*/ return /*<>*/ pp_over_max_boxes - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function set_ellipsis_text(v){ /*<>*/ return /*<>*/ pp_set_ellipsis_text - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function get_ellipsis_text(v){ var state = - /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key); + /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key); /*<>*/ return state[16]; /*<>*/ } function set_formatter_out_channel(v){ /*<>*/ return /*<>*/ pp_set_formatter_out_channel - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function set_formatter_out_functions(v){ /*<>*/ return /*<>*/ pp_set_formatter_out_functions - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function get_formatter_out_functions(v){ /*<>*/ return /*<>*/ pp_get_formatter_out_functions - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function set_formatter_output_functions(v, w){ /*<>*/ return /*<>*/ pp_set_formatter_output_functi - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v, w) /*<>*/ ; } function get_formatter_output_functions(v){ /*<>*/ return /*<>*/ pp_get_formatter_output_functi - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function set_formatter_stag_functions(v){ /*<>*/ return /*<>*/ pp_set_formatter_stag_function - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function get_formatter_stag_functions(v){ /*<>*/ return /*<>*/ pp_get_formatter_stag_function - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function set_print_tags(v){ /*<>*/ return /*<>*/ pp_set_print_tags - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function get_print_tags(v){ var state = - /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key); + /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key); /*<>*/ return state[22]; /*<>*/ } function set_mark_tags(v){ /*<>*/ return /*<>*/ pp_set_mark_tags - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function get_mark_tags(v){ var state = - /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key); + /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key); /*<>*/ return state[23]; /*<>*/ } function set_tags(v){ /*<>*/ return /*<>*/ pp_set_tags - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), v) /*<>*/ ; } function pp_print_iter(opt, iter, pp_v, ppf, v){ @@ -27982,8 +27967,8 @@ (null, function(acc){ /*<>*/ return /*<>*/ output_acc - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), acc) /*<>*/ ; }, 0, @@ -27995,8 +27980,8 @@ (null, function(acc){ /*<>*/ return /*<>*/ output_acc - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], err_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, err_formatter_key), acc) /*<>*/ ; }, 0, @@ -28057,12 +28042,12 @@ } function flush_standard_formatters(param){ /*<>*/ /*<>*/ pp_print_flush - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], std_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, std_formatter_key), 0); /*<>*/ return /*<>*/ pp_print_flush - ( /*<>*/ caml_call1 - (Stdlib_Domain[11][2], err_formatter_key), + ( /*<>*/ Stdlib_Domain[11][2].call + (null, err_formatter_key), 0) /*<>*/ ; } /*<>*/ Stdlib[100].call(null, flush_standard_formatters); @@ -28273,7 +28258,7 @@ //# unitInfo: Provides: Stdlib__Scanf //# unitInfo: Requires: CamlinternalFormat, CamlinternalFormatBasics, Stdlib, Stdlib__Buffer, Stdlib__Bytes, Stdlib__Int, Stdlib__Printf, Stdlib__String -//# shape: Stdlib__Scanf:[N,N,F(2),F(2),F(2),F(2),F(1),F(1),F(3),F(3),F(3),F(3),F(2),F(1)] +//# shape: Stdlib__Scanf:[[N,F(1),F(1),F(1),F(1),F(1),F(1)*,F(1)*,F(1)*,F(1),F(1)*,F(1)*],[N,N],F(2),F(2),F(2),F(2),F(1),F(1),F(3),F(3),F(3),F(3),F(2),F(1)] (function (globalThis){ "use strict"; @@ -30461,7 +30446,7 @@ //# unitInfo: Provides: CamlinternalOO //# unitInfo: Requires: Stdlib, Stdlib__Array, Stdlib__List, Stdlib__Map, Stdlib__Obj, Stdlib__Sys -//# shape: CamlinternalOO:[F(1),F(1),F(2),F(3),F(2),F(2),F(2),F(2),F(2),F(3),F(2),F(4),F(1),F(2),N,F(1),F(1),F(6),F(2),F(3),F(1)*,F(1),F(1),F(2),F(2),F(3),F(2),F(2),N,F(1)*] +//# shape: CamlinternalOO:[F(1),F(1),F(2),F(3),F(2),F(2),F(2),F(2),F(2),F(3),F(2),F(4),F(1),F(2),N,F(1),F(1),F(6),F(2)->[N,N,N],F(3),F(1)*->[F(1),F(1),N],F(1),F(1),F(2),F(2),F(3),F(2),F(2),N,F(1)*->[N,N,N]] (function (globalThis){ "use strict"; @@ -30686,7 +30671,7 @@ } /*<>*/ } function to_list(arr){ - /*<>*/ return 0 === arr + /*<>*/ return arr === 0 ? 0 : /*<>*/ Stdlib_Array [10].call @@ -30918,7 +30903,7 @@ return 0; /*<>*/ } function create_table(public_methods){ - /*<>*/ if(0 === public_methods) + /*<>*/ if(public_methods === 0) /*<>*/ return new_table([0]) /*<>*/ ; var tags = @@ -32919,7 +32904,7 @@ //# unitInfo: Provides: Stdlib__Ephemeron //# unitInfo: Requires: CamlinternalLazy, Stdlib, Stdlib__Array, Stdlib__Hashtbl, Stdlib__Int, Stdlib__List, Stdlib__Obj, Stdlib__Random, Stdlib__Seq, Stdlib__Sys -//# shape: Stdlib__Ephemeron:[N,N,N] +//# shape: Stdlib__Ephemeron:[[F(2),F(2),F(1)*->[F(1),N,N,N,N,N,N,N,N,N,N,N,N,N,N,F(1),N,N],F(1)*,[F(1)*,F(3),F(2),F(2),F(1),F(1)]],[F(3),F(3),F(2)*->[F(1),N,N,N,N,N,N,N,N,N,N,N,N,N,N,F(1),N,N],F(2)*,[F(1)*,F(4),F(3),F(3),F(1),F(1)]],[F(2),F(2),F(1)*->[F(1),N,N,N,N,N,N,N,N,N,N,N,N,N,N,F(1),N,N],F(1)*,[F(1)*,F(3),F(2),F(2),F(1),F(1)]]] (function (globalThis){ "use strict"; @@ -32962,7 +32947,7 @@ Stdlib_Random = global_data.Stdlib__Random; function MakeSeeded(H){ var - prng = [246, function(_H_){return caml_call1(Stdlib_Random[19][2], 0);}]; + prng = [246, function(_H_){return Stdlib_Random[19][2].call(null, 0);}]; function create(opt, initial_size){ var random = @@ -32987,8 +32972,10 @@ } var seed = - /*<>*/ /*<>*/ caml_call1 - (Stdlib_Random[19][4], _H_); + /*<>*/ /*<>*/ Stdlib_Random + [19] + [4].call + (null, _H_); } else var seed = /*<>*/ 0; @@ -33460,24 +33447,24 @@ stats_alive]; } function create(param){ - /*<>*/ return caml_call1(Stdlib_Obj[23][1], 1) /*<>*/ ; + /*<>*/ return Stdlib_Obj[23][1].call(null, 1) /*<>*/ ; } function get_key(t){ - var x = /*<>*/ caml_call2(Stdlib_Obj[23][3], t, 0); + var x = /*<>*/ Stdlib_Obj[23][3].call(null, t, 0); /*<>*/ return x; /*<>*/ } function set_key(t, k){ - /*<>*/ return caml_call3(Stdlib_Obj[23][5], t, 0, k) /*<>*/ ; + /*<>*/ return Stdlib_Obj[23][5].call(null, t, 0, k) /*<>*/ ; } function check_key(t){ - /*<>*/ return caml_call2(Stdlib_Obj[23][7], t, 0) /*<>*/ ; + /*<>*/ return Stdlib_Obj[23][7].call(null, t, 0) /*<>*/ ; } function get_data(t){ - var x = /*<>*/ caml_call1(Stdlib_Obj[23][9], t); + var x = /*<>*/ Stdlib_Obj[23][9].call(null, t); /*<>*/ return x; /*<>*/ } function set_data(t, d){ - /*<>*/ return caml_call2(Stdlib_Obj[23][11], t, d) /*<>*/ ; + /*<>*/ return Stdlib_Obj[23][11].call(null, t, d) /*<>*/ ; } function make(key, data){ var eph = /*<>*/ create(0); @@ -33510,7 +33497,7 @@ /*<>*/ return caml_call2(H[1], k, k$0) ? 0 : 1 /*<>*/ ; } function set_key_data(c, k, d){ - /*<>*/ caml_call1(Stdlib_Obj[23][12], c); + /*<>*/ Stdlib_Obj[23][12].call(null, c); /*<>*/ set_key(c, k); /*<>*/ return set_data(c, d) /*<>*/ ; } @@ -33548,11 +33535,11 @@ clean = include[17], stats_alive = include[18]; function create(sz){ - /*<>*/ return caml_call2(_u_, _a_, sz) /*<>*/ ; + /*<>*/ return _u_(_a_, sz) /*<>*/ ; } function of_seq(i){ - var tbl = /*<>*/ caml_call2(_u_, _a_, 16); - /*<>*/ caml_call2(replace_seq, tbl, i); + var tbl = /*<>*/ _u_(_a_, 16); + /*<>*/ replace_seq(tbl, i); /*<>*/ return tbl; /*<>*/ } /*<>*/ return [0, @@ -33629,28 +33616,28 @@ return 0; /*<>*/ } function create$0(param){ - /*<>*/ return caml_call1(Stdlib_Obj[23][1], 2) /*<>*/ ; + /*<>*/ return Stdlib_Obj[23][1].call(null, 2) /*<>*/ ; } function get_key1(t){ - var x = /*<>*/ caml_call2(Stdlib_Obj[23][3], t, 0); + var x = /*<>*/ Stdlib_Obj[23][3].call(null, t, 0); /*<>*/ return x; /*<>*/ } function set_key1(t, k){ - /*<>*/ return caml_call3(Stdlib_Obj[23][5], t, 0, k) /*<>*/ ; + /*<>*/ return Stdlib_Obj[23][5].call(null, t, 0, k) /*<>*/ ; } function get_key2(t){ - var x = /*<>*/ caml_call2(Stdlib_Obj[23][3], t, 1); + var x = /*<>*/ Stdlib_Obj[23][3].call(null, t, 1); /*<>*/ return x; /*<>*/ } function set_key2(t, k){ - /*<>*/ return caml_call3(Stdlib_Obj[23][5], t, 1, k) /*<>*/ ; + /*<>*/ return Stdlib_Obj[23][5].call(null, t, 1, k) /*<>*/ ; } function get_data$0(t){ - var x = /*<>*/ caml_call1(Stdlib_Obj[23][9], t); + var x = /*<>*/ Stdlib_Obj[23][9].call(null, t); /*<>*/ return x; /*<>*/ } function set_data$0(t, d){ - /*<>*/ return caml_call2(Stdlib_Obj[23][11], t, d) /*<>*/ ; + /*<>*/ return Stdlib_Obj[23][11].call(null, t, d) /*<>*/ ; } function make$1(key1, key2, data){ var eph = /*<>*/ create$0(0); @@ -33711,17 +33698,16 @@ /*<>*/ } function set_key_data(c, param, d){ var k2 = /*<>*/ param[2], k1 = param[1]; - /*<>*/ caml_call1(Stdlib_Obj[23][12], c); + /*<>*/ Stdlib_Obj[23][12].call(null, c); /*<>*/ set_key1(c, k1); /*<>*/ set_key2(c, k2); /*<>*/ return set_data$0(c, d) /*<>*/ ; } function check_key(c){ var - _u_ = /*<>*/ caml_call2(Stdlib_Obj[23][7], c, 0); + _u_ = /*<>*/ Stdlib_Obj[23][7].call(null, c, 0); /*<>*/ return _u_ - ? /*<>*/ caml_call2 - (Stdlib_Obj[23][7], c, 1) + ? /*<>*/ Stdlib_Obj[23][7].call(null, c, 1) : _u_ /*<>*/ ; } /*<>*/ return MakeSeeded @@ -33764,11 +33750,11 @@ clean = include[17], stats_alive = include[18]; function create(sz){ - /*<>*/ return caml_call2(_u_, _b_, sz) /*<>*/ ; + /*<>*/ return _u_(_b_, sz) /*<>*/ ; } function of_seq(i){ - var tbl = /*<>*/ caml_call2(_u_, _b_, 16); - /*<>*/ caml_call2(replace_seq, tbl, i); + var tbl = /*<>*/ _u_(_b_, 16); + /*<>*/ replace_seq(tbl, i); /*<>*/ return tbl; /*<>*/ } /*<>*/ return [0, @@ -33849,24 +33835,24 @@ return 0; /*<>*/ } function create$1(n){ - /*<>*/ return caml_call1(Stdlib_Obj[23][1], n) /*<>*/ ; + /*<>*/ return Stdlib_Obj[23][1].call(null, n) /*<>*/ ; } function length$1(k){ - /*<>*/ return caml_call1(Stdlib_Obj[23][2], k) /*<>*/ ; + /*<>*/ return Stdlib_Obj[23][2].call(null, k) /*<>*/ ; } function get_key$0(t, n){ - var x = /*<>*/ caml_call2(Stdlib_Obj[23][3], t, n); + var x = /*<>*/ Stdlib_Obj[23][3].call(null, t, n); /*<>*/ return x; /*<>*/ } function set_key$0(t, n, k){ - /*<>*/ return caml_call3(Stdlib_Obj[23][5], t, n, k) /*<>*/ ; + /*<>*/ return Stdlib_Obj[23][5].call(null, t, n, k) /*<>*/ ; } function get_data$1(t){ - var x = /*<>*/ caml_call1(Stdlib_Obj[23][9], t); + var x = /*<>*/ Stdlib_Obj[23][9].call(null, t); /*<>*/ return x; /*<>*/ } function set_data$1(t, d){ - /*<>*/ return caml_call2(Stdlib_Obj[23][11], t, d) /*<>*/ ; + /*<>*/ return Stdlib_Obj[23][11].call(null, t, d) /*<>*/ ; } function make$3(keys, data){ var @@ -33978,7 +33964,7 @@ } /*<>*/ } function set_key_data(c, k, d){ - /*<>*/ caml_call1(Stdlib_Obj[23][12], c); + /*<>*/ Stdlib_Obj[23][12].call(null, c); var _h_ = /*<>*/ k.length - 2 | 0, _i_ = 0; if(_h_ >= 0){ var i = _i_; @@ -34002,7 +33988,7 @@ var _h_ = _g_; else{ var - _f_ = /*<>*/ caml_call2(Stdlib_Obj[23][7], c, i); + _f_ = /*<>*/ Stdlib_Obj[23][7].call(null, c, i); /*<>*/ if(_f_){ var i$0 = i - 1 | 0; i = i$0; @@ -34047,11 +34033,11 @@ clean = include[17], stats_alive = include[18]; function create(sz){ - /*<>*/ return caml_call2(_f_, _c_, sz) /*<>*/ ; + /*<>*/ return _f_(_c_, sz) /*<>*/ ; } function of_seq(i){ - var tbl = /*<>*/ caml_call2(_f_, _c_, 16); - /*<>*/ caml_call2(replace_seq, tbl, i); + var tbl = /*<>*/ _f_(_c_, 16); + /*<>*/ replace_seq(tbl, i); /*<>*/ return tbl; /*<>*/ } /*<>*/ return [0, @@ -34180,7 +34166,7 @@ //# unitInfo: Provides: Stdlib__Filename //# unitInfo: Requires: Stdlib, Stdlib__Buffer, Stdlib__Domain, Stdlib__List, Stdlib__Printf, Stdlib__Random, Stdlib__String, Stdlib__Sys -//# shape: Stdlib__Filename:[N,N,N,F(2),F(1),F(1),F(2),F(2),F(2),F(1),F(1),F(1),F(1),F(1),N,F(3),F(5),F(4),F(1),F(1),F(1),F(5)] +//# shape: Stdlib__Filename:[N,N,N,F(2),F(1),F(1),F(2),F(2),F(2),F(1),F(1),F(1),F(1),F(1),N,F(3),F(5)->[N,N],F(4),F(1),F(1),F(1),F(5)] (function (globalThis){ "use strict"; @@ -34207,11 +34193,6 @@ caml_trampoline = runtime.caml_trampoline, caml_trampoline_return = runtime.caml_trampoline_return, caml_wrap_exception = runtime.caml_wrap_exception; - function caml_call1(f, a0){ - return (f.l >= 0 ? f.l : f.l = f.length) === 1 - ? f(a0) - : runtime.caml_call_gen(f, [a0]); - } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) @@ -35031,15 +35012,15 @@ } var prng_key = - /*<>*/ caml_call2 - (Stdlib_Domain[11][1], 0, Stdlib_Random[19][2]); + /*<>*/ Stdlib_Domain[11][1].call + (null, 0, Stdlib_Random[19][2]); function temp_file_name(temp_dir, prefix, suffix){ var random_state = - /*<>*/ caml_call1(Stdlib_Domain[11][2], prng_key), + /*<>*/ Stdlib_Domain[11][2].call(null, prng_key), rnd = - /*<>*/ caml_call1 - (Stdlib_Random[19][4], random_state) + /*<>*/ Stdlib_Random[19][4].call + (null, random_state) & 16777215; /*<>*/ return /*<>*/ concat (temp_dir, @@ -35048,27 +35029,29 @@ } var current_temp_dir_name = - /*<>*/ caml_call2 - (Stdlib_Domain[11][1], + /*<>*/ Stdlib_Domain[11][1].call + (null, [0, function(_i_){ /*<>*/ return _i_;}], function(param){ /*<>*/ return temp_dir_name$1; /*<>*/ }); function set_temp_dir_name(s){ - /*<>*/ return caml_call2 - (Stdlib_Domain[11][3], current_temp_dir_name, s) /*<>*/ ; + /*<>*/ return Stdlib_Domain[11][3].call + (null, current_temp_dir_name, s) /*<>*/ ; } function get_temp_dir_name(param){ - /*<>*/ return caml_call1 - (Stdlib_Domain[11][2], current_temp_dir_name) /*<>*/ ; + /*<>*/ return Stdlib_Domain[11][2].call + (null, current_temp_dir_name) /*<>*/ ; } function temp_file(opt, prefix, suffix){ var temp_dir = /*<>*/ opt ? opt[1] - : /*<>*/ caml_call1 - (Stdlib_Domain[11][2], current_temp_dir_name), + : /*<>*/ Stdlib_Domain + [11] + [2].call + (null, current_temp_dir_name), counter = /*<>*/ 0; for(;;){ var @@ -35096,8 +35079,10 @@ temp_dir = opt ? opt[1] - : /*<>*/ caml_call1 - (Stdlib_Domain[11][2], current_temp_dir_name), + : /*<>*/ Stdlib_Domain + [11] + [2].call + (null, current_temp_dir_name), counter = /*<>*/ 0; for(;;){ var @@ -35126,8 +35111,10 @@ temp_dir = /*<>*/ _g_ ? _g_[1] - : /*<>*/ caml_call1 - (Stdlib_Domain[11][2], current_temp_dir_name), + : /*<>*/ Stdlib_Domain + [11] + [2].call + (null, current_temp_dir_name), perms = /*<>*/ opt ? opt[1] : 448, counter = /*<>*/ 0; for(;;){ @@ -35180,7 +35167,7 @@ //# unitInfo: Provides: Stdlib__Complex //# unitInfo: Requires: Stdlib, Stdlib__Float -//# shape: Stdlib__Complex:[N,N,N,F(1)*,F(1)*,F(2)*,F(2)*,F(2)*,F(1)*,F(2)*,F(1)*,F(1)*,F(1)*,F(1)*,F(2)*,F(1)*,F(1)*,F(2)*] +//# shape: Stdlib__Complex:[N,N,N,F(1)*->[N,N],F(1)*->[N,N],F(2)*->[N,N],F(2)*->[N,N],F(2)*->[N,N],F(1)*,F(2)*->[N,N],F(1)*,F(1)*,F(1)*,F(1)*,F(2)*->[N,N],F(1)*->[N,N],F(1)*->[N,N],F(2)*] (function (globalThis){ "use strict"; @@ -35319,7 +35306,7 @@ //# unitInfo: Provides: Stdlib__ArrayLabels //# unitInfo: Requires: Stdlib__Array -//# shape: Stdlib__ArrayLabels:[F(2),F(3),F(3),F(2)*,F(1)*,F(3),F(1)*,F(4),F(5),F(1),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(3),F(2),F(2),F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(1)*->F(1)*,F(1)*->F(1)*,F(1),[]] +//# shape: Stdlib__ArrayLabels:[F(2),F(3),F(3),F(2)*,F(1)*,F(3),F(1)*,F(4),F(5),F(1),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3)->[N,N],F(3),F(3),F(3),F(2),F(2),F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(1)->[N,N],F(2),F(2),F(2),F(2),F(2),F(1)*->F(1)*,F(1)*->F(1)*,F(1),[]] (function (globalThis){ "use strict"; @@ -35420,7 +35407,7 @@ //# unitInfo: Provides: Stdlib__ListLabels //# unitInfo: Requires: Stdlib__List -//# shape: Stdlib__ListLabels:[F(1),F(2),F(2),F(1)*,F(2)*,F(1),F(1),F(2),F(2),F(1),F(2),F(2),F(2),F(1),F(1),F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(3),F(3),F(4),F(4),F(2),F(2),F(3),F(3),F(2),F(2),F(2),F(2),F(1)*->F(1),F(2),F(1)*->F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(3),F(1)*->F(1)*,F(1)] +//# shape: Stdlib__ListLabels:[F(1),F(2),F(2),F(1)*,F(2)*->[N,N],F(1),F(1),F(2),F(2),F(1),F(2),F(2),F(2),F(1),F(1),F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(3)->[N,N],F(3),F(3),F(3),F(3),F(3),F(4),F(4),F(2),F(2),F(3),F(3),F(2),F(2),F(2),F(2),F(1)*->F(1),F(2),F(1)*->F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2)->[N,N],F(2)->[N,N],F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(3),F(1)*->F(1)*,F(1)] (function (globalThis){ "use strict"; @@ -35575,7 +35562,7 @@ //# unitInfo: Provides: Stdlib__BytesLabels //# unitInfo: Requires: Stdlib__Bytes -//# shape: Stdlib__BytesLabels:[F(2),F(2),N,F(1),F(1),F(1),F(3),F(3),F(3),F(4),F(5),F(5),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(2),F(2),F(1),F(1),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(2),F(3),F(3),F(1),F(1),F(1),F(1),F(2)*,F(2)*,F(2),F(2),F(1),F(1)*,F(2),F(1)*->F(1),F(1)*->F(1),F(1),F(2),F(3),F(1),F(2),F(3),F(1),F(2),F(3),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(1)] +//# shape: Stdlib__BytesLabels:[F(2),F(2),N,F(1),F(1),F(1),F(3),F(3),F(3),F(4),F(5),F(5),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(2),F(2),F(1),F(1),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(2),F(3),F(3),F(1),F(1),F(1),F(1),F(2)*,F(2)*,F(2),F(2),F(1),F(1)*,F(2)->[N,N],F(1)*->F(1),F(1)*->F(1),F(1),F(2),F(3),F(1),F(2),F(3),F(1),F(2),F(3),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(1)] (function (globalThis){ "use strict"; @@ -35766,7 +35753,7 @@ //# unitInfo: Provides: Stdlib__StringLabels //# unitInfo: Requires: Stdlib__String -//# shape: Stdlib__StringLabels:[F(2),F(2),N,F(1),F(1),F(5),F(2),F(2)*,F(2)*,F(2)*,F(2),F(2),F(3),F(3),F(2),F(3),F(2),F(2),F(2),F(3),F(3),F(2),F(2),F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(2),F(3),F(3),F(3),F(3),F(2),F(2),F(2),F(2),F(1)*,F(1)*,F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(2)] +//# shape: Stdlib__StringLabels:[F(2),F(2),N,F(1),F(1),F(5),F(2),F(2)*,F(2)*,F(2)*,F(2),F(2),F(3),F(3),F(2),F(3),F(2)->[N,N],F(2),F(2),F(3),F(3),F(2),F(2),F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(2),F(3),F(3),F(3),F(3),F(2),F(2),F(2),F(2),F(1)*,F(1)*,F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(2)] (function (globalThis){ "use strict"; @@ -35912,7 +35899,7 @@ //# unitInfo: Provides: Stdlib__MoreLabels //# unitInfo: Requires: Stdlib__Hashtbl, Stdlib__Map, Stdlib__Set -//# shape: Stdlib__MoreLabels:[[F(2),F(1),F(1),F(1),F(3),F(2),F(2),F(2),F(2),F(2),F(3),F(2),F(2),F(3),F(1)*,F(1),F(1),F(2),F(1),F(1)*->F(1),F(1)*->F(1),F(1)*->F(1),F(2),F(2),F(1),F(1)*,F(1)*,F(1)*,F(2)*,F(3)*,F(4)*],[F(1)*],[F(1)*]] +//# shape: Stdlib__MoreLabels:[[F(2),F(1),F(1),F(1),F(3),F(2),F(2),F(2),F(2),F(2),F(3),F(2),F(2),F(3),F(1)*,F(1),F(1),F(2),F(1)->[N,N,N,N],F(1)*->F(1),F(1)*->F(1),F(1)*->F(1),F(2),F(2),F(1),F(1)*->[F(1),N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,F(1)],F(1)*->[F(2),F(1),F(1),F(1),F(3),F(2),F(2),F(2),F(2),F(3),F(2),F(2),F(2),F(3),F(1)*,F(1)->[N,N,N,N],F(1)*->F(1),F(1)*->F(1),F(1)*->F(1),F(2),F(2),F(1)],F(1)*,F(2)*,F(3)*,F(4)*],[F(1)*->[N,F(3),F(3),F(3),F(2)*->[N,N,N,N,N],F(2),F(3),F(3),F(1),F(1),F(1)->[N,N],F(1),F(1)->[N,N],F(1),F(1)->[N,N],F(1),F(2),F(2),F(2)->[N,N],F(2),F(2)->[N,N],F(2),F(2),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(1)*,F(2),F(3),F(3),F(2),F(2),F(1),F(1),F(1)->F(1),F(1)->F(1),F(2)->F(1),F(2),F(1)]],[F(1)*->[N,F(2),F(1)*->[N,N,N,N],F(2),F(2),F(2),F(2),F(2),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(2),F(2),F(2),F(2),F(2),F(1)*,F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(1),F(2)->F(1),F(1)->F(1),F(1)->F(1),F(2),F(1)]]] (function (globalThis){ "use strict"; @@ -35942,7 +35929,7 @@ //# unitInfo: Provides: Stdlib__Effect //# unitInfo: Requires: Stdlib, Stdlib__Callback, Stdlib__Printexc, Stdlib__Printf //# unitInfo: Effects_without_cps: true -//# shape: Stdlib__Effect:[N,N,[F(2),F(2),F(3),F(3),F(3)],N] +//# shape: Stdlib__Effect:[[N,N],[N,N],[F(2),F(2),F(3),F(3),F(3)],[F(1),F(3),F(3),F(4)]] (function (globalThis){ "use strict"; From f642540b89ea6bf3504dcef9511bd8bbe5303897 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Mon, 16 Jun 2025 12:13:06 +0200 Subject: [PATCH 3/7] fix compat --- compiler/lib/ocaml_compiler.ml | 8 +++++++- compiler/lib/ocaml_compiler.mli | 2 ++ compiler/lib/parse_bytecode.ml | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/compiler/lib/ocaml_compiler.ml b/compiler/lib/ocaml_compiler.ml index 9b396c1e9d..53470ee395 100644 --- a/compiler/lib/ocaml_compiler.ml +++ b/compiler/lib/ocaml_compiler.ml @@ -284,5 +284,11 @@ module Cmo_format = struct let force_link (t : t) = t.cu_force_link - let hints_pos (t : t) = t.cu_hint + let hints_pos (t : t) = t.cu_hint [@@if ocaml_version >= (5, 3, 1)] + + let hints_size (t : t) = t.cu_hintsize [@@if ocaml_version >= (5, 3, 1)] + + let hints_size _ = 0 [@@if ocaml_version < (5, 3, 1)] + + let hints_pos _ = 0 [@@if ocaml_version < (5, 3, 1)] end diff --git a/compiler/lib/ocaml_compiler.mli b/compiler/lib/ocaml_compiler.mli index 4f69e6197e..d0883bbcb9 100644 --- a/compiler/lib/ocaml_compiler.mli +++ b/compiler/lib/ocaml_compiler.mli @@ -75,4 +75,6 @@ module Cmo_format : sig val imports : t -> (string * string option) list val hints_pos : t -> int + + val hints_size : t -> int end diff --git a/compiler/lib/parse_bytecode.ml b/compiler/lib/parse_bytecode.ml index 3ab9042875..5125daa2c9 100644 --- a/compiler/lib/parse_bytecode.ml +++ b/compiler/lib/parse_bytecode.ml @@ -3134,7 +3134,7 @@ let from_cmo ?(includes = []) ?(include_cmis = false) ?(debug = false) compunit Debug.read_event_list debug_data ~crcs:[] ~includes ~orig:0 ic); if times () then Format.eprintf " read debug events: %a@." Timer.print t; let hints = Hints.create () in - if Ocaml_compiler.Cmo_format.hints_pos compunit <> 0 + if Ocaml_compiler.Cmo_format.hints_size compunit > 0 then ( seek_in ic (Ocaml_compiler.Cmo_format.hints_pos compunit); Hints.read hints ~orig:0 ic); @@ -3159,7 +3159,7 @@ let from_cma ?(includes = []) ?(include_cmis = false) ?(debug = false) lib ic = then ( seek_in ic compunit.Cmo_format.cu_debug; Debug.read_event_list debug_data ~crcs:[] ~includes ~orig:!orig ic); - if Ocaml_compiler.Cmo_format.hints_pos compunit <> 0 + if Ocaml_compiler.Cmo_format.hints_size compunit > 0 then ( seek_in ic (Ocaml_compiler.Cmo_format.hints_pos compunit); Hints.read hints ~orig:!orig ic); From 28b7611148615544a675a09f08f3411fc192a26b Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Fri, 25 Oct 2024 22:59:18 +0200 Subject: [PATCH 4/7] Compiler: consume hints for unsafe string/bytes/ba get/set --- compiler/lib-wasm/generate.ml | 10 ++ compiler/lib/parse_bytecode.ml | 33 ++++- compiler/tests-full/stdlib.cma.expected.js | 33 +++-- runtime/js/bigarray.js | 59 +++++++++ runtime/js/mlBytes.js | 87 +++++++++++-- runtime/wasm/bigarray.wat | 72 +++++++++++ runtime/wasm/string.wat | 135 +++++++++++++++++++++ 7 files changed, 398 insertions(+), 31 deletions(-) diff --git a/compiler/lib-wasm/generate.ml b/compiler/lib-wasm/generate.ml index 6bbe9830c6..4079d30467 100644 --- a/compiler/lib-wasm/generate.ml +++ b/compiler/lib-wasm/generate.ml @@ -110,16 +110,26 @@ module Generate (Target : Target_sig.S) = struct ; "caml_nativeint_compare", (`Pure, [ Nativeint; Nativeint ], Value) ; "caml_int64_compare", (`Pure, [ Int64; Int64 ], Value) ; "caml_string_get32", (`Mutator, [ Value; Value ], Int32) + ; "caml_string_get32u", (`Mutator, [ Value; Value ], Int32) ; "caml_string_get64", (`Mutator, [ Value; Value ], Int64) + ; "caml_string_get64u", (`Mutator, [ Value; Value ], Int64) ; "caml_bytes_get32", (`Mutator, [ Value; Value ], Int32) + ; "caml_bytes_get32u", (`Mutator, [ Value; Value ], Int32) ; "caml_bytes_get64", (`Mutator, [ Value; Value ], Int64) + ; "caml_bytes_get64u", (`Mutator, [ Value; Value ], Int64) ; "caml_bytes_set32", (`Mutator, [ Value; Value; Int32 ], Value) + ; "caml_bytes_set32u", (`Mutator, [ Value; Value; Int32 ], Value) ; "caml_bytes_set64", (`Mutator, [ Value; Value; Int64 ], Value) + ; "caml_bytes_set64u", (`Mutator, [ Value; Value; Int64 ], Value) ; "caml_lxm_next", (`Pure, [ Value ], Int64) ; "caml_ba_uint8_get32", (`Mutator, [ Value; Value ], Int32) + ; "caml_ba_uint8_get32u", (`Mutator, [ Value; Value ], Int32) ; "caml_ba_uint8_get64", (`Mutator, [ Value; Value ], Int64) + ; "caml_ba_uint8_get64u", (`Mutator, [ Value; Value ], Int64) ; "caml_ba_uint8_set32", (`Mutator, [ Value; Value; Int32 ], Value) + ; "caml_ba_uint8_set32u", (`Mutator, [ Value; Value; Int32 ], Value) ; "caml_ba_uint8_set64", (`Mutator, [ Value; Value; Int64 ], Value) + ; "caml_ba_uint8_set64u", (`Mutator, [ Value; Value; Int64 ], Value) ; "caml_nextafter_float", (`Pure, [ Float; Float ], Float) ; "caml_classify_float", (`Pure, [ Float ], Value) ; "caml_ldexp_float", (`Pure, [ Float; Value ], Float) diff --git a/compiler/lib/parse_bytecode.ml b/compiler/lib/parse_bytecode.ml index 5125daa2c9..75f53c8102 100644 --- a/compiler/lib/parse_bytecode.ml +++ b/compiler/lib/parse_bytecode.ml @@ -1971,7 +1971,23 @@ and compile infos pc state (instrs : instr list) = let y = State.accu state in let z = State.peek 0 state in let x, state = State.fresh_var state in - + let prim = + match prim with + | "caml_ba_uint8_get16" + | "caml_ba_uint8_get32" + | "caml_ba_uint8_get64" + | "caml_string_get16" + | "caml_string_get32" + | "caml_string_get64" + | "caml_bytes_get16" + | "caml_bytes_get32" + | "caml_bytes_get64" -> + let hints = Hints.find infos.hints pc in + if List.mem ~eq:Hints.equal Hints.Hint_unsafe hints + then prim ^ "u" + else prim + | _ -> prim + in if debug_parser () then Format.printf @@ -1994,7 +2010,20 @@ and compile infos pc state (instrs : instr list) = let z = State.peek 0 state in let t = State.peek 1 state in let x, state = State.fresh_var state in - + let prim = + match prim with + | "caml_ba_uint8_set16" + | "caml_ba_uint8_set32" + | "caml_ba_uint8_set64" + | "caml_bytes_set16" + | "caml_bytes_set32" + | "caml_bytes_set64" -> + let hints = Hints.find infos.hints pc in + if List.mem ~eq:Hints.equal Hints.Hint_unsafe hints + then prim ^ "u" + else prim + | _ -> prim + in if debug_parser () then Format.printf diff --git a/compiler/tests-full/stdlib.cma.expected.js b/compiler/tests-full/stdlib.cma.expected.js index 812bfc2dd3..4062f37a04 100644 --- a/compiler/tests-full/stdlib.cma.expected.js +++ b/compiler/tests-full/stdlib.cma.expected.js @@ -4817,11 +4817,13 @@ caml_bswap16 = runtime.caml_bswap16, caml_bytes_get = runtime.caml_bytes_get, caml_bytes_get16 = runtime.caml_bytes_get16, + caml_bytes_get16u = runtime.caml_bytes_get16u, caml_bytes_get32 = runtime.caml_bytes_get32, caml_bytes_get64 = runtime.caml_bytes_get64, caml_bytes_of_string = runtime.caml_bytes_of_string, caml_bytes_set = runtime.caml_bytes_set, caml_bytes_set16 = runtime.caml_bytes_set16, + caml_bytes_set16u = runtime.caml_bytes_set16u, caml_bytes_set32 = runtime.caml_bytes_set32, caml_bytes_set64 = runtime.caml_bytes_set64, caml_bytes_unsafe_get = runtime.caml_bytes_unsafe_get, @@ -5607,14 +5609,14 @@ function unsafe_get_uint16_le(b, i){ /*<>*/ return Stdlib_Sys[11] ? /*<>*/ caml_bswap16 - ( /*<>*/ caml_bytes_get16(b, i)) - : /*<>*/ caml_bytes_get16(b, i) /*<>*/ ; + ( /*<>*/ caml_bytes_get16u(b, i)) + : /*<>*/ caml_bytes_get16u(b, i) /*<>*/ ; } function unsafe_get_uint16_be(b, i){ /*<>*/ return Stdlib_Sys[11] - ? /*<>*/ caml_bytes_get16(b, i) + ? /*<>*/ caml_bytes_get16u(b, i) : /*<>*/ caml_bswap16 - ( /*<>*/ caml_bytes_get16(b, i)) /*<>*/ ; + ( /*<>*/ caml_bytes_get16u(b, i)) /*<>*/ ; } function get_int8(b, i){ var @@ -5678,17 +5680,17 @@ } function unsafe_set_uint16_le(b, i, x){ /*<>*/ if(Stdlib_Sys[11]){ - /*<>*/ caml_bytes_set16(b, i, caml_bswap16(x)); + /*<>*/ caml_bytes_set16u(b, i, caml_bswap16(x)); /*<>*/ return; } - /*<>*/ caml_bytes_set16(b, i, x); + /*<>*/ caml_bytes_set16u(b, i, x); /*<>*/ } function unsafe_set_uint16_be(b, i, x){ /*<>*/ if(Stdlib_Sys[11]){ - /*<>*/ caml_bytes_set16(b, i, x); + /*<>*/ caml_bytes_set16u(b, i, x); /*<>*/ return; } - /*<>*/ caml_bytes_set16(b, i, caml_bswap16(x)); + /*<>*/ caml_bytes_set16u(b, i, caml_bswap16(x)); /*<>*/ } function set_int16_le(b, i, x){ /*<>*/ return Stdlib_Sys[11] @@ -12456,9 +12458,6 @@ caml_bswap16 = runtime.caml_bswap16, caml_bytes_get = runtime.caml_bytes_get, caml_bytes_set = runtime.caml_bytes_set, - caml_bytes_set16 = runtime.caml_bytes_set16, - caml_bytes_set32 = runtime.caml_bytes_set32, - caml_bytes_set64 = runtime.caml_bytes_set64, caml_bytes_unsafe_set = runtime.caml_bytes_unsafe_set, caml_create_bytes = runtime.caml_create_bytes, caml_int32_bswap = runtime.caml_int32_bswap, @@ -12945,10 +12944,10 @@ new_position = /*<>*/ position + 2 | 0; /*<>*/ if(length < new_position){ /*<>*/ resize(b, 2); - /*<>*/ caml_bytes_set16(b[1][1], b[2], x); + /*<>*/ runtime.caml_bytes_set16(b[1][1], b[2], x); } else - /*<>*/ caml_bytes_set16(buffer, position, x); + /*<>*/ runtime.caml_bytes_set16u(buffer, position, x); /*<>*/ b[2] = new_position; return 0; /*<>*/ } @@ -12961,10 +12960,10 @@ new_position = /*<>*/ position + 4 | 0; /*<>*/ if(length < new_position){ /*<>*/ resize(b, 4); - /*<>*/ caml_bytes_set32(b[1][1], b[2], x); + /*<>*/ runtime.caml_bytes_set32(b[1][1], b[2], x); } else - /*<>*/ caml_bytes_set32(buffer, position, x); + /*<>*/ runtime.caml_bytes_set32u(buffer, position, x); /*<>*/ b[2] = new_position; return 0; /*<>*/ } @@ -12977,10 +12976,10 @@ new_position = /*<>*/ position + 8 | 0; /*<>*/ if(length < new_position){ /*<>*/ resize(b, 8); - /*<>*/ caml_bytes_set64(b[1][1], b[2], x); + /*<>*/ runtime.caml_bytes_set64(b[1][1], b[2], x); } else - /*<>*/ caml_bytes_set64(buffer, position, x); + /*<>*/ runtime.caml_bytes_set64u(buffer, position, x); /*<>*/ b[2] = new_position; return 0; /*<>*/ } diff --git a/runtime/js/bigarray.js b/runtime/js/bigarray.js index 16a479a331..8846261e54 100644 --- a/runtime/js/bigarray.js +++ b/runtime/js/bigarray.js @@ -548,6 +548,14 @@ function caml_ba_get_generic(ba, i) { return ba.get(ofs); } + +//Provides: caml_ba_uint8_get16u +function caml_ba_uint8_get16u(ba, i0) { + var ofs = ba.offset(i0); + var b1 = ba.get(ofs); + var b2 = ba.get(ofs + 1); + return b1 | (b2 << 8); +} //Provides: caml_ba_uint8_get16 //Requires: caml_array_bound_error function caml_ba_uint8_get16(ba, i0) { @@ -558,6 +566,16 @@ function caml_ba_uint8_get16(ba, i0) { return b1 | (b2 << 8); } +//Provides: caml_ba_uint8_get32u +function caml_ba_uint8_get32u(ba, i0) { + var ofs = ba.offset(i0); + var b1 = ba.get(ofs + 0); + var b2 = ba.get(ofs + 1); + var b3 = ba.get(ofs + 2); + var b4 = ba.get(ofs + 3); + return (b1 << 0) | (b2 << 8) | (b3 << 16) | (b4 << 24); +} + //Provides: caml_ba_uint8_get32 //Requires: caml_array_bound_error function caml_ba_uint8_get32(ba, i0) { @@ -570,6 +588,21 @@ function caml_ba_uint8_get32(ba, i0) { return (b1 << 0) | (b2 << 8) | (b3 << 16) | (b4 << 24); } +//Provides: caml_ba_uint8_get64u +//Requires: caml_int64_of_bytes +function caml_ba_uint8_get64u(ba, i0) { + var ofs = ba.offset(i0); + var b1 = ba.get(ofs + 0); + var b2 = ba.get(ofs + 1); + var b3 = ba.get(ofs + 2); + var b4 = ba.get(ofs + 3); + var b5 = ba.get(ofs + 4); + var b6 = ba.get(ofs + 5); + var b7 = ba.get(ofs + 6); + var b8 = ba.get(ofs + 7); + return caml_int64_of_bytes([b8, b7, b6, b5, b4, b3, b2, b1]); +} + //Provides: caml_ba_uint8_get64 //Requires: caml_array_bound_error, caml_int64_of_bytes function caml_ba_uint8_get64(ba, i0) { @@ -608,6 +641,14 @@ function caml_ba_set_generic(ba, i, v) { return 0; } +//Provides: caml_ba_uint8_set16u +function caml_ba_uint8_set16u(ba, i0, v) { + var ofs = ba.offset(i0); + ba.set(ofs + 0, v & 0xff); + ba.set(ofs + 1, (v >>> 8) & 0xff); + return 0; +} + //Provides: caml_ba_uint8_set16 //Requires: caml_array_bound_error function caml_ba_uint8_set16(ba, i0, v) { @@ -618,6 +659,15 @@ function caml_ba_uint8_set16(ba, i0, v) { return 0; } +//Provides: caml_ba_uint8_set32u +function caml_ba_uint8_set32u(ba, i0, v) { + var ofs = ba.offset(i0); + ba.set(ofs + 0, v & 0xff); + ba.set(ofs + 1, (v >>> 8) & 0xff); + ba.set(ofs + 2, (v >>> 16) & 0xff); + ba.set(ofs + 3, (v >>> 24) & 0xff); + return 0; +} //Provides: caml_ba_uint8_set32 //Requires: caml_array_bound_error function caml_ba_uint8_set32(ba, i0, v) { @@ -630,6 +680,15 @@ function caml_ba_uint8_set32(ba, i0, v) { return 0; } +//Provides: caml_ba_uint8_set64u +//Requires: caml_int64_to_bytes +function caml_ba_uint8_set64u(ba, i0, v) { + var ofs = ba.offset(i0); + var v = caml_int64_to_bytes(v); + for (var i = 0; i < 8; i++) ba.set(ofs + i, v[7 - i]); + return 0; +} + //Provides: caml_ba_uint8_set64 //Requires: caml_array_bound_error, caml_int64_to_bytes function caml_ba_uint8_set64(ba, i0, v) { diff --git a/runtime/js/mlBytes.js b/runtime/js/mlBytes.js index 6e724f0ff9..4f12bb8b65 100644 --- a/runtime/js/mlBytes.js +++ b/runtime/js/mlBytes.js @@ -142,29 +142,50 @@ function caml_string_get(s, i) { } //Provides: caml_string_get16 -//Requires: caml_string_unsafe_get, caml_string_bound_error +//Requires: caml_string_bound_error //Requires: caml_ml_string_length +//Requires: caml_string_get16u function caml_string_get16(s, i) { if (i >>> 0 >= caml_ml_string_length(s) - 1) caml_string_bound_error(); + return caml_string_get16u(s,i); +} + +//Provides: caml_string_get16u +//Requires: caml_string_unsafe_get +function caml_string_get16u(s, i) { var b1 = caml_string_unsafe_get(s, i), b2 = caml_string_unsafe_get(s, i + 1); return (b2 << 8) | b1; } //Provides: caml_bytes_get16 -//Requires: caml_bytes_unsafe_get, caml_bytes_bound_error +//Requires: caml_bytes_bound_error +//Requires: caml_bytes_get16u function caml_bytes_get16(s, i) { if (i >>> 0 >= s.l - 1) caml_bytes_bound_error(); + return caml_bytes_get16u(s,i) +} + +//Provides: caml_bytes_get16u +//Requires: caml_bytes_unsafe_get +function caml_bytes_get16u(s, i) { var b1 = caml_bytes_unsafe_get(s, i), b2 = caml_bytes_unsafe_get(s, i + 1); return (b2 << 8) | b1; } //Provides: caml_string_get32 -//Requires: caml_string_unsafe_get, caml_string_bound_error +//Requires: caml_string_bound_error //Requires: caml_ml_string_length +//Requires: caml_string_get32u function caml_string_get32(s, i) { if (i >>> 0 >= caml_ml_string_length(s) - 3) caml_string_bound_error(); + return caml_string_get32u(s,i); +} + +//Provides: caml_string_get32u +//Requires: caml_string_unsafe_get +function caml_string_get32u(s, i) { var b1 = caml_string_unsafe_get(s, i), b2 = caml_string_unsafe_get(s, i + 1), b3 = caml_string_unsafe_get(s, i + 2), @@ -173,9 +194,16 @@ function caml_string_get32(s, i) { } //Provides: caml_bytes_get32 -//Requires: caml_bytes_unsafe_get, caml_bytes_bound_error +//Requires: caml_bytes_bound_error +//Requires: caml_bytes_get32u function caml_bytes_get32(s, i) { if (i >>> 0 >= s.l - 3) caml_bytes_bound_error(); + return caml_bytes_get32u(s,i) +} + +//Provides: caml_bytes_get32u +//Requires: caml_bytes_unsafe_get +function caml_bytes_get32u(s, i) { var b1 = caml_bytes_unsafe_get(s, i), b2 = caml_bytes_unsafe_get(s, i + 1), b3 = caml_bytes_unsafe_get(s, i + 2), @@ -184,11 +212,18 @@ function caml_bytes_get32(s, i) { } //Provides: caml_string_get64 -//Requires: caml_string_unsafe_get, caml_string_bound_error -//Requires: caml_int64_of_bytes +//Requires: caml_string_bound_error //Requires: caml_ml_string_length +//Requires: caml_string_get64u function caml_string_get64(s, i) { if (i >>> 0 >= caml_ml_string_length(s) - 7) caml_string_bound_error(); + return caml_string_get64u(s,i); +} + +//Provides: caml_string_get64u +//Requires: caml_string_unsafe_get +//Requires: caml_int64_of_bytes +function caml_string_get64u(s, i) { var a = new Array(8); for (var j = 0; j < 8; j++) { a[7 - j] = caml_string_unsafe_get(s, i + j); @@ -197,10 +232,17 @@ function caml_string_get64(s, i) { } //Provides: caml_bytes_get64 -//Requires: caml_bytes_unsafe_get, caml_bytes_bound_error -//Requires: caml_int64_of_bytes +//Requires: caml_bytes_bound_error +//Requires: caml_bytes_get64u function caml_bytes_get64(s, i) { if (i >>> 0 >= s.l - 7) caml_bytes_bound_error(); + return caml_bytes_get64u(s,i) +} + +//Provides: caml_bytes_get64u +//Requires: caml_bytes_unsafe_get +//Requires: caml_int64_of_bytes +function caml_bytes_get64u(s, i) { var a = new Array(8); for (var j = 0; j < 8; j++) { a[7 - j] = caml_bytes_unsafe_get(s, i + j); @@ -231,9 +273,16 @@ function caml_string_set(s, i, c) { } //Provides: caml_bytes_set16 -//Requires: caml_bytes_bound_error, caml_bytes_unsafe_set +//Requires: caml_bytes_bound_error +//Requires: caml_bytes_set16u function caml_bytes_set16(s, i, i16) { if (i >>> 0 >= s.l - 1) caml_bytes_bound_error(); + return caml_bytes_set16u(s,i,i16); +} + +//Provides: caml_bytes_set16u +//Requires: caml_bytes_unsafe_set +function caml_bytes_set16u(s, i, i16) { var b2 = 0xff & (i16 >> 8), b1 = 0xff & i16; caml_bytes_unsafe_set(s, i + 0, b1); @@ -242,9 +291,16 @@ function caml_bytes_set16(s, i, i16) { } //Provides: caml_bytes_set32 -//Requires: caml_bytes_bound_error, caml_bytes_unsafe_set +//Requires: caml_bytes_bound_error +//Requires: caml_bytes_set32u function caml_bytes_set32(s, i, i32) { if (i >>> 0 >= s.l - 3) caml_bytes_bound_error(); + return caml_bytes_set32u(s,i,i32); +} + +//Provides: caml_bytes_set32u +//Requires: caml_bytes_unsafe_set +function caml_bytes_set32u(s, i, i32) { var b4 = 0xff & (i32 >> 24), b3 = 0xff & (i32 >> 16), b2 = 0xff & (i32 >> 8), @@ -257,10 +313,17 @@ function caml_bytes_set32(s, i, i32) { } //Provides: caml_bytes_set64 -//Requires: caml_bytes_bound_error, caml_bytes_unsafe_set -//Requires: caml_int64_to_bytes +//Requires: caml_bytes_bound_error +//Requires: caml_bytes_set64u function caml_bytes_set64(s, i, i64) { if (i >>> 0 >= s.l - 7) caml_bytes_bound_error(); + return caml_bytes_set64u(s,i,i64); +} + +//Provides: caml_bytes_set64u +//Requires: caml_bytes_unsafe_set +//Requires: caml_int64_to_bytes +function caml_bytes_set64u(s, i, i64) { var a = caml_int64_to_bytes(i64); for (var j = 0; j < 8; j++) { caml_bytes_unsafe_set(s, i + 7 - j, a[j]); diff --git a/runtime/wasm/bigarray.wat b/runtime/wasm/bigarray.wat index 59cc22cd7f..8b283118d5 100644 --- a/runtime/wasm/bigarray.wat +++ b/runtime/wasm/bigarray.wat @@ -1940,6 +1940,17 @@ (ref.i31 (call $dv_get_ui16 (local.get $view) (local.get $p) (i32.const 1)))) + (func (export "caml_ba_uint8_get16u") + (param $vba (ref eq)) (param $i (ref eq)) (result (ref eq)) + (local $ba (ref $bigarray)) + (local $view (ref extern)) + (local $p i32) + (local.set $ba (ref.cast (ref $bigarray) (local.get $vba))) + (local.set $view (struct.get $bigarray $ba_view (local.get $ba))) + (local.set $p (i31.get_s (ref.cast (ref i31) (local.get $i)))) + (ref.i31 + (call $dv_get_ui16 (local.get $view) (local.get $p) (i32.const 1)))) + (func (export "caml_ba_uint8_get32") (param $vba (ref eq)) (param $i (ref eq)) (result i32) (local $ba (ref $bigarray)) @@ -1957,6 +1968,16 @@ (then (call $caml_bound_error))) (return_call $dv_get_i32 (local.get $view) (local.get $p) (i32.const 1))) + (func (export "caml_ba_uint8_get32u") + (param $vba (ref eq)) (param $i (ref eq)) (result i32) + (local $ba (ref $bigarray)) + (local $view (ref extern)) + (local $p i32) + (local.set $ba (ref.cast (ref $bigarray) (local.get $vba))) + (local.set $view (struct.get $bigarray $ba_view (local.get $ba))) + (local.set $p (i31.get_s (ref.cast (ref i31) (local.get $i)))) + (return_call $dv_get_i32 (local.get $view) (local.get $p) (i32.const 1))) + (func (export "caml_ba_uint8_get64") (param $vba (ref eq)) (param $i (ref eq)) (result i64) (local $ba (ref $bigarray)) @@ -1975,6 +1996,17 @@ (call $dv_get_i64 (local.get $view) (local.get $p) (i32.const 1))) + (func (export "caml_ba_uint8_get64u") + (param $vba (ref eq)) (param $i (ref eq)) (result i64) + (local $ba (ref $bigarray)) + (local $view (ref extern)) + (local $p i32) + (local.set $ba (ref.cast (ref $bigarray) (local.get $vba))) + (local.set $view (struct.get $bigarray $ba_view (local.get $ba))) + (local.set $p (i31.get_s (ref.cast (ref i31) (local.get $i)))) + (call $dv_get_i64 + (local.get $view) (local.get $p) (i32.const 1))) + (func (export "caml_ba_uint8_set16") (param $vba (ref eq)) (param $i (ref eq)) (param $v (ref eq)) (result (ref eq)) @@ -1996,6 +2028,20 @@ (local.get $view) (local.get $p) (local.get $d) (i32.const 1)) (ref.i31 (i32.const 0))) + (func (export "caml_ba_uint8_set16u") + (param $vba (ref eq)) (param $i (ref eq)) (param $v (ref eq)) + (result (ref eq)) + (local $ba (ref $bigarray)) + (local $view (ref extern)) + (local $p i32) (local $d i32) + (local.set $ba (ref.cast (ref $bigarray) (local.get $vba))) + (local.set $view (struct.get $bigarray $ba_view (local.get $ba))) + (local.set $p (i31.get_s (ref.cast (ref i31) (local.get $i)))) + (local.set $d (i31.get_s (ref.cast (ref i31) (local.get $v)))) + (call $dv_set_i16 + (local.get $view) (local.get $p) (local.get $d) (i32.const 1)) + (ref.i31 (i32.const 0))) + (func (export "caml_ba_uint8_set32") (param $vba (ref eq)) (param $i (ref eq)) (param $d i32) (result (ref eq)) @@ -2016,6 +2062,19 @@ (local.get $view) (local.get $p) (local.get $d) (i32.const 1)) (ref.i31 (i32.const 0))) + (func (export "caml_ba_uint8_set32u") + (param $vba (ref eq)) (param $i (ref eq)) (param $d i32) + (result (ref eq)) + (local $ba (ref $bigarray)) + (local $view (ref extern)) + (local $p i32) + (local.set $ba (ref.cast (ref $bigarray) (local.get $vba))) + (local.set $view (struct.get $bigarray $ba_view (local.get $ba))) + (local.set $p (i31.get_s (ref.cast (ref i31) (local.get $i)))) + (call $dv_set_i32 + (local.get $view) (local.get $p) (local.get $d) (i32.const 1)) + (ref.i31 (i32.const 0))) + (func (export "caml_ba_uint8_set64") (param $vba (ref eq)) (param $i (ref eq)) (param $d i64) (result (ref eq)) @@ -2036,6 +2095,19 @@ (local.get $view) (local.get $p) (local.get $d) (i32.const 1)) (ref.i31 (i32.const 0))) + (func (export "caml_ba_uint8_set64u") + (param $vba (ref eq)) (param $i (ref eq)) (param $d i64) + (result (ref eq)) + (local $ba (ref $bigarray)) + (local $view (ref extern)) + (local $p i32) + (local.set $ba (ref.cast (ref $bigarray) (local.get $vba))) + (local.set $view (struct.get $bigarray $ba_view (local.get $ba))) + (local.set $p (i31.get_s (ref.cast (ref i31) (local.get $i)))) + (call $dv_set_i64 + (local.get $view) (local.get $p) (local.get $d) (i32.const 1)) + (ref.i31 (i32.const 0))) + (export "caml_bytes_of_uint8_array" (func $caml_string_of_uint8_array)) (func $caml_string_of_uint8_array (export "caml_string_of_uint8_array") (param (ref eq)) (result (ref eq)) diff --git a/runtime/wasm/string.wat b/runtime/wasm/string.wat index 66183061b4..bc17f734c7 100644 --- a/runtime/wasm/string.wat +++ b/runtime/wasm/string.wat @@ -169,6 +169,18 @@ (i32.add (local.get $p) (i32.const 1))) (i32.const 8))))) + (export "caml_string_get16u" (func $caml_bytes_get16u)) + (func $caml_bytes_get16u (export "caml_bytes_get16u") + (param $v (ref eq)) (param $i (ref eq)) (result (ref eq)) + (local $s (ref $bytes)) (local $p i32) + (local.set $s (ref.cast (ref $bytes) (local.get $v))) + (local.set $p (i31.get_s (ref.cast (ref i31) (local.get $i)))) + (ref.i31 (i32.or + (array.get_u $bytes (local.get $s) (local.get $p)) + (i32.shl (array.get_u $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 1))) + (i32.const 8))))) + (export "caml_string_get32" (func $caml_bytes_get32)) (func $caml_bytes_get32 (export "caml_bytes_get32") (param $v (ref eq)) (param $i (ref eq)) (result i32) @@ -194,6 +206,26 @@ (i32.add (local.get $p) (i32.const 3))) (i32.const 24))))) + (export "caml_string_get32u" (func $caml_bytes_get32u)) + (func $caml_bytes_get32u (export "caml_bytes_get32u") + (param $v (ref eq)) (param $i (ref eq)) (result i32) + (local $s (ref $bytes)) (local $p i32) + (local.set $s (ref.cast (ref $bytes) (local.get $v))) + (local.set $p (i31.get_s (ref.cast (ref i31) (local.get $i)))) + (i32.or + (i32.or + (array.get_u $bytes (local.get $s) (local.get $p)) + (i32.shl (array.get_u $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 1))) + (i32.const 8))) + (i32.or + (i32.shl (array.get_u $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 2))) + (i32.const 16)) + (i32.shl (array.get_u $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 3))) + (i32.const 24))))) + (export "caml_string_get64" (func $caml_bytes_get64)) (func $caml_bytes_get64 (export "caml_bytes_get64") (param $v (ref eq)) (param $i (ref eq)) (result i64) @@ -243,6 +275,50 @@ (i32.add (local.get $p) (i32.const 7)))) (i64.const 56)))))) + (export "caml_string_get64u" (func $caml_bytes_get64u)) + (func $caml_bytes_get64u (export "caml_bytes_get64u") + (param $v (ref eq)) (param $i (ref eq)) (result i64) + (local $s (ref $bytes)) (local $p i32) + (local.set $s (ref.cast (ref $bytes) (local.get $v))) + (local.set $p (i31.get_s (ref.cast (ref i31) (local.get $i)))) + (i64.or + (i64.or + (i64.or + (i64.extend_i32_u + (array.get_u $bytes (local.get $s) (local.get $p))) + (i64.shl (i64.extend_i32_u + (array.get_u $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 1)))) + (i64.const 8))) + (i64.or + (i64.shl (i64.extend_i32_u + (array.get_u $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 2)))) + (i64.const 16)) + (i64.shl (i64.extend_i32_u + (array.get_u $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 3)))) + (i64.const 24)))) + (i64.or + (i64.or + (i64.shl (i64.extend_i32_u + (array.get_u $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 4)))) + (i64.const 32)) + (i64.shl (i64.extend_i32_u + (array.get_u $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 5)))) + (i64.const 40))) + (i64.or + (i64.shl (i64.extend_i32_u + (array.get_u $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 6)))) + (i64.const 48)) + (i64.shl (i64.extend_i32_u + (array.get_u $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 7)))) + (i64.const 56)))))) + (func (export "caml_bytes_set16") (param (ref eq) (ref eq) (ref eq)) (result (ref eq)) (local $s (ref $bytes)) (local $p i32) (local $v i32) @@ -260,6 +336,18 @@ (i32.shr_u (local.get $v) (i32.const 8))) (ref.i31 (i32.const 0))) + (func (export "caml_bytes_set16u") + (param (ref eq) (ref eq) (ref eq)) (result (ref eq)) + (local $s (ref $bytes)) (local $p i32) (local $v i32) + (local.set $s (ref.cast (ref $bytes) (local.get 0))) + (local.set $p (i31.get_s (ref.cast (ref i31) (local.get 1)))) + (local.set $v (i31.get_s (ref.cast (ref i31) (local.get 2)))) + (array.set $bytes (local.get $s) (local.get $p) (local.get $v)) + (array.set $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 1)) + (i32.shr_u (local.get $v) (i32.const 8))) + (ref.i31 (i32.const 0))) + (func (export "caml_bytes_set32") (param (ref eq)) (param (ref eq)) (param $v i32) (result (ref eq)) (local $s (ref $bytes)) (local $p i32) @@ -282,6 +370,23 @@ (i32.shr_u (local.get $v) (i32.const 24))) (ref.i31 (i32.const 0))) + (func (export "caml_bytes_set32u") + (param (ref eq)) (param (ref eq)) (param $v i32) (result (ref eq)) + (local $s (ref $bytes)) (local $p i32) + (local.set $s (ref.cast (ref $bytes) (local.get 0))) + (local.set $p (i31.get_s (ref.cast (ref i31) (local.get 1)))) + (array.set $bytes (local.get $s) (local.get $p) (local.get $v)) + (array.set $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 1)) + (i32.shr_u (local.get $v) (i32.const 8))) + (array.set $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 2)) + (i32.shr_u (local.get $v) (i32.const 16))) + (array.set $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 3)) + (i32.shr_u (local.get $v) (i32.const 24))) + (ref.i31 (i32.const 0))) + (func (export "caml_bytes_set64") (param (ref eq)) (param (ref eq)) (param $v i64) (result (ref eq)) (local $s (ref $bytes)) (local $p i32) @@ -317,6 +422,36 @@ (i32.wrap_i64 (i64.shr_u (local.get $v) (i64.const 56)))) (ref.i31 (i32.const 0))) + (func (export "caml_bytes_set64u") + (param (ref eq)) (param (ref eq)) (param $v i64) (result (ref eq)) + (local $s (ref $bytes)) (local $p i32) + (local.set $s (ref.cast (ref $bytes) (local.get 0))) + (local.set $p (i31.get_s (ref.cast (ref i31) (local.get 1)))) + (array.set $bytes (local.get $s) (local.get $p) + (i32.wrap_i64 (local.get $v))) + (array.set $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 1)) + (i32.wrap_i64 (i64.shr_u (local.get $v) (i64.const 8)))) + (array.set $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 2)) + (i32.wrap_i64 (i64.shr_u (local.get $v) (i64.const 16)))) + (array.set $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 3)) + (i32.wrap_i64 (i64.shr_u (local.get $v) (i64.const 24)))) + (array.set $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 4)) + (i32.wrap_i64 (i64.shr_u (local.get $v) (i64.const 32)))) + (array.set $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 5)) + (i32.wrap_i64 (i64.shr_u (local.get $v) (i64.const 40)))) + (array.set $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 6)) + (i32.wrap_i64 (i64.shr_u (local.get $v) (i64.const 48)))) + (array.set $bytes (local.get $s) + (i32.add (local.get $p) (i32.const 7)) + (i32.wrap_i64 (i64.shr_u (local.get $v) (i64.const 56)))) + (ref.i31 (i32.const 0))) + (func (export "caml_string_concat") (param $vs1 (ref eq)) (param $vs2 (ref eq)) (result (ref eq)) (local $s1 (ref $bytes)) (local $s2 (ref $bytes)) From dbb507fe9227ea2bf06854242eb64211512efcba Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Fri, 25 Oct 2024 23:24:30 +0200 Subject: [PATCH 5/7] Compiler: comsume hints for boxed int comparison --- compiler/lib/parse_bytecode.ml | 31 +++++++++++- compiler/tests-full/stdlib.cma.expected.js | 58 +++++++++------------- 2 files changed, 54 insertions(+), 35 deletions(-) diff --git a/compiler/lib/parse_bytecode.ml b/compiler/lib/parse_bytecode.ml index 75f53c8102..b98691f3b5 100644 --- a/compiler/lib/parse_bytecode.ml +++ b/compiler/lib/parse_bytecode.ml @@ -1999,11 +1999,40 @@ and compile infos pc state (instrs : instr list) = y Var.print z; + let prim, y, z = + match Config.target () with + | `Wasm -> Extern prim, y, z + | `JavaScript -> ( + match prim with + | "caml_equal" + | "caml_notequal" + | "caml_lessthan" + | "caml_greaterthan" + | "caml_lessequal" + | "caml_greaterequal" -> ( + let prim_of_ext = function + | "caml_equal" -> Eq, y, z + | "caml_notequal" -> Neq, y, z + | "caml_lessthan" -> Lt, y, z + | "caml_lessequal" -> Le, y, z + | "caml_greaterequal" -> Le, z, y + | "caml_greaterthan" -> Lt, z, y + | _ -> assert false + in + match Hints.find infos.hints pc with + | [ Hints.Hint_int boxed ] -> ( + match boxed with + | Pnativeint -> prim_of_ext prim + | Pint32 -> prim_of_ext prim + | Pint64 -> Extern prim, y, z) + | _ -> Extern prim, y, z) + | _ -> Extern prim, y, z) + in compile infos (pc + 2) (State.pop 1 state) - (Let (x, Prim (Extern prim, [ Pv y; Pv z ])) :: instrs) + (Let (x, Prim (prim, [ Pv y; Pv z ])) :: instrs) | C_CALL3 -> let prim = primitive_name state (getu code (pc + 1)) in let y = State.accu state in diff --git a/compiler/tests-full/stdlib.cma.expected.js b/compiler/tests-full/stdlib.cma.expected.js index 4062f37a04..15641a971e 100644 --- a/compiler/tests-full/stdlib.cma.expected.js +++ b/compiler/tests-full/stdlib.cma.expected.js @@ -9085,11 +9085,8 @@ "use strict"; var runtime = globalThis.jsoo_runtime, - caml_greaterequal = runtime.caml_greaterequal, caml_hash = runtime.caml_hash, caml_int_compare = runtime.caml_int_compare, - caml_lessequal = runtime.caml_lessequal, - caml_lessthan = runtime.caml_lessthan, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_mul = runtime.caml_mul, caml_wrap_exception = runtime.caml_wrap_exception, @@ -9102,7 +9099,7 @@ function succ(n){ /*<>*/ return n + 1 | 0;} function pred(n){ /*<>*/ return n - 1 | 0;} function abs(n){ - /*<>*/ return caml_greaterequal(n, 0) ? n : - n | 0 /*<>*/ ; + /*<>*/ return 0 <= n ? n : - n | 0 /*<>*/ ; } function lognot(n){ /*<>*/ return n ^ -1;} var @@ -9116,9 +9113,7 @@ max_int$0 = /*<>*/ Stdlib[19], unsigned_to_int = /*<>*/ function(n){ - /*<>*/ if - (caml_greaterequal(n, 0) - && /*<>*/ caml_lessequal(n, max_int$0)) + /*<>*/ if(0 <= n && n <= max_int$0) /*<>*/ return [0, n]; /*<>*/ return 0; /*<>*/ }; @@ -9146,7 +9141,8 @@ /*<>*/ throw caml_maybe_attach_backtrace(exn, 0); } /*<>*/ } - var compare = /*<>*/ caml_int_compare, equal = runtime.caml_equal; + var compare = /*<>*/ caml_int_compare; + function equal(x, y){ /*<>*/ return x === y ? 1 : 0;} function unsigned_compare(n, m){ var y = /*<>*/ m + 2147483648 | 0, @@ -9154,17 +9150,18 @@ /*<>*/ return caml_int_compare(x, y) /*<>*/ ; } function unsigned_lt(n, m){ - /*<>*/ return caml_lessthan - (n + 2147483648 | 0, m + 2147483648 | 0) /*<>*/ ; + /*<>*/ return (n + 2147483648 | 0) < (m + 2147483648 | 0) + ? 1 + : 0; } function min(x, y){ - /*<>*/ return caml_lessequal(x, y) ? x : y /*<>*/ ; + /*<>*/ return x <= y ? x : y /*<>*/ ; } function max(x, y){ - /*<>*/ return caml_greaterequal(x, y) ? x : y /*<>*/ ; + /*<>*/ return y <= x ? x : y /*<>*/ ; } function unsigned_div(n, d){ - /*<>*/ if(caml_lessthan(d, 0)) + /*<>*/ if(d < 0) /*<>*/ return unsigned_lt(n, d) ? zero : one /*<>*/ ; var q = /*<>*/ runtime.caml_div(n >>> 1 | 0, d) << 1, @@ -9370,11 +9367,8 @@ "use strict"; var runtime = globalThis.jsoo_runtime, - caml_greaterequal = runtime.caml_greaterequal, caml_hash = runtime.caml_hash, caml_int_compare = runtime.caml_int_compare, - caml_lessequal = runtime.caml_lessequal, - caml_lessthan = runtime.caml_lessthan, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_mul = runtime.caml_mul, caml_wrap_exception = runtime.caml_wrap_exception, @@ -9386,7 +9380,7 @@ function succ(n){ /*<>*/ return n + 1 | 0;} function pred(n){ /*<>*/ return n - 1 | 0;} function abs(n){ - /*<>*/ return caml_greaterequal(n, 0) ? n : - n | 0 /*<>*/ ; + /*<>*/ return 0 <= n ? n : - n | 0 /*<>*/ ; } var size = /*<>*/ Stdlib_Sys[9], @@ -9395,9 +9389,7 @@ function lognot(n){ /*<>*/ return n ^ -1;} var max_int$0 = /*<>*/ Stdlib[19]; function unsigned_to_int(n){ - /*<>*/ if - (caml_greaterequal(n, 0) - && /*<>*/ caml_lessequal(n, max_int$0)) + /*<>*/ if(0 <= n && n <= max_int$0) /*<>*/ return [0, n]; /*<>*/ return 0; /*<>*/ } @@ -9426,17 +9418,18 @@ /*<>*/ return caml_int_compare(x, y) /*<>*/ ; } function unsigned_lt(n, m){ - /*<>*/ return caml_lessthan - (n - min_int | 0, m - min_int | 0) /*<>*/ ; + /*<>*/ return (n - min_int | 0) < (m - min_int | 0) + ? 1 + : 0; } function min(x, y){ - /*<>*/ return caml_lessequal(x, y) ? x : y /*<>*/ ; + /*<>*/ return x <= y ? x : y /*<>*/ ; } function max(x, y){ - /*<>*/ return caml_greaterequal(x, y) ? x : y /*<>*/ ; + /*<>*/ return y <= x ? x : y /*<>*/ ; } function unsigned_div(n, d){ - /*<>*/ if(caml_lessthan(d, 0)) + /*<>*/ if(d < 0) /*<>*/ return unsigned_lt(n, d) ? zero : one /*<>*/ ; var q = /*<>*/ runtime.caml_div(n >>> 1 | 0, d) << 1, @@ -24016,34 +24009,31 @@ var r = /*<>*/ bits32(s) >>> 1 | 0, v = /*<>*/ caml_mod(r, n); - /*<>*/ if - (! caml_greaterthan(r - v | 0, (Stdlib_Int32[9] - n | 0) + 1 | 0)) + /*<>*/ if + (((Stdlib_Int32[9] - n | 0) + 1 | 0) >= (r - v | 0)) /*<>*/ return v; } /*<>*/ } function int32(s, bound){ - /*<>*/ return caml_lessequal(bound, 0) + /*<>*/ return bound <= 0 ? /*<>*/ Stdlib[1].call(null, cst_Random_int32) : /*<>*/ int32aux(s, bound) /*<>*/ ; } function int32_in_range(s, min, max){ - /*<>*/ if(caml_greaterthan(min, max)) + /*<>*/ if(max < min) /*<>*/ return Stdlib[1].call (null, cst_Random_int32_in_range) /*<>*/ ; var span = /*<>*/ Stdlib_Int32[6].call(null, max - min | 0); - /*<>*/ if(! caml_lessequal(span, Stdlib_Int32[1])) + /*<>*/ if(span > Stdlib_Int32[1]) /*<>*/ return min + int32aux(s, span) | 0 /*<>*/ ; /*<>*/ for(;;){ var r = /*<>*/ /*<>*/ caml_int64_to_int32 ( /*<>*/ caml_lxm_next(s)); - /*<>*/ if - (! - caml_lessthan(r, min) - && ! /*<>*/ caml_greaterthan(r, max)) + /*<>*/ if(r >= min && max >= r) /*<>*/ return r; } /*<>*/ } From 998e27aeca10d4e866838e1ceee9dbc8b8cfedbd Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Mon, 16 Jun 2025 10:31:55 +0200 Subject: [PATCH 6/7] accept --- compiler/tests-compiler/loops.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/tests-compiler/loops.ml b/compiler/tests-compiler/loops.ml index 605276270c..7946d6075b 100644 --- a/compiler/tests-compiler/loops.ml +++ b/compiler/tests-compiler/loops.ml @@ -522,7 +522,7 @@ let add_substitute = previous = 32; i$4 = next_i; } - else if(92 === previous){ + else if(previous === 92){ caml_call2(add_char, b, 92); caml_call2(add_char, b, previous$0); var i$6 = i$4 + 1 | 0; From f790a597e52393ec9837c4b1683911c88e956b42 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Mon, 16 Jun 2025 12:01:40 +0200 Subject: [PATCH 7/7] pin ocaml --- .github/workflows/js_of_ocaml.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/js_of_ocaml.yml b/.github/workflows/js_of_ocaml.yml index d25fd9df6e..af547b1589 100644 --- a/.github/workflows/js_of_ocaml.yml +++ b/.github/workflows/js_of_ocaml.yml @@ -59,7 +59,8 @@ jobs: skip-doc: true - os: ubuntu-latest os-name: Ubuntu - ocaml-compiler: "5.3" + ocaml-name: "5.3.1+pr" + ocaml-compiler: "ocaml-variants.5.3.1+trunk" skip-effects: false skip-test: false skip-doc: false @@ -141,6 +142,10 @@ jobs: with: ocaml-compiler: ${{ matrix.ocaml-compiler }} + - name: patch compiler + if: matrix.ocaml-compiler == 'ocaml-variants.5.3.1+trunk' + run: opam pin ocaml-variants https://github.com/hhugo/ocaml.git#optimization-hints + # Work-around a race between reinstalling mingw-w64-shims # (because of conf-pkg-config optional dep) and installing other # packages that implicitly depend on mingw-w64-shims.