Skip to content

Commit 9c3571a

Browse files
committed
Fix storing unboxed_vec128 in closures
1 parent 4ef38bf commit 9c3571a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

middle_end/clambda_layout.ml

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type atom =
1717
| Value_int
1818
| Unboxed_float
1919
| Unboxed_int of Lambda.boxed_integer
20+
| Unboxed_vector of Lambda.boxed_vector
2021

2122
let rec fold_left_layout (f : 'acc -> 'e -> atom -> 'acc) (acc : 'acc)
2223
(expr : Clambda.ulambda) (layout : Clambda_primitives.layout) : 'acc =
@@ -28,6 +29,7 @@ let rec fold_left_layout (f : 'acc -> 'e -> atom -> 'acc) (acc : 'acc)
2829
closure."
2930
| Punboxed_float -> f acc expr Unboxed_float
3031
| Punboxed_int bi -> f acc expr (Unboxed_int bi)
32+
| Punboxed_vector bv -> f acc expr (Unboxed_vector bv)
3133
| Pvalue Pintval -> f acc expr Value_int
3234
| Pvalue _ -> f acc expr Value
3335
| Punboxed_product layouts ->
@@ -59,6 +61,7 @@ let print_atom ppf = function
5961
| Unboxed_int Pint32 -> Format.fprintf ppf "unboxed_int32"
6062
| Unboxed_int Pint64 -> Format.fprintf ppf "unboxed_int64"
6163
| Unboxed_int Pnativeint -> Format.fprintf ppf "unboxed_nativeint"
64+
| Unboxed_vector Pvec128 -> Format.fprintf ppf "unboxed_vec128"
6265

6366
let equal_decomposition = ( = )
6467

@@ -80,6 +83,7 @@ let rec decompose (layout : Lambda.layout) : _ decomposition' =
8083
closure."
8184
| Punboxed_float -> Gc_invisible ((), Unboxed_float)
8285
| Punboxed_int bi -> Gc_invisible ((), Unboxed_int bi)
86+
| Punboxed_vector bv -> Gc_invisible ((), Unboxed_vector bv)
8387
| Pvalue Pintval -> Gc_invisible ((), Value_int)
8488
| Pvalue _ -> Gc_visible ((), Value)
8589
| Punboxed_product l -> Product (Array.of_list (List.map decompose l))
@@ -105,7 +109,9 @@ let rec fold_decompose (f1 : 'acc -> 'a -> atom -> 'acc * 'b)
105109
acc, Product elts
106110

107111
let atom_size (layout : atom) =
108-
match layout with Value | Value_int | Unboxed_float | Unboxed_int _ -> 1
112+
match layout with
113+
| Value | Value_int | Unboxed_float | Unboxed_int _ -> 1
114+
| Unboxed_vector Pvec128 -> 2
109115

110116
let assign_invisible_offsets init_pos (var, dec) =
111117
let f_visible acc () _layout = acc, () in

middle_end/flambda2/simplify_shared/slot_offsets.ml

+5-3
Original file line numberDiff line numberDiff line change
@@ -873,10 +873,12 @@ end = struct
873873
| Region | Rec_info ->
874874
Misc.fatal_errorf "Value slot %a has Region or Rec_info kind"
875875
Value_slot.print value_slot
876-
| Naked_number _ ->
876+
| Naked_number (Naked_immediate | Naked_float | Naked_int32 | Naked_int64 | Naked_nativeint) ->
877877
1, true
878-
(* flambda only supports 64-bits for now, so naked numbers can only
879-
be of size 1 *)
878+
(* flambda only supports 64-bits for now, so naked numbers can only
879+
be of size 1 *)
880+
| Naked_number Naked_vec128 ->
881+
2, true
880882
| Value -> (
881883
match[@ocaml.warning "-4"]
882884
Flambda_kind.With_subkind.subkind kind

0 commit comments

Comments
 (0)