Skip to content

Commit 8425ed1

Browse files
committed
Use caml_array_of_uniform_array rather than old name caml_make_array internally
1 parent eb0377d commit 8425ed1

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

compiler/lib-wasm/generate.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,10 +1171,10 @@ let init () =
11711171
[ "caml_ensure_stack_capacity", "%identity"
11721172
; "caml_process_pending_actions_with_root", "%identity"
11731173
; "caml_callback", "caml_trampoline"
1174-
; "caml_array_of_uniform_array", "caml_make_array"
1174+
; "caml_make_array", "caml_array_of_uniform_array"
11751175
]
11761176
in
1177-
Primitive.register "caml_make_array" `Mutable None None;
1177+
Primitive.register "caml_array_of_uniform_array" `Mutable None None;
11781178
let l =
11791179
if Config.Flag.effects ()
11801180
then ("caml_alloc_stack", "caml_cps_alloc_stack") :: l

compiler/lib/flow.ml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ let rec block_escape st x =
198198
| Immutable -> ()
199199
| Maybe_mutable -> Code.Var.ISet.add st.possibly_mutable y);
200200
Array.iter l ~f:(fun z -> block_escape st z)
201-
| Expr (Prim (Extern "caml_make_array", [ Pv y ])) -> block_escape st y
201+
| Expr (Prim (Extern "caml_array_of_uniform_array", [ Pv y ])) ->
202+
block_escape st y
202203
| _ -> Code.Var.ISet.add st.possibly_mutable y))
203204
(Var.Tbl.get st.known_origins x)
204205

@@ -208,7 +209,7 @@ let expr_escape st _x e =
208209
| Apply { args; _ } -> List.iter args ~f:(fun x -> block_escape st x)
209210
| Prim (Array_get, [ Pv x; _ ]) -> block_escape st x
210211
| Prim ((Vectlength | Array_get | Not | IsInt | Eq | Neq | Lt | Le | Ult), _) -> ()
211-
| Prim (Extern "caml_make_array", [ Pv _ ]) -> ()
212+
| Prim (Extern "caml_array_of_uniform_array", [ Pv _ ]) -> ()
212213
| Prim (Extern name, l) ->
213214
let ka =
214215
match Primitive.kind_args name with
@@ -233,7 +234,7 @@ let expr_escape st _x e =
233234
| Expr (Constant (Tuple _)) -> ()
234235
| Expr (Block (_, a, _, _)) ->
235236
Array.iter a ~f:(fun x -> block_escape st x)
236-
| Expr (Prim (Extern "caml_make_array", [ Pv y ])) -> (
237+
| Expr (Prim (Extern "caml_array_of_uniform_array", [ Pv y ])) -> (
237238
match st.defs.(Var.idx y) with
238239
| Expr (Block (_, a, _, _)) ->
239240
Array.iter a ~f:(fun x -> block_escape st x)
@@ -416,7 +417,7 @@ let the_native_string_of ~target info x =
416417
let the_block_contents_of info x =
417418
match the_def_of info x with
418419
| Some (Block (_, a, _, _)) -> Some a
419-
| Some (Prim (Extern "caml_make_array", [ x ])) -> (
420+
| Some (Prim (Extern "caml_array_of_uniform_array", [ x ])) -> (
420421
match the_def_of info x with
421422
| Some (Block (_, a, _, _)) -> Some a
422423
| _ -> None)

runtime/wasm/array.wat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@
8080
(if (i32.eqz (local.get $sz)) (then (return (global.get $empty_array))))
8181
(array.new $float_array (f64.const 0) (local.get $sz)))
8282

83-
(func (export "caml_make_array") (param $vinit (ref eq)) (result (ref eq))
83+
(func (export "caml_array_of_uniform_array")
84+
(param $vinit (ref eq)) (result (ref eq))
8485
(local $init (ref $block)) (local $res (ref $float_array))
8586
(local $size i32) (local $i i32)
8687
(local.set $init (ref.cast (ref $block) (local.get $vinit)))

0 commit comments

Comments
 (0)