Skip to content

Commit 625f62d

Browse files
committed
OxCaml: arrays of unboxed numbers
1 parent 7effd00 commit 625f62d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

compiler/lib/specialize_js.ml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,12 @@ let setters =
323323
; "caml_ba_uint8_setf32"
324324
]
325325

326+
let make_vect x y constant acc =
327+
let c = Var.fresh () in
328+
Let (x, Prim (Extern "caml_make_vect", [ y; Pv c ]))
329+
:: Let (c, Constant constant)
330+
:: acc
331+
326332
let specialize_instrs ~target opt_count info l =
327333
let rec aux info checks l acc =
328334
match l with
@@ -449,6 +455,14 @@ let specialize_instrs ~target opt_count info l =
449455
let acc = instr y' :: Let (y', Prim (Extern check, [ Pv y; z ])) :: acc in
450456
incr opt_count;
451457
aux info ((y, idx) :: checks) r acc
458+
| Let (x, Prim (Extern "caml_make_unboxed_int32_vect_bytecode", [ y ])) ->
459+
aux info checks r (make_vect x y (Int32 0l) acc)
460+
| Let (x, Prim (Extern "caml_make_unboxed_int64_vect_bytecode", [ y ])) ->
461+
aux info checks r (make_vect x y (Int64 0L) acc)
462+
| Let (x, Prim (Extern "caml_make_unboxed_nativeint_vect_bytecode", [ y ])) ->
463+
aux info checks r (make_vect x y (NativeInt 0l) acc)
464+
| Let (x, Prim (Extern "caml_make_unboxed_float32_vect_bytecode", [ y ])) ->
465+
aux info checks r (make_vect x y (Float32 0L) acc)
452466
| _ ->
453467
let i = specialize_instr ~target opt_count info i in
454468
aux info checks r (i :: acc))

0 commit comments

Comments
 (0)