Skip to content

Commit 2e666cf

Browse files
authored
Merge pull request #1143 from riaqn/merge-ocaml-jst
Merge ocaml-jst
2 parents 597ea00 + 443ec5a commit 2e666cf

File tree

179 files changed

+32472
-10318
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+32472
-10318
lines changed

backend/cmm_helpers.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2951,8 +2951,8 @@ type assignment_kind =
29512951
let assignment_kind (ptr : Lambda.immediate_or_pointer)
29522952
(init : Lambda.initialization_or_assignment) =
29532953
match init, ptr with
2954-
| Assignment Alloc_heap, Pointer -> Caml_modify
2955-
| Assignment Alloc_local, Pointer ->
2954+
| Assignment Modify_heap, Pointer -> Caml_modify
2955+
| Assignment Modify_maybe_stack, Pointer ->
29562956
assert Config.stack_allocation;
29572957
Caml_modify_local
29582958
| Heap_initialization, _ -> Caml_initialize

dune

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,6 @@
790790
(trap_stack.mli as compiler-libs/trap_stack.mli)
791791
(cfg_equivalence.mli as compiler-libs/cfg_equivalence.mli)
792792
(ocaml/extensions.mli as compiler-libs/extensions.mli)
793-
(ocaml/translcomprehension.mli as compiler-libs/translcomprehension.mli)
794793
(.ocamloptcomp.objs/byte/linear_format.cmi
795794
as
796795
compiler-libs/linear_format.cmi)

middle_end/flambda2/from_lambda/lambda_to_flambda_primitives.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ let convert_init_or_assign (i_or_a : L.initialization_or_assignment)
9494
~current_region : P.Init_or_assign.t =
9595
match i_or_a with
9696
| Assignment mode ->
97-
Assignment (Alloc_mode.For_allocations.from_lambda mode ~current_region)
97+
Assignment
98+
(Alloc_mode.For_allocations.from_lambda_modify mode ~current_region)
9899
| Heap_initialization -> Initialization
99100
| Root_initialization ->
100101
Misc.fatal_error "[Root_initialization] should not appear in Flambda input"

middle_end/flambda2/term_basics/alloc_mode.ml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ module For_allocations = struct
9898
assert (Flambda_features.stack_allocation_enabled ());
9999
Lambda.alloc_local
100100

101+
let from_lambda_modify (mode : Lambda.modify_mode) ~current_region =
102+
if not (Flambda_features.stack_allocation_enabled ())
103+
then Heap
104+
else
105+
match mode with
106+
| Modify_heap -> Heap
107+
| Modify_maybe_stack -> Local { region = current_region }
108+
109+
let to_lambda_modify t =
110+
match t with
111+
| Heap -> Lambda.modify_heap
112+
| Local _ ->
113+
assert (Flambda_features.stack_allocation_enabled ());
114+
Lambda.modify_maybe_stack
115+
101116
let free_names t =
102117
match t with
103118
| Heap -> Name_occurrences.empty

middle_end/flambda2/term_basics/alloc_mode.mli

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ module For_allocations : sig
6161

6262
val to_lambda : t -> Lambda.alloc_mode
6363

64+
val from_lambda_modify : Lambda.modify_mode -> current_region:Variable.t -> t
65+
66+
val to_lambda_modify : t -> Lambda.modify_mode
67+
6468
include Contains_names.S with type t := t
6569

6670
include Contains_ids.S with type t := t

middle_end/flambda2/terms/flambda_primitive.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ module Init_or_assign = struct
243243
let to_lambda t : Lambda.initialization_or_assignment =
244244
match t with
245245
| Initialization -> Heap_initialization
246-
| Assignment mode -> Assignment (Alloc_mode.For_allocations.to_lambda mode)
246+
| Assignment mode ->
247+
Assignment (Alloc_mode.For_allocations.to_lambda_modify mode)
247248

248249
let free_names t =
249250
match t with

middle_end/printclambda_primitives.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ let primitive ppf (prim:Clambda_primitives.primitive) =
8484
match init with
8585
| Heap_initialization -> "(heap-init)"
8686
| Root_initialization -> "(root-init)"
87-
| Assignment Alloc_heap -> ""
88-
| Assignment Alloc_local -> "(local)"
87+
| Assignment Modify_heap -> ""
88+
| Assignment Modify_maybe_stack -> "(maybe-stack)"
8989
in
9090
fprintf ppf "setfield_%s%s %i" instr init n
9191
| Psetfield_computed (ptr, init) ->
@@ -98,8 +98,8 @@ let primitive ppf (prim:Clambda_primitives.primitive) =
9898
match init with
9999
| Heap_initialization -> "(heap-init)"
100100
| Root_initialization -> "(root-init)"
101-
| Assignment Alloc_heap -> ""
102-
| Assignment Alloc_local -> "(local)"
101+
| Assignment Modify_heap -> ""
102+
| Assignment Modify_maybe_stack -> "(maybe-stack)"
103103
in
104104
fprintf ppf "setfield_%s%s_computed" instr init
105105
| Pfloatfield (n, Alloc_heap) -> fprintf ppf "floatfield %i" n
@@ -109,8 +109,8 @@ let primitive ppf (prim:Clambda_primitives.primitive) =
109109
match init with
110110
| Heap_initialization -> "(heap-init)"
111111
| Root_initialization -> "(root-init)"
112-
| Assignment Alloc_heap -> ""
113-
| Assignment Alloc_local -> "(local)"
112+
| Assignment Modify_heap -> ""
113+
| Assignment Modify_maybe_stack -> "(maybe-stack)"
114114
in
115115
fprintf ppf "setfloatfield%s %i" init n
116116
| Pduprecord (rep, size) ->

native_toplevel/opttoploop.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,9 @@ let name_expression ~loc ~attrs exp =
378378
in
379379
let sg = [Sig_value(id, vd, Exported)] in
380380
let pat =
381-
{ pat_desc = Tpat_var(id, mknoloc name);
381+
{ pat_desc = Tpat_var(id, mknoloc name, Types.Value_mode.global);
382382
pat_loc = loc;
383383
pat_extra = [];
384-
pat_mode = Types.Value_mode.global;
385384
pat_type = exp.exp_type;
386385
pat_env = exp.exp_env;
387386
pat_attributes = []; }

0 commit comments

Comments
 (0)