Skip to content

Commit 4bd12bc

Browse files
committed
WIP
1 parent 2180b00 commit 4bd12bc

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

compiler/lib-wasm/generate.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,10 @@ end
11681168

11691169
let init () =
11701170
let l =
1171-
[ "caml_ensure_stack_capacity", "%identity"; "caml_callback", "caml_trampoline"; "caml_array_of_uniform_array", "caml_make_array" ]
1171+
[ "caml_ensure_stack_capacity", "%identity"
1172+
; "caml_callback", "caml_trampoline"
1173+
; "caml_array_of_uniform_array", "caml_make_array"
1174+
]
11721175
in
11731176
Primitive.register "caml_make_array" `Mutable None None;
11741177
let l =

ppx/ppx_js/tests/dune

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
(rule
88
(targets ppx.mlt.corrected)
99
(enabled_if
10-
(>= %{ocaml_version} 5.2))
10+
(and
11+
(>= %{ocaml_version} 5.2)
12+
(< %{ocaml_version} 5.3)))
1113
(action
1214
(run %{exe:main.bc} %{dep:ppx.mlt})))
1315

runtime/wasm/array.wat

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,21 @@
146146
(local.get $len))
147147
(local.get $fa2))
148148

149+
(func (export "caml_floatarray_sub")
150+
(param $a (ref eq)) (param $i (ref eq)) (param $vlen (ref eq))
151+
(result (ref eq))
152+
(local $len i32)
153+
(local $fa1 (ref $float_array)) (local $fa2 (ref $float_array))
154+
(local.set $len (i31.get_u (ref.cast (ref i31) (local.get $vlen))))
155+
(if (i32.eqz (local.get $len)) (then (return (global.get $empty_array))))
156+
(local.set $fa1 (ref.cast (ref $float_array) (local.get $a)))
157+
(local.set $fa2 (array.new $float_array (f64.const 0) (local.get $len)))
158+
(array.copy $float_array $float_array
159+
(local.get $fa2) (i32.const 0) (local.get $fa1)
160+
(i31.get_u (ref.cast (ref i31) (local.get $i)))
161+
(local.get $len))
162+
(local.get $fa2))
163+
149164
(func $caml_floatarray_dup (param $a (ref $float_array)) (result (ref eq))
150165
(local $a' (ref $float_array))
151166
(local $len i32)

0 commit comments

Comments
 (0)