Skip to content

Commit ef2ee75

Browse files
committed
review comments
1 parent 704d9e8 commit ef2ee75

File tree

10 files changed

+22
-16
lines changed

10 files changed

+22
-16
lines changed

middle_end/clambda.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,25 @@ and ulambda =
6464
* uphantom_defining_expr option * ulambda
6565
| Uletrec of (Backend_var.With_provenance.t * ulambda) list * ulambda
6666
| Uprim of Clambda_primitives.primitive * ulambda list * Debuginfo.t
67-
| Uswitch of ulambda * ulambda_switch * Debuginfo.t * Lambda.layout
67+
| Uswitch of ulambda * ulambda_switch * Debuginfo.t * layout
6868
| Ustringswitch of
6969
ulambda *
7070
(string * ulambda) list *
7171
ulambda option *
72-
Lambda.layout
72+
layout
7373
| Ustaticfail of int * ulambda list
7474
| Ucatch of
7575
int *
7676
(Backend_var.With_provenance.t * layout) list *
7777
ulambda *
7878
ulambda *
79-
Lambda.layout
79+
layout
8080
| Utrywith of
8181
ulambda *
8282
Backend_var.With_provenance.t *
8383
ulambda *
84-
Lambda.layout
85-
| Uifthenelse of ulambda * ulambda * ulambda * Lambda.layout
84+
layout
85+
| Uifthenelse of ulambda * ulambda * ulambda * layout
8686
| Usequence of ulambda * ulambda
8787
| Uwhile of ulambda * ulambda
8888
| Ufor of Backend_var.With_provenance.t * ulambda * ulambda

middle_end/flambda/flambda_to_clambda.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ and to_clambda_set_of_closures t env
572572
in
573573
{ label;
574574
arity = clambda_arity function_decl;
575-
params = params @ [VP.create env_var, Lambda.layout_block];
575+
params = params @ [VP.create env_var, Lambda.layout_function];
576576
return = Lambda.layout_top;
577577
body = to_clambda t env_body function_decl.body;
578578
dbg = function_decl.dbg;

middle_end/flambda/inline_and_simplify.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ and simplify_partial_application env r ~lhs_of_application
864864
(List.map (fun p -> Parameter.var p, Parameter.kind p) freshened_params)
865865
in
866866
let free_variables =
867-
Variable.Map.add lhs_of_application Lambda.layout_top free_variables
867+
Variable.Map.add lhs_of_application Lambda.layout_function free_variables
868868
in
869869
Flambda_utils.make_closure_declaration ~id:closure_variable
870870
~is_classic_mode:false

middle_end/flambda2/from_lambda/lambda_to_flambda_primitives.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ let convert_block_shape (shape : L.block_shape) ~num_fields =
110110
"Flambda_arity.of_block_shape: num_fields is %d yet the shape has %d \
111111
fields"
112112
num_fields shape_length;
113-
List.map (fun vk -> K.With_subkind.from_lambda (Pvalue vk)) shape
113+
List.map K.With_subkind.from_lambda_value_kind shape
114114

115115
let check_float_array_optimisation_enabled () =
116116
if not (Flambda_features.flat_float_array ())

middle_end/flambda2/kinds/flambda_kind.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ module With_subkind : sig
196196

197197
val of_naked_number_kind : Naked_number_kind.t -> t
198198

199+
val from_lambda_value_kind : Lambda.value_kind -> t
200+
199201
val from_lambda : Lambda.layout -> t
200202

201203
val compatible : t -> when_used_at:t -> bool

ocaml/lambda/lambda.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,8 @@ let layout_unit = Pvalue Pintval
551551
let layout_int = Pvalue Pintval
552552
let layout_array kind = Pvalue (Parrayval kind)
553553
let layout_block = Pvalue Pgenval
554-
let layout_variant = Pvalue Pgenval
554+
let layout_list =
555+
Pvalue (Pvariant { consts = [0] ; non_consts = [0, [Pgenval; Pgenval]] })
555556
let layout_field = Pvalue Pgenval
556557
let layout_function = Pvalue Pgenval
557558
let layout_object = Pvalue Pgenval

ocaml/lambda/lambda.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ val layout_unit : layout
468468
val layout_int : layout
469469
val layout_array : array_kind -> layout
470470
val layout_block : layout
471-
val layout_variant : layout
471+
val layout_list : layout
472472
val layout_function : layout
473473
val layout_object : layout
474474
val layout_class : layout

ocaml/lambda/matching.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2840,7 +2840,7 @@ let combine_constructor value_kind loc arg pat_env cstr partial ctx def
28402840
(Lprim (Pintcomp Ceq, [ Lvar tag; ext ], loc), act, rem, value_kind))
28412841
nonconsts default
28422842
in
2843-
Llet (Alias, Lambda.layout_field, tag,
2843+
Llet (Alias, Lambda.layout_block, tag,
28442844
Lprim (Pfield (0, Reads_agree), [ arg ], loc),
28452845
tests)
28462846
in
@@ -2938,7 +2938,7 @@ let call_switcher_variant_constr value_kind loc fail arg int_lambda_list =
29382938
let v = Ident.create_local "variant" in
29392939
Llet
29402940
( Alias,
2941-
Lambda.layout_block,
2941+
Lambda.layout_int,
29422942
v,
29432943
Lprim (nonconstant_variant_field 0, [ arg ], loc),
29442944
call_switcher value_kind loc fail (Lvar v) min_int max_int int_lambda_list )

ocaml/lambda/translcomprehension.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,8 @@ let transl_list_comp type_comp body acc_var mats ~transl_exp ~scopes ~loc =
492492
let fn =
493493
lfunction
494494
~kind:(Curried {nlocal=0})
495-
~params:[param, pval; acc_var, Lambda.layout_variant]
496-
~return:Lambda.layout_variant
495+
~params:[param, pval; acc_var, Lambda.layout_list]
496+
~return:Lambda.layout_list
497497
~attr:default_function_attribute
498498
~loc
499499
~body
@@ -535,13 +535,13 @@ let transl_list_comprehension ~transl_exp ~loc ~scopes body blocks =
535535
(body, acc_var, []) block.clauses
536536
in
537537
let body = List.fold_right (fun (id, arr) body ->
538-
Llet(Strict, Lambda.layout_variant, id, arr, body))
538+
Llet(Strict, Lambda.layout_list, id, arr, body))
539539
materialize body
540540
in
541541
body, acc_var)
542542
(bdy, acc_var) blocks
543543
in
544-
Llet(Alias, Lambda.layout_variant, res_var, int 0, (*Empty list.*)
544+
Llet(Alias, Lambda.layout_list, res_var, int 0, (*Empty list.*)
545545
Lapply{
546546
ap_loc=loc;
547547
ap_func=comp_rev ();

ocaml/lambda/translobj.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ let transl_label_init_general f =
9595
let const =
9696
Lprim (Popaque, [Lconst c], Debuginfo.Scoped_location.Loc_unknown)
9797
in
98+
(* CR ncourant: this *should* not be too precise for the moment,
99+
but we should take care, or fix the underlying cause that led
100+
us to using [Popaque]. *)
98101
Llet(Alias, Lambda.structured_constant_layout c, id, const, expr))
99102
consts expr
100103
in

0 commit comments

Comments
 (0)