From e9c60d449a6f0eb2bfaf6d39a7ec99bfbcd9ae51 Mon Sep 17 00:00:00 2001 From: Luke Maurer Date: Fri, 25 Jun 2021 11:17:12 +0100 Subject: [PATCH] Reimplement depth variables as variables (#472) Depth variables will now work exactly like variables in most respects. Like a normal variable, a depth variable has a type with an Flambda kind, only the kind must be the new kind `Rec_info` established in #465. --- .depend | 76 +++------------ compilerlibs/Makefile.compilerlibs | 2 - .../flambda/compilenv_deps/depth_variable.ml | 94 ------------------- .../flambda/compilenv_deps/depth_variable.mli | 39 -------- .../flambda/from_lambda/closure_conversion.ml | 2 +- .../flambda/naming/bindable_depth_variable.ml | 39 -------- .../naming/bindable_depth_variable.mli | 27 ------ .../flambda/naming/bindable_let_bound.ml | 48 ++-------- .../flambda/naming/bindable_let_bound.mli | 6 -- middle_end/flambda/naming/name_occurrences.ml | 66 ++----------- .../flambda/naming/name_occurrences.mli | 6 -- middle_end/flambda/naming/renaming.ml | 28 +----- middle_end/flambda/naming/renaming.mli | 11 --- middle_end/flambda/parser/fexpr_to_flambda.ml | 21 +---- middle_end/flambda/parser/flambda_to_fexpr.ml | 2 - middle_end/flambda/simplify/expr_builder.ml | 11 +-- middle_end/flambda/simplify/rebuilt_expr.mli | 2 +- .../flambda/simplify/rebuilt_static_const.ml | 2 +- .../flambda/simplify/simplify_apply_expr.ml | 2 +- .../flambda/simplify/simplify_let_expr.ml | 3 +- middle_end/flambda/terms/flambda.mli | 6 +- middle_end/flambda/terms/flambda_unit.ml | 2 +- .../terms/function_params_and_body.rec.ml | 7 +- .../terms/function_params_and_body.rec.mli | 6 +- middle_end/flambda/terms/let_expr.rec.ml | 26 +++-- middle_end/flambda/terms/rec_info_expr.ml | 17 ++-- middle_end/flambda/terms/rec_info_expr.mli | 5 +- middle_end/flambda/to_cmm/un_cps.ml | 8 +- 28 files changed, 83 insertions(+), 481 deletions(-) delete mode 100644 middle_end/flambda/compilenv_deps/depth_variable.ml delete mode 100644 middle_end/flambda/compilenv_deps/depth_variable.mli delete mode 100644 middle_end/flambda/naming/bindable_depth_variable.ml delete mode 100644 middle_end/flambda/naming/bindable_depth_variable.mli diff --git a/.depend b/.depend index 7ec2890bc523..b50698ea4b2a 100644 --- a/.depend +++ b/.depend @@ -3887,22 +3887,6 @@ middle_end/flambda/compilenv_deps/compilation_unit.cmi : \ middle_end/flambda/compilenv_deps/linkage_name.cmi \ utils/identifiable.cmi \ typing/ident.cmi -middle_end/flambda/compilenv_deps/depth_variable.cmo : \ - utils/misc.cmi \ - utils/identifiable.cmi \ - middle_end/flambda/compilenv_deps/flambda_colours.cmi \ - middle_end/flambda/compilenv_deps/compilation_unit.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi -middle_end/flambda/compilenv_deps/depth_variable.cmx : \ - utils/misc.cmx \ - utils/identifiable.cmx \ - middle_end/flambda/compilenv_deps/flambda_colours.cmx \ - middle_end/flambda/compilenv_deps/compilation_unit.cmx \ - middle_end/flambda/compilenv_deps/depth_variable.cmi -middle_end/flambda/compilenv_deps/depth_variable.cmi : \ - utils/printing_cache.cmi \ - utils/identifiable.cmi \ - middle_end/flambda/compilenv_deps/compilation_unit.cmi middle_end/flambda/compilenv_deps/flambda_colours.cmo : \ utils/misc.cmi \ middle_end/flambda/compilenv_deps/flambda_colours.cmi @@ -4826,6 +4810,7 @@ middle_end/flambda/from_lambda/closure_conversion.cmo : \ utils/numbers.cmi \ middle_end/flambda/naming/name_occurrences.cmi \ middle_end/flambda/naming/name_mode.cmi \ + middle_end/flambda/basic/name.cmi \ utils/misc.cmi \ middle_end/flambda/compilenv_deps/linkage_name.cmi \ middle_end/flambda/from_lambda/lambda_to_flambda_primitives_helpers.cmi \ @@ -4847,7 +4832,6 @@ middle_end/flambda/from_lambda/closure_conversion.cmo : \ middle_end/flambda/flambda_backend_intf.cmi \ middle_end/flambda/terms/flambda.cmi \ middle_end/flambda/basic/exn_continuation.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ lambda/debuginfo.cmi \ middle_end/flambda/basic/continuation.cmi \ utils/config.cmi \ @@ -4880,6 +4864,7 @@ middle_end/flambda/from_lambda/closure_conversion.cmx : \ utils/numbers.cmx \ middle_end/flambda/naming/name_occurrences.cmx \ middle_end/flambda/naming/name_mode.cmx \ + middle_end/flambda/basic/name.cmx \ utils/misc.cmx \ middle_end/flambda/compilenv_deps/linkage_name.cmx \ middle_end/flambda/from_lambda/lambda_to_flambda_primitives_helpers.cmx \ @@ -4901,7 +4886,6 @@ middle_end/flambda/from_lambda/closure_conversion.cmx : \ middle_end/flambda/flambda_backend_intf.cmi \ middle_end/flambda/terms/flambda.cmx \ middle_end/flambda/basic/exn_continuation.cmx \ - middle_end/flambda/compilenv_deps/depth_variable.cmx \ lambda/debuginfo.cmx \ middle_end/flambda/basic/continuation.cmx \ utils/config.cmx \ @@ -5508,21 +5492,6 @@ middle_end/flambda/naming/bindable_continuation.cmx : \ middle_end/flambda/naming/bindable_continuation.cmi : \ middle_end/flambda/basic/continuation.cmi \ middle_end/flambda/naming/bindable.cmo -middle_end/flambda/naming/bindable_depth_variable.cmo : \ - middle_end/flambda/naming/renaming.cmi \ - middle_end/flambda/naming/name_occurrences.cmi \ - middle_end/flambda/cmx/ids_for_export.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ - middle_end/flambda/naming/bindable_depth_variable.cmi -middle_end/flambda/naming/bindable_depth_variable.cmx : \ - middle_end/flambda/naming/renaming.cmx \ - middle_end/flambda/naming/name_occurrences.cmx \ - middle_end/flambda/cmx/ids_for_export.cmx \ - middle_end/flambda/compilenv_deps/depth_variable.cmx \ - middle_end/flambda/naming/bindable_depth_variable.cmi -middle_end/flambda/naming/bindable_depth_variable.cmi : \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ - middle_end/flambda/naming/bindable.cmo middle_end/flambda/naming/bindable_exn_continuation.cmo : \ middle_end/flambda/naming/renaming.cmi \ middle_end/flambda/naming/name_occurrences.cmi \ @@ -5548,9 +5517,7 @@ middle_end/flambda/naming/bindable_let_bound.cmo : \ utils/misc.cmi \ middle_end/flambda/cmx/ids_for_export.cmi \ utils/identifiable.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ middle_end/flambda/terms/bound_symbols.cmi \ - middle_end/flambda/naming/bindable_depth_variable.cmi \ middle_end/flambda/naming/bindable_let_bound.cmi middle_end/flambda/naming/bindable_let_bound.cmx : \ middle_end/flambda/compilenv_deps/variable.cmx \ @@ -5562,19 +5529,15 @@ middle_end/flambda/naming/bindable_let_bound.cmx : \ utils/misc.cmx \ middle_end/flambda/cmx/ids_for_export.cmx \ utils/identifiable.cmx \ - middle_end/flambda/compilenv_deps/depth_variable.cmx \ middle_end/flambda/terms/bound_symbols.cmx \ - middle_end/flambda/naming/bindable_depth_variable.cmx \ middle_end/flambda/naming/bindable_let_bound.cmi middle_end/flambda/naming/bindable_let_bound.cmi : \ middle_end/flambda/compilenv_deps/variable.cmi \ middle_end/flambda/naming/var_in_binding_pos.cmi \ middle_end/flambda/basic/symbol_scoping_rule.cmi \ middle_end/flambda/naming/name_mode.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ middle_end/flambda/cmx/contains_ids.cmo \ middle_end/flambda/terms/bound_symbols.cmi \ - middle_end/flambda/naming/bindable_depth_variable.cmi \ middle_end/flambda/naming/bindable.cmo middle_end/flambda/naming/bindable_variable_in_terms.cmo : \ middle_end/flambda/compilenv_deps/variable.cmi \ @@ -5687,7 +5650,6 @@ middle_end/flambda/naming/name_occurrences.cmo : \ middle_end/flambda/basic/name.cmi \ utils/misc.cmi \ utils/identifiable.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ middle_end/flambda/basic/continuation.cmi \ middle_end/flambda/basic/code_id_or_symbol.cmi \ middle_end/flambda/basic/code_id.cmi \ @@ -5702,7 +5664,6 @@ middle_end/flambda/naming/name_occurrences.cmx : \ middle_end/flambda/basic/name.cmx \ utils/misc.cmx \ utils/identifiable.cmx \ - middle_end/flambda/compilenv_deps/depth_variable.cmx \ middle_end/flambda/basic/continuation.cmx \ middle_end/flambda/basic/code_id_or_symbol.cmx \ middle_end/flambda/basic/code_id.cmx \ @@ -5716,7 +5677,6 @@ middle_end/flambda/naming/name_occurrences.cmi : \ middle_end/flambda/naming/num_occurrences.cmi \ middle_end/flambda/naming/name_mode.cmi \ middle_end/flambda/basic/name.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ middle_end/flambda/basic/continuation.cmi \ middle_end/flambda/basic/code_id_or_symbol.cmi \ middle_end/flambda/basic/code_id.cmi @@ -5741,7 +5701,6 @@ middle_end/flambda/naming/renaming.cmo : \ middle_end/flambda/naming/permutation.cmi \ middle_end/flambda/basic/name.cmi \ utils/misc.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ middle_end/flambda/basic/continuation.cmi \ middle_end/flambda/compilenv_deps/coercion.cmi \ middle_end/flambda/basic/code_id.cmi \ @@ -5754,7 +5713,6 @@ middle_end/flambda/naming/renaming.cmx : \ middle_end/flambda/naming/permutation.cmx \ middle_end/flambda/basic/name.cmx \ utils/misc.cmx \ - middle_end/flambda/compilenv_deps/depth_variable.cmx \ middle_end/flambda/basic/continuation.cmx \ middle_end/flambda/compilenv_deps/coercion.cmx \ middle_end/flambda/basic/code_id.cmx \ @@ -5765,7 +5723,6 @@ middle_end/flambda/naming/renaming.cmi : \ middle_end/flambda/compilenv_deps/symbol.cmi \ middle_end/flambda/compilenv_deps/reg_width_things.cmi \ middle_end/flambda/basic/name.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ middle_end/flambda/basic/continuation.cmi \ middle_end/flambda/basic/code_id.cmi middle_end/flambda/naming/var_in_binding_pos.cmo : \ @@ -5864,7 +5821,6 @@ middle_end/flambda/parser/fexpr_to_flambda.cmo : \ middle_end/flambda/terms/flambda.cmi \ middle_end/flambda/parser/fexpr.cmo \ middle_end/flambda/basic/exn_continuation.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ lambda/debuginfo.cmi \ middle_end/flambda/basic/continuation.cmi \ middle_end/flambda/compilenv_deps/compilation_unit.cmi \ @@ -5915,7 +5871,6 @@ middle_end/flambda/parser/fexpr_to_flambda.cmx : \ middle_end/flambda/terms/flambda.cmx \ middle_end/flambda/parser/fexpr.cmx \ middle_end/flambda/basic/exn_continuation.cmx \ - middle_end/flambda/compilenv_deps/depth_variable.cmx \ lambda/debuginfo.cmx \ middle_end/flambda/basic/continuation.cmx \ middle_end/flambda/compilenv_deps/compilation_unit.cmx \ @@ -6285,7 +6240,6 @@ middle_end/flambda/simplify/rebuilt_expr.cmi : \ middle_end/flambda/basic/kinded_parameter.cmi \ middle_end/flambda/terms/flambda.cmi \ middle_end/flambda/basic/exn_continuation.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ lambda/debuginfo.cmi \ middle_end/flambda/basic/continuation.cmi \ middle_end/flambda/inlining/metrics/code_size.cmi \ @@ -6303,7 +6257,6 @@ middle_end/flambda/simplify/rebuilt_static_const.cmo : \ utils/misc.cmi \ middle_end/flambda/terms/flambda.cmi \ middle_end/flambda/basic/exn_continuation.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ lambda/debuginfo.cmi \ middle_end/flambda/basic/continuation.cmi \ middle_end/flambda/basic/code_id.cmi \ @@ -6321,7 +6274,6 @@ middle_end/flambda/simplify/rebuilt_static_const.cmx : \ utils/misc.cmx \ middle_end/flambda/terms/flambda.cmx \ middle_end/flambda/basic/exn_continuation.cmx \ - middle_end/flambda/compilenv_deps/depth_variable.cmx \ lambda/debuginfo.cmx \ middle_end/flambda/basic/continuation.cmx \ middle_end/flambda/basic/code_id.cmx \ @@ -6443,7 +6395,6 @@ middle_end/flambda/simplify/simplify_apply_expr.cmo : \ middle_end/flambda/terms/function_declaration.cmi \ middle_end/flambda/types/kinds/flambda_arity.cmi \ middle_end/flambda/basic/exn_continuation.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ lambda/debuginfo.cmi \ middle_end/flambda/simplify/env/data_flow.cmi \ middle_end/flambda/basic/continuation.cmi \ @@ -6481,7 +6432,6 @@ middle_end/flambda/simplify/simplify_apply_expr.cmx : \ middle_end/flambda/terms/function_declaration.cmx \ middle_end/flambda/types/kinds/flambda_arity.cmx \ middle_end/flambda/basic/exn_continuation.cmx \ - middle_end/flambda/compilenv_deps/depth_variable.cmx \ lambda/debuginfo.cmx \ middle_end/flambda/simplify/env/data_flow.cmx \ middle_end/flambda/basic/continuation.cmx \ @@ -8147,7 +8097,6 @@ middle_end/flambda/terms/flambda.cmo : \ middle_end/flambda/types/kinds/flambda_arity.cmi \ middle_end/flambda/basic/expr_std.cmo \ middle_end/flambda/basic/exn_continuation.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ lambda/debuginfo.cmi \ middle_end/flambda/basic/continuation.cmi \ middle_end/flambda/naming/contains_names.cmo \ @@ -8159,9 +8108,9 @@ middle_end/flambda/terms/flambda.cmo : \ middle_end/flambda/basic/closure_id.cmi \ utils/clflags.cmi \ middle_end/flambda/terms/bound_symbols.cmi \ + middle_end/flambda/naming/bindable_variable_in_terms.cmi \ middle_end/flambda/naming/bindable_let_bound.cmi \ middle_end/flambda/naming/bindable_exn_continuation.cmi \ - middle_end/flambda/naming/bindable_depth_variable.cmi \ middle_end/flambda/naming/bindable_continuation.cmi \ middle_end/flambda/terms/apply_expr.cmi \ middle_end/flambda/terms/apply_cont_expr.cmi \ @@ -8209,7 +8158,6 @@ middle_end/flambda/terms/flambda.cmx : \ middle_end/flambda/types/kinds/flambda_arity.cmx \ middle_end/flambda/basic/expr_std.cmx \ middle_end/flambda/basic/exn_continuation.cmx \ - middle_end/flambda/compilenv_deps/depth_variable.cmx \ lambda/debuginfo.cmx \ middle_end/flambda/basic/continuation.cmx \ middle_end/flambda/naming/contains_names.cmx \ @@ -8221,9 +8169,9 @@ middle_end/flambda/terms/flambda.cmx : \ middle_end/flambda/basic/closure_id.cmx \ utils/clflags.cmx \ middle_end/flambda/terms/bound_symbols.cmx \ + middle_end/flambda/naming/bindable_variable_in_terms.cmx \ middle_end/flambda/naming/bindable_let_bound.cmx \ middle_end/flambda/naming/bindable_exn_continuation.cmx \ - middle_end/flambda/naming/bindable_depth_variable.cmx \ middle_end/flambda/naming/bindable_continuation.cmx \ middle_end/flambda/terms/apply_expr.cmx \ middle_end/flambda/terms/apply_cont_expr.cmx \ @@ -8262,7 +8210,6 @@ middle_end/flambda/terms/flambda.cmi : \ middle_end/flambda/types/kinds/flambda_arity.cmi \ middle_end/flambda/basic/expr_std.cmo \ middle_end/flambda/basic/exn_continuation.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ lambda/debuginfo.cmi \ middle_end/flambda/basic/continuation.cmi \ middle_end/flambda/naming/contains_names.cmo \ @@ -8422,8 +8369,8 @@ middle_end/flambda/terms/function_params_and_body.rec.cmo : \ middle_end/flambda/basic/exn_continuation.cmi \ lambda/debuginfo.cmi \ middle_end/flambda/basic/continuation.cmi \ + middle_end/flambda/naming/bindable_variable_in_terms.cmi \ middle_end/flambda/naming/bindable_exn_continuation.cmi \ - middle_end/flambda/naming/bindable_depth_variable.cmi \ middle_end/flambda/naming/bindable_continuation.cmi \ middle_end/flambda/terms/function_params_and_body.rec.cmi middle_end/flambda/terms/function_params_and_body.rec.cmx : \ @@ -8437,8 +8384,8 @@ middle_end/flambda/terms/function_params_and_body.rec.cmx : \ middle_end/flambda/basic/exn_continuation.cmx \ lambda/debuginfo.cmx \ middle_end/flambda/basic/continuation.cmx \ + middle_end/flambda/naming/bindable_variable_in_terms.cmx \ middle_end/flambda/naming/bindable_exn_continuation.cmx \ - middle_end/flambda/naming/bindable_depth_variable.cmx \ middle_end/flambda/naming/bindable_continuation.cmx \ middle_end/flambda/terms/function_params_and_body.rec.cmi middle_end/flambda/terms/function_params_and_body.rec.cmi : \ @@ -8449,7 +8396,6 @@ middle_end/flambda/terms/function_params_and_body.rec.cmi : \ middle_end/flambda/types/kinds/flambda_arity.cmi \ middle_end/flambda/basic/expr_std.cmo \ middle_end/flambda/basic/exn_continuation.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ lambda/debuginfo.cmi \ middle_end/flambda/basic/continuation.cmi \ middle_end/flambda/cmx/contains_ids.cmo @@ -8602,20 +8548,24 @@ middle_end/flambda/terms/non_recursive_let_cont_handler.rec.cmi : \ middle_end/flambda/basic/continuation.cmi \ middle_end/flambda/cmx/contains_ids.cmo middle_end/flambda/terms/rec_info_expr.cmo : \ + middle_end/flambda/compilenv_deps/variable.cmi \ middle_end/flambda/naming/renaming.cmi \ middle_end/flambda/naming/name_occurrences.cmi \ + middle_end/flambda/naming/name_mode.cmi \ middle_end/flambda/cmx/ids_for_export.cmi \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ + middle_end/flambda/compilenv_deps/flambda_colours.cmi \ middle_end/flambda/terms/rec_info_expr.cmi middle_end/flambda/terms/rec_info_expr.cmx : \ + middle_end/flambda/compilenv_deps/variable.cmx \ middle_end/flambda/naming/renaming.cmx \ middle_end/flambda/naming/name_occurrences.cmx \ + middle_end/flambda/naming/name_mode.cmx \ middle_end/flambda/cmx/ids_for_export.cmx \ - middle_end/flambda/compilenv_deps/depth_variable.cmx \ + middle_end/flambda/compilenv_deps/flambda_colours.cmx \ middle_end/flambda/terms/rec_info_expr.cmi middle_end/flambda/terms/rec_info_expr.cmi : \ + middle_end/flambda/compilenv_deps/variable.cmi \ middle_end/flambda/basic/expr_std.cmo \ - middle_end/flambda/compilenv_deps/depth_variable.cmi \ middle_end/flambda/cmx/contains_ids.cmo middle_end/flambda/terms/recursive_let_cont_handlers.rec.cmo : \ middle_end/flambda/naming/name_occurrences.cmi \ diff --git a/compilerlibs/Makefile.compilerlibs b/compilerlibs/Makefile.compilerlibs index e0f4b0a5d324..42deb3ed4371 100644 --- a/compilerlibs/Makefile.compilerlibs +++ b/compilerlibs/Makefile.compilerlibs @@ -186,7 +186,6 @@ MIDDLE_END_FLAMBDA_COMPILENV_DEPS=\ middle_end/flambda/compilenv_deps/target_imm.cmo \ middle_end/flambda/compilenv_deps/flambda_colours.cmo \ middle_end/flambda/compilenv_deps/compilation_unit.cmo \ - middle_end/flambda/compilenv_deps/depth_variable.cmo \ middle_end/flambda/compilenv_deps/rec_info.cmo \ middle_end/flambda/compilenv_deps/coercion.cmo \ middle_end/flambda/compilenv_deps/reg_width_things.cmo \ @@ -247,7 +246,6 @@ MIDDLE_END_FLAMBDA_NAMING=\ middle_end/flambda/naming/var_in_binding_pos.cmo \ middle_end/flambda/naming/bindable.cmo \ middle_end/flambda/terms/bound_symbols.cmo \ - middle_end/flambda/naming/bindable_depth_variable.cmo \ middle_end/flambda/naming/bindable_let_bound.cmo \ middle_end/flambda/naming/bindable_continuation.cmo \ middle_end/flambda/naming/bindable_exn_continuation.cmo \ diff --git a/middle_end/flambda/compilenv_deps/depth_variable.ml b/middle_end/flambda/compilenv_deps/depth_variable.ml deleted file mode 100644 index a7bac35028b2..000000000000 --- a/middle_end/flambda/compilenv_deps/depth_variable.ml +++ /dev/null @@ -1,94 +0,0 @@ -(**************************************************************************) -(* *) -(* OCaml *) -(* *) -(* Pierre Chambart, OCamlPro *) -(* Mark Shinwell and Leo White, Jane Street Europe *) -(* *) -(* Copyright 2013--2020 OCamlPro SAS *) -(* Copyright 2014--2020 Jane Street Group LLC *) -(* *) -(* All rights reserved. This file is distributed under the terms of *) -(* the GNU Lesser General Public License version 2.1, with the *) -(* special exception on linking described in the file LICENSE. *) -(* *) -(**************************************************************************) - -[@@@ocaml.warning "+a-30-40-41-42"] - -type t = { - compilation_unit : Compilation_unit.t; - previous_compilation_units : Compilation_unit.t list; - name : string; - name_stamp : int; -} - -include Identifiable.Make(struct - type nonrec t = t - - let compare { name_stamp = ns1; compilation_unit = cu1; - previous_compilation_units = pcus1; name = _ } - { name_stamp = ns2; compilation_unit = cu2; - previous_compilation_units = pcus2; name = _ } = - match Int.compare ns1 ns2 with - | 0 -> - begin match Compilation_unit.compare cu1 cu2 with - | 0 -> - Misc.Stdlib.List.compare Compilation_unit.compare pcus1 pcus2 - | c -> c - end - | c -> c - - let hash { compilation_unit; previous_compilation_units; name_stamp; - name = _ } = - Hashtbl.hash (Compilation_unit.hash compilation_unit, - List.map Compilation_unit.hash previous_compilation_units, - name_stamp) - - let equal t1 t2 = compare t1 t2 = 0 - - let print ppf t = - Format.fprintf ppf "@<0>%s" (Flambda_colours.depth_variable ()); - Format.fprintf ppf "%s/%d" t.name t.name_stamp; - Format.fprintf ppf "@<0>%s" (Flambda_colours.normal ()) - - let output chan t = - print (Format.formatter_of_out_channel chan) t -end) - -type exported = t - -let previous_name_stamp = ref (-1) - -let create name : t = - let name_stamp = - incr previous_name_stamp; - !previous_name_stamp - in - let compilation_unit = Compilation_unit.get_current_exn () in - let previous_compilation_units = [] in - { compilation_unit; previous_compilation_units; name; name_stamp; } - -let rename { name; name_stamp = _; compilation_unit = _; - previous_compilation_units = _; } = - create name - -let name t = t.name - -let name_stamp t = t.name_stamp - -let print_with_cache ~cache:_ ppf t = print ppf t - -let export t = t - -let import data = data - -let map_compilation_unit f data = - let new_compilation_unit = f data.compilation_unit in - if Compilation_unit.equal new_compilation_unit data.compilation_unit - then data - else - { data with compilation_unit = new_compilation_unit; - previous_compilation_units = - data.compilation_unit :: data.previous_compilation_units; - } diff --git a/middle_end/flambda/compilenv_deps/depth_variable.mli b/middle_end/flambda/compilenv_deps/depth_variable.mli deleted file mode 100644 index 04aa48c55295..000000000000 --- a/middle_end/flambda/compilenv_deps/depth_variable.mli +++ /dev/null @@ -1,39 +0,0 @@ -(**************************************************************************) -(* *) -(* OCaml *) -(* *) -(* Pierre Chambart, OCamlPro *) -(* Mark Shinwell and Leo White, Jane Street Europe *) -(* *) -(* Copyright 2013--2021 OCamlPro SAS *) -(* Copyright 2014--2021 Jane Street Group LLC *) -(* *) -(* All rights reserved. This file is distributed under the terms of *) -(* the GNU Lesser General Public License version 2.1, with the *) -(* special exception on linking described in the file LICENSE. *) -(* *) -(**************************************************************************) - -[@@@ocaml.warning "+a-4-9-30-40-41-42"] - -type t -type exported - -include Identifiable.S with type t := t - -val create : string -> t - -val name : t -> string - -val name_stamp : t -> int - -val print_with_cache : cache:Printing_cache.t -> Format.formatter -> t -> unit - -val rename : t -> t - -val export : t -> exported - -val import : exported -> t - -val map_compilation_unit : - (Compilation_unit.t -> Compilation_unit.t) -> exported -> exported diff --git a/middle_end/flambda/from_lambda/closure_conversion.ml b/middle_end/flambda/from_lambda/closure_conversion.ml index d611709bcc8f..fd1a9e817c43 100644 --- a/middle_end/flambda/from_lambda/closure_conversion.ml +++ b/middle_end/flambda/from_lambda/closure_conversion.ml @@ -708,7 +708,7 @@ let close_one_function acc ~external_env ~by_closure_id decl let my_closure = Variable.create "my_closure" in let closure_id = Function_decl.closure_id decl in let my_closure_id = closure_id in - let my_depth = Depth_variable.create "my_depth" in + let my_depth = Variable.create "my_depth" in let our_let_rec_ident = Function_decl.let_rec_ident decl in let compilation_unit = Compilation_unit.get_current_exn () in let code_id = diff --git a/middle_end/flambda/naming/bindable_depth_variable.ml b/middle_end/flambda/naming/bindable_depth_variable.ml deleted file mode 100644 index 8bc902b2690f..000000000000 --- a/middle_end/flambda/naming/bindable_depth_variable.ml +++ /dev/null @@ -1,39 +0,0 @@ -(**************************************************************************) -(* *) -(* OCaml *) -(* *) -(* Pierre Chambart, OCamlPro *) -(* Mark Shinwell and Leo White, Jane Street Europe *) -(* *) -(* Copyright 2018--2021 OCamlPro SAS *) -(* Copyright 2018--2021 Jane Street Group LLC *) -(* *) -(* All rights reserved. This file is distributed under the terms of *) -(* the GNU Lesser General Public License version 2.1, with the *) -(* special exception on linking described in the file LICENSE. *) -(* *) -(**************************************************************************) - -[@@@ocaml.warning "+a-4-30-40-41-42"] - -include Depth_variable - -let free_names t = Name_occurrences.singleton_depth_variable t - -let apply_renaming t perm = Renaming.apply_depth_variable perm t - -let all_ids_for_export _ = - (* Depth variables don't use the integer id system *) - Ids_for_export.empty - -let add_to_name_permutation t ~guaranteed_fresh perm = - Renaming.add_fresh_depth_variable perm t ~guaranteed_fresh - -let name_permutation t ~guaranteed_fresh = - add_to_name_permutation t ~guaranteed_fresh Renaming.empty - -let singleton_occurrence_in_terms t = - Name_occurrences.singleton_depth_variable t - -let add_occurrence_in_terms t occs = - Name_occurrences.add_depth_variable occs t diff --git a/middle_end/flambda/naming/bindable_depth_variable.mli b/middle_end/flambda/naming/bindable_depth_variable.mli deleted file mode 100644 index e0920cf5e1e6..000000000000 --- a/middle_end/flambda/naming/bindable_depth_variable.mli +++ /dev/null @@ -1,27 +0,0 @@ -(**************************************************************************) -(* *) -(* OCaml *) -(* *) -(* Pierre Chambart, OCamlPro *) -(* Mark Shinwell and Leo White, Jane Street Europe *) -(* *) -(* Copyright 2018--2021 OCamlPro SAS *) -(* Copyright 2018--2021 Jane Street Group LLC *) -(* *) -(* All rights reserved. This file is distributed under the terms of *) -(* the GNU Lesser General Public License version 2.1, with the *) -(* special exception on linking described in the file LICENSE. *) -(* *) -(**************************************************************************) - -(** A [Depth_variable] equipped with operations that mean it can be used in - binding position within a [Name_abstraction] value. *) - -[@@@ocaml.warning "+a-4-30-40-41-42"] - -type t = Depth_variable.t - -include Bindable.S - with type t := t - with module Set = Depth_variable.Set - with module Map = Depth_variable.Map diff --git a/middle_end/flambda/naming/bindable_let_bound.ml b/middle_end/flambda/naming/bindable_let_bound.ml index 44fba585c7e7..97eb3dcbaa60 100644 --- a/middle_end/flambda/naming/bindable_let_bound.ml +++ b/middle_end/flambda/naming/bindable_let_bound.ml @@ -28,7 +28,6 @@ type t = | Symbols of symbols (* CR mshinwell: Add a case here for let-code and move it out of Symbols *) - | Depth of Bindable_depth_variable.t include Identifiable.Make (struct type nonrec t = t @@ -48,7 +47,6 @@ include Identifiable.Make (struct )@]" Bound_symbols.print bound_symbols Symbol_scoping_rule.print scoping_rule - | Depth depth_variable -> Depth_variable.print ppf depth_variable (* The following would only be required if using [Name_abstraction.Make_map], which we don't with this module. *) @@ -82,8 +80,6 @@ let free_names t = closure_vars | Symbols { bound_symbols; scoping_rule = _; } -> Bound_symbols.free_names bound_symbols - | Depth depth_variable -> - Name_occurrences.singleton_depth_variable depth_variable let apply_renaming t perm = match t with @@ -105,10 +101,6 @@ let apply_renaming t perm = in if bound_symbols == bound_symbols' then t else Symbols { scoping_rule; bound_symbols = bound_symbols'; } - | Depth dv -> - let dv' = Bindable_depth_variable.apply_renaming dv perm in - if dv == dv' then t - else Depth dv' let all_ids_for_export t = match t with @@ -122,8 +114,6 @@ let all_ids_for_export t = closure_vars | Symbols { bound_symbols; scoping_rule = _; } -> Bound_symbols.all_ids_for_export bound_symbols - | Depth depth_variable -> - Bindable_depth_variable.all_ids_for_export depth_variable let rename t = match t with @@ -134,7 +124,6 @@ let rename t = in Set_of_closures { name_mode; closure_vars; } | Symbols _ -> t - | Depth d -> Depth (Bindable_depth_variable.rename d) let add_to_name_permutation t1 ~guaranteed_fresh:t2 perm = match t1, t2 with @@ -160,9 +149,7 @@ let add_to_name_permutation t1 ~guaranteed_fresh:t2 perm = print t1 print t2 | Symbols _, Symbols _ -> perm - | Depth dv1, Depth dv2 -> - Renaming.add_fresh_depth_variable perm dv1 ~guaranteed_fresh:dv2 - | (Singleton _ | Set_of_closures _ | Symbols _ | Depth _), _ -> + | (Singleton _ | Set_of_closures _ | Symbols _), _ -> Misc.fatal_errorf "Kind mismatch:@ %a@ and@ %a" print t1 print t2 @@ -202,15 +189,11 @@ let set_of_closures ~closure_vars = let symbols bound_symbols scoping_rule = Symbols { bound_symbols; scoping_rule; } -let depth depth_variable = - Depth depth_variable - let name_mode t = match t with | Singleton var -> Var_in_binding_pos.name_mode var | Set_of_closures { name_mode; _ } -> name_mode | Symbols _ -> Name_mode.normal - | Depth _ -> Name_mode.normal let with_name_mode t name_mode = match t with @@ -219,69 +202,58 @@ let with_name_mode t name_mode = | Set_of_closures { name_mode = _; closure_vars; } -> Set_of_closures { name_mode; closure_vars; } | Symbols _ -> t - | Depth _ -> t let must_be_singleton t = match t with | Singleton var -> var - | Set_of_closures _ | Symbols _ | Depth _ -> + | Set_of_closures _ | Symbols _ -> Misc.fatal_errorf "Bound name is not a [Singleton]:@ %a" print t let must_be_singleton_opt t = match t with | Singleton var -> Some var - | Set_of_closures _ | Symbols _ | Depth _ -> None + | Set_of_closures _ | Symbols _ -> None let must_be_set_of_closures t = match t with | Set_of_closures { closure_vars; _ } -> closure_vars - | Singleton _ | Symbols _ | Depth _ -> + | Singleton _ | Symbols _ -> Misc.fatal_errorf "Bound name is not a [Set_of_closures]:@ %a" print t let must_be_symbols t = match t with | Symbols symbols -> symbols - | Singleton _ | Set_of_closures _ | Depth _ -> + | Singleton _ | Set_of_closures _ -> Misc.fatal_errorf "Bound name is not a [Set_of_closures]:@ %a" print t -let must_be_depth t = - match t with - | Depth depth_variable -> depth_variable - | Singleton _ | Set_of_closures _ | Symbols _ -> - Misc.fatal_errorf "Bound name is not a [Depth_variable]:@ %a" print t - let exists_all_bound_vars t ~f = match t with | Singleton var -> f var | Set_of_closures { closure_vars; _ } -> ListLabels.exists closure_vars ~f - | Symbols _ - | Depth _ -> false + | Symbols _ -> false let fold_all_bound_vars t ~init ~f = match t with | Singleton var -> f init var | Set_of_closures { closure_vars; _ } -> ListLabels.fold_left closure_vars ~init ~f - | Symbols _ - | Depth _ -> init + | Symbols _ -> init let all_bound_vars t = match t with | Singleton var -> Var_in_binding_pos.Set.singleton var | Set_of_closures { closure_vars; _ } -> Var_in_binding_pos.Set.of_list closure_vars - | Symbols _ - | Depth _ -> Var_in_binding_pos.Set.empty + | Symbols _ -> Var_in_binding_pos.Set.empty let all_bound_vars' t = match t with | Singleton var -> Variable.Set.singleton (Var_in_binding_pos.var var) | Set_of_closures { closure_vars; _ } -> Variable.Set.of_list (List.map Var_in_binding_pos.var closure_vars) - | Symbols _ - | Depth _ -> Variable.Set.empty + | Symbols _ -> Variable.Set.empty let let_symbol_scoping_rule t = match t with - | Singleton _ | Set_of_closures _ | Depth _ -> None + | Singleton _ | Set_of_closures _ -> None | Symbols { scoping_rule; _ } -> Some scoping_rule diff --git a/middle_end/flambda/naming/bindable_let_bound.mli b/middle_end/flambda/naming/bindable_let_bound.mli index 08071b524e08..7738aa5b8778 100644 --- a/middle_end/flambda/naming/bindable_let_bound.mli +++ b/middle_end/flambda/naming/bindable_let_bound.mli @@ -34,8 +34,6 @@ type t = private (** The binding of one or more symbols to statically-allocated constant(s). The scoping of the symbols may either be syntactic, or follow the dominator tree. *) - | Depth of Bindable_depth_variable.t - (** The binding of a recursion state to a depth variable. *) include Bindable.S with type t := t @@ -47,8 +45,6 @@ val set_of_closures : closure_vars:Var_in_binding_pos.t list -> t val symbols : Bound_symbols.t -> Symbol_scoping_rule.t -> t -val depth : Depth_variable.t -> t - val must_be_singleton : t -> Var_in_binding_pos.t val must_be_singleton_opt : t -> Var_in_binding_pos.t option @@ -57,8 +53,6 @@ val must_be_set_of_closures : t -> Var_in_binding_pos.t list val must_be_symbols : t -> symbols -val must_be_depth : t -> Depth_variable.t - val name_mode : t -> Name_mode.t val with_name_mode : t -> Name_mode.t -> t diff --git a/middle_end/flambda/naming/name_occurrences.ml b/middle_end/flambda/naming/name_occurrences.ml index ab128b568905..dbca5d982399 100644 --- a/middle_end/flambda/naming/name_occurrences.ml +++ b/middle_end/flambda/naming/name_occurrences.ml @@ -602,11 +602,6 @@ module For_code_ids = For_one_variety_of_names (struct let apply_renaming t perm = Renaming.apply_code_id perm t end) -module For_depth_variables = For_one_variety_of_names (struct - include Depth_variable - let apply_renaming t perm = Renaming.apply_depth_variable perm t -end) - type t = { names : For_names.t; continuations : For_continuations.t; @@ -617,7 +612,6 @@ type t = { newer_version_of_code_ids : For_code_ids.t; (* [newer_version_of_code_ids] tracks those code IDs that occur in "newer version of" fields (e.g. in [Flambda_static.Static_part.code]). *) - depth_variables : For_depth_variables.t; } let empty = { @@ -626,15 +620,13 @@ let empty = { continuations_with_traps = For_continuations.empty; continuations_in_trap_actions = For_continuations.empty; closure_vars = For_closure_vars.empty; - depth_variables = For_depth_variables.empty; code_ids = For_code_ids.empty; newer_version_of_code_ids = For_code_ids.empty; } let print ppf ({ names; continuations; continuations_with_traps; continuations_in_trap_actions; - closure_vars; depth_variables; - code_ids; newer_version_of_code_ids; } as t) = + closure_vars; code_ids; newer_version_of_code_ids; } as t) = if t = empty then Format.fprintf ppf "no_occurrences" else @@ -646,7 +638,6 @@ let print ppf ({ names; continuations; continuations_with_traps; @[(closure_vars %a)@]@ \ @[(code_ids %a)@] \ @[(newer_version_of_code_ids %a)@]@ \ - @[(depth_variables %a)@]\ @]" For_names.print names For_continuations.print continuations @@ -655,7 +646,6 @@ let print ppf ({ names; continuations; continuations_with_traps; For_closure_vars.print closure_vars For_code_ids.print code_ids For_code_ids.print newer_version_of_code_ids - For_depth_variables.print depth_variables let singleton_continuation cont = { empty with @@ -737,15 +727,6 @@ let add_newer_version_of_code_id t id kind = For_code_ids.add t.newer_version_of_code_ids id kind; } -let add_depth_variable t depth_variable = - { t with - depth_variables = - For_depth_variables.add t.depth_variables depth_variable Kind.normal; - } - -let singleton_depth_variable depth_variable = - add_depth_variable empty depth_variable - let singleton_symbol sym kind = { empty with names = For_names.singleton (Name.symbol sym) kind; @@ -791,7 +772,7 @@ let create_closure_vars clos_vars = { empty with closure_vars; } let binary_conjunction ~for_names ~for_continuations - ~for_closure_vars ~for_code_ids ~for_depth_variables + ~for_closure_vars ~for_code_ids { names = names1; continuations = continuations1; continuations_with_traps = continuations_with_traps1; @@ -799,7 +780,6 @@ let binary_conjunction ~for_names ~for_continuations closure_vars = closure_vars1; code_ids = code_ids1; newer_version_of_code_ids = newer_version_of_code_ids1; - depth_variables = depth_variables1; } { names = names2; continuations = continuations2; @@ -808,7 +788,6 @@ let binary_conjunction ~for_names ~for_continuations closure_vars = closure_vars2; code_ids = code_ids2; newer_version_of_code_ids = newer_version_of_code_ids2; - depth_variables = depth_variables2; } = for_names names1 names2 && for_continuations continuations1 continuations2 @@ -819,10 +798,9 @@ let binary_conjunction ~for_names ~for_continuations && for_closure_vars closure_vars1 closure_vars2 && for_code_ids code_ids1 code_ids2 && for_code_ids newer_version_of_code_ids1 newer_version_of_code_ids2 - && for_depth_variables depth_variables1 depth_variables2 let binary_disjunction ~for_names ~for_continuations - ~for_closure_vars ~for_code_ids ~for_depth_variables + ~for_closure_vars ~for_code_ids { names = names1; continuations = continuations1; continuations_with_traps = continuations_with_traps1; @@ -830,7 +808,6 @@ let binary_disjunction ~for_names ~for_continuations closure_vars = closure_vars1; code_ids = code_ids1; newer_version_of_code_ids = newer_version_of_code_ids1; - depth_variables = depth_variables1; } { names = names2; continuations = continuations2; @@ -839,7 +816,6 @@ let binary_disjunction ~for_names ~for_continuations closure_vars = closure_vars2; code_ids = code_ids2; newer_version_of_code_ids = newer_version_of_code_ids2; - depth_variables = depth_variables2; } = for_names names1 names2 || for_continuations continuations1 continuations2 @@ -850,10 +826,8 @@ let binary_disjunction ~for_names ~for_continuations || for_closure_vars closure_vars1 closure_vars2 || for_code_ids code_ids1 code_ids2 || for_code_ids newer_version_of_code_ids1 newer_version_of_code_ids2 - || for_depth_variables depth_variables1 depth_variables2 let binary_op ~for_names ~for_continuations ~for_closure_vars ~for_code_ids - ~for_depth_variables { names = names1; continuations = continuations1; continuations_with_traps = continuations_with_traps1; @@ -861,7 +835,6 @@ let binary_op ~for_names ~for_continuations ~for_closure_vars ~for_code_ids closure_vars = closure_vars1; code_ids = code_ids1; newer_version_of_code_ids = newer_version_of_code_ids1; - depth_variables = depth_variables1; } { names = names2; continuations = continuations2; @@ -870,7 +843,6 @@ let binary_op ~for_names ~for_continuations ~for_closure_vars ~for_code_ids closure_vars = closure_vars2; code_ids = code_ids2; newer_version_of_code_ids = newer_version_of_code_ids2; - depth_variables = depth_variables2; } = let names = for_names names1 names2 in let continuations = for_continuations continuations1 continuations2 in @@ -887,7 +859,6 @@ let binary_op ~for_names ~for_continuations ~for_closure_vars ~for_code_ids let newer_version_of_code_ids = for_code_ids newer_version_of_code_ids1 newer_version_of_code_ids2 in - let depth_variables = for_depth_variables depth_variables1 depth_variables2 in { names; continuations; continuations_with_traps; @@ -895,7 +866,6 @@ let binary_op ~for_names ~for_continuations ~for_closure_vars ~for_code_ids closure_vars; code_ids; newer_version_of_code_ids; - depth_variables; } let diff @@ -906,7 +876,6 @@ let diff closure_vars = closure_vars1; code_ids = code_ids1; newer_version_of_code_ids = newer_version_of_code_ids1; - depth_variables = depth_variables1; } { names = names2; continuations = continuations2; @@ -915,7 +884,6 @@ let diff closure_vars = closure_vars2; code_ids = code_ids2; newer_version_of_code_ids = newer_version_of_code_ids2; - depth_variables = depth_variables2; } = let names = For_names.diff names1 names2 in let continuations = For_continuations.diff continuations1 continuations2 in @@ -934,9 +902,6 @@ let diff (* Note special case here: *) (For_code_ids.union newer_version_of_code_ids2 code_ids2) in - let depth_variables = - For_depth_variables.diff depth_variables1 depth_variables2 - in { names; continuations; continuations_with_traps; @@ -944,7 +909,6 @@ let diff closure_vars; code_ids; newer_version_of_code_ids; - depth_variables; } let union t1 t2 = @@ -952,7 +916,6 @@ let union t1 t2 = ~for_continuations:For_continuations.union ~for_closure_vars:For_closure_vars.union ~for_code_ids:For_code_ids.union - ~for_depth_variables:For_depth_variables.union t1 t2 let equal t1 t2 = @@ -960,7 +923,6 @@ let equal t1 t2 = ~for_continuations:For_continuations.equal ~for_closure_vars:For_closure_vars.equal ~for_code_ids:For_code_ids.equal - ~for_depth_variables:For_depth_variables.equal t1 t2 let is_empty t = equal t empty @@ -971,7 +933,7 @@ let no_variables t = let no_continuations { names = _; continuations; continuations_with_traps = _; - continuations_in_trap_actions; depth_variables = _; + continuations_in_trap_actions; closure_vars = _; code_ids = _; newer_version_of_code_ids = _; } = (* Note: continuations_with_traps is included in continuations *) For_continuations.is_empty continuations @@ -997,7 +959,6 @@ let subset_domain t1 t2 = ~for_continuations:For_continuations.subset_domain ~for_closure_vars:For_closure_vars.subset_domain ~for_code_ids:For_code_ids.subset_domain - ~for_depth_variables:For_depth_variables.subset_domain t1 t2 let inter_domain_is_non_empty t1 t2 = @@ -1005,7 +966,6 @@ let inter_domain_is_non_empty t1 t2 = ~for_continuations:For_continuations.inter_domain_is_non_empty ~for_closure_vars:For_closure_vars.inter_domain_is_non_empty ~for_code_ids:For_code_ids.inter_domain_is_non_empty - ~for_depth_variables:For_depth_variables.inter_domain_is_non_empty t1 t2 let rec union_list ts = @@ -1022,7 +982,6 @@ let continuations_including_in_trap_actions t = (For_continuations.keys t.continuations_in_trap_actions) let code_ids t = For_code_ids.keys t.code_ids let newer_version_of_code_ids t = For_code_ids.keys t.newer_version_of_code_ids -let depth_variables t = For_depth_variables.keys t.depth_variables let code_ids_and_newer_version_of_code_ids t = Code_id.Set.union (code_ids t) (newer_version_of_code_ids t) @@ -1109,7 +1068,7 @@ let greatest_name_mode_var t var = let downgrade_occurrences_at_strictly_greater_kind { names; continuations; continuations_with_traps; continuations_in_trap_actions; closure_vars; - code_ids; newer_version_of_code_ids; depth_variables; } + code_ids; newer_version_of_code_ids; } max_kind = (* CR mshinwell: Don't reallocate the record if nothing changed *) let names = @@ -1132,10 +1091,6 @@ let downgrade_occurrences_at_strictly_greater_kind For_closure_vars.downgrade_occurrences_at_strictly_greater_kind closure_vars max_kind in - let depth_variables = - For_depth_variables.downgrade_occurrences_at_strictly_greater_kind - depth_variables max_kind - in let code_ids = For_code_ids.downgrade_occurrences_at_strictly_greater_kind code_ids max_kind @@ -1151,7 +1106,6 @@ let downgrade_occurrences_at_strictly_greater_kind closure_vars; code_ids; newer_version_of_code_ids; - depth_variables; } let with_only_variables { names; _ } = @@ -1200,8 +1154,7 @@ let fold_code_ids t ~init ~f = let apply_renaming ({ names; continuations; continuations_with_traps; continuations_in_trap_actions; - closure_vars; code_ids; newer_version_of_code_ids; - depth_variables; } as t) + closure_vars; code_ids; newer_version_of_code_ids; } as t) renaming = if Renaming.is_empty renaming then t else @@ -1220,9 +1173,6 @@ let apply_renaming let newer_version_of_code_ids = For_code_ids.apply_renaming newer_version_of_code_ids renaming in - let depth_variables = - For_depth_variables.apply_renaming depth_variables renaming - in { names; continuations; continuations_with_traps; @@ -1230,14 +1180,12 @@ let apply_renaming closure_vars; code_ids; newer_version_of_code_ids; - depth_variables; } let restrict_to_closure_vars { names = _; continuations = _; continuations_with_traps = _; continuations_in_trap_actions = _; - closure_vars; code_ids = _; newer_version_of_code_ids = _; - depth_variables = _; } = + closure_vars; code_ids = _; newer_version_of_code_ids = _; } = { empty with closure_vars; } diff --git a/middle_end/flambda/naming/name_occurrences.mli b/middle_end/flambda/naming/name_occurrences.mli index 3b37cdadecd5..5bf58f32f87c 100644 --- a/middle_end/flambda/naming/name_occurrences.mli +++ b/middle_end/flambda/naming/name_occurrences.mli @@ -73,10 +73,6 @@ val add_code_id : t -> Code_id.t -> Name_mode.t -> t "newer version of" field (e.g. in [Flambda_static.Static_part.code]). *) val add_newer_version_of_code_id : t -> Code_id.t -> Name_mode.t -> t -val singleton_depth_variable : Depth_variable.t -> t - -val add_depth_variable : t -> Depth_variable.t -> t - val singleton_name : Name.t -> Name_mode.t -> t val singleton_symbol : Symbol.t -> Name_mode.t -> t @@ -121,8 +117,6 @@ val closure_vars : t -> Var_within_closure.Set.t val symbols : t -> Symbol.Set.t -val depth_variables : t -> Depth_variable.Set.t - val code_ids : t -> Code_id.Set.t val newer_version_of_code_ids : t -> Code_id.Set.t diff --git a/middle_end/flambda/naming/renaming.ml b/middle_end/flambda/naming/renaming.ml index e9c0f6f20899..4ca83b1f4b30 100644 --- a/middle_end/flambda/naming/renaming.ml +++ b/middle_end/flambda/naming/renaming.ml @@ -23,7 +23,6 @@ module Continuations = (Permutation.Make [@inlined hint]) (Continuation) module Variables = (Permutation.Make [@inlined hint]) (Variable) module Code_ids = (Permutation.Make [@inlined hint]) (Code_id) module Symbols = (Permutation.Make [@inlined hint]) (Symbol) -module Depth_variables = (Permutation.Make [@inlined hint]) (Depth_variable) module Const = Reg_width_things.Const module Simple = Reg_width_things.Simple @@ -141,7 +140,6 @@ type t = { variables : Variables.t; code_ids : Code_ids.t; symbols : Symbols.t; - depth_variables : Depth_variables.t; import_map : Import_map.t option; } @@ -150,7 +148,6 @@ let empty = variables = Variables.empty; code_ids = Code_ids.empty; symbols = Symbols.empty; - depth_variables = Depth_variables.empty; import_map = None; } @@ -164,29 +161,24 @@ let create_import_map ~symbols ~variables ~simples ~consts ~code_ids else { empty with import_map = Some import_map; } let print ppf - { continuations; variables; code_ids; symbols; depth_variables; - import_map = _; } = + { continuations; variables; code_ids; symbols; import_map = _; } = Format.fprintf ppf "@[(\ @[(continuations@ %a)@]@ \ @[(variables@ %a)@])@ \ @[(code_ids@ %a)@])@ \ @[(symbols@ %a)@])@ \ - @[(depth_variables@ %a)@])\ @]" Continuations.print continuations Variables.print variables Code_ids.print code_ids Symbols.print symbols - Depth_variables.print depth_variables let is_empty - { continuations; variables; code_ids; symbols; depth_variables; - import_map; } = + { continuations; variables; code_ids; symbols; import_map; } = Continuations.is_empty continuations && Variables.is_empty variables && Code_ids.is_empty code_ids && Symbols.is_empty symbols - && Depth_variables.is_empty depth_variables && match import_map with | None -> true | Some import_map -> Import_map.is_empty import_map @@ -197,7 +189,6 @@ let compose0 variables = variables2; code_ids = code_ids2; symbols = symbols2; - depth_variables = depth_variables2; import_map = import_map2; } as second) ~first: @@ -205,7 +196,6 @@ let compose0 variables = variables1; code_ids = code_ids1; symbols = symbols1; - depth_variables = depth_variables1; import_map = import_map1; } as first) = { continuations = @@ -213,8 +203,6 @@ let compose0 variables = Variables.compose ~second:variables2 ~first:variables1; code_ids = Code_ids.compose ~second:code_ids2 ~first:code_ids1; symbols = Symbols.compose ~second:symbols2 ~first:symbols1; - depth_variables = - Depth_variables.compose ~second:depth_variables2 ~first:depth_variables1; (* The process of simplification of terms together with the collection of [Ids_for_export] from types, prior to writing of .cmx files, should ensure that only [first] (and not [second]) has an import map. *) @@ -357,15 +345,3 @@ let closure_var_is_used t closure_var = match t.import_map with | None -> true (* N.B. not false! *) | Some import_map -> Import_map.closure_var_is_used import_map closure_var - -let add_depth_variable t dv1 dv2 = - { t with - depth_variables = Depth_variables.compose_one ~first:t.depth_variables dv1 dv2 } - -let add_fresh_depth_variable t dv1 ~guaranteed_fresh:dv2 = - { t with - depth_variables = - Depth_variables.compose_one_fresh t.depth_variables dv1 ~fresh:dv2 } - -let apply_depth_variable t dv = - Depth_variables.apply t.depth_variables dv diff --git a/middle_end/flambda/naming/renaming.mli b/middle_end/flambda/naming/renaming.mli index 7fc95ed760c2..891c955b5336 100644 --- a/middle_end/flambda/naming/renaming.mli +++ b/middle_end/flambda/naming/renaming.mli @@ -92,14 +92,3 @@ val apply_simple : t -> Reg_width_things.Simple.t -> Reg_width_things.Simple.t (* CR mshinwell: See CR in the implementation about this function. *) val closure_var_is_used : t -> Var_within_closure.t -> bool - -(** Depth variables *) -val add_depth_variable : t -> Depth_variable.t -> Depth_variable.t -> t - -val add_fresh_depth_variable - : t - -> Depth_variable.t - -> guaranteed_fresh:Depth_variable.t - -> t - -val apply_depth_variable : t -> Depth_variable.t -> Depth_variable.t diff --git a/middle_end/flambda/parser/fexpr_to_flambda.ml b/middle_end/flambda/parser/fexpr_to_flambda.ml index aba95c358ac9..8923305461c3 100644 --- a/middle_end/flambda/parser/fexpr_to_flambda.ml +++ b/middle_end/flambda/parser/fexpr_to_flambda.ml @@ -28,13 +28,6 @@ module D = struct end module DM = Map.Make(D) -(* Depth variables *) -module DV = struct - type t = string - let compare = String.compare -end -module DVM = Map.Make(DV) - (* Closure ids (globally scoped, so updates are in-place) *) module U = struct type t = string @@ -59,7 +52,6 @@ type env = { variables : Variable.t VM.t; symbols : Symbol.t SM.t; code_ids : Code_id.t DM.t; - depth_variables : Depth_variable.t DVM.t; closure_ids : Closure_id.t UT.t; vars_within_closures : Var_within_closure.t WT.t; } @@ -79,7 +71,6 @@ let init_env () = variables = VM.empty; symbols = SM.empty; code_ids = DM.empty; - depth_variables = DVM.empty; closure_ids = UT.create 10; vars_within_closures = WT.create 10; } @@ -87,7 +78,6 @@ let init_env () = let enter_code env = { continuations = CM.empty; exn_continuations = CM.empty; - depth_variables = DVM.empty; variables = env.variables; done_continuation = env.done_continuation; error_continuation = env.error_continuation; @@ -123,12 +113,6 @@ let fresh_code_id env { Fexpr.txt = name; loc = _ } = { env with code_ids = DM.add name c env.code_ids } -let fresh_depth_var env { Fexpr.txt = name; loc = _ } = - let dv = Depth_variable.create name in - dv, - { env with - depth_variables = DVM.add name dv env.depth_variables } - let fresh_closure_id env { Fexpr.txt = name; loc = _ } = let v = Variable.create name in let c = Closure_id.wrap (Compilation_unit.get_current_exn ()) v in @@ -775,8 +759,9 @@ let rec expr env (e : Fexpr.expr) : Flambda.Expr.t = env params in let my_closure, env = fresh_var env closure_var in - (* CR lmaurer: Add depth variables to fexpr *) - let my_depth, env = fresh_depth_var env { txt = "depth"; loc = Loc_unknown } in + let my_depth, env = + fresh_var env { txt = "depth"; loc = Loc_unknown } + in let return_continuation, env = fresh_cont env ret_cont ~sort:Return ~arity:(List.length result_arity) diff --git a/middle_end/flambda/parser/flambda_to_fexpr.ml b/middle_end/flambda/parser/flambda_to_fexpr.ml index cd715f3989ad..4275bd21b4b0 100644 --- a/middle_end/flambda/parser/flambda_to_fexpr.ml +++ b/middle_end/flambda/parser/flambda_to_fexpr.ml @@ -542,8 +542,6 @@ and let_expr env le = dynamic_let_expr env closure_vars defining_expr body | Symbols { bound_symbols; scoping_rule } -> static_let_expr env bound_symbols scoping_rule defining_expr body - | Depth _dv -> - Misc.fatal_error "TODO: depth variables" ) and dynamic_let_expr env vars (defining_expr : Flambda.Named.t) body : Fexpr.expr = diff --git a/middle_end/flambda/simplify/expr_builder.ml b/middle_end/flambda/simplify/expr_builder.ml index 43466760f0f9..cc42750ee857 100644 --- a/middle_end/flambda/simplify/expr_builder.ml +++ b/middle_end/flambda/simplify/expr_builder.ml @@ -59,9 +59,6 @@ let create_let uacc (bound_vars : BLB.t) defining_expr | Present name_mode, Present greatest_name_mode -> Name_mode.max_in_terms name_mode greatest_name_mode |> Name_mode.Or_absent.present) - | Depth _ -> - (* depth variables are never phantom *) - Name_mode.Or_absent.present Name_mode.normal | Symbols _ -> assert false (* see below *) in let declared_name_mode = BLB.name_mode bound_vars in @@ -95,9 +92,9 @@ let create_let uacc (bound_vars : BLB.t) defining_expr bound_vars, Some Name_mode.normal, Nothing_deleted_at_runtime end else begin let is_depth = - match bound_vars with - | Depth _ -> true - | Singleton _ | Set_of_closures _ | Symbols _ -> false + match (defining_expr : Named.t) with + | Rec_info _ -> true + | Simple _ | Prim _ | Set_of_closures _ | Static_consts _ -> false in let has_uses = Name_mode.Or_absent.is_present greatest_name_mode in let user_visible = @@ -189,7 +186,7 @@ let make_new_let_bindings uacc let defining_expr = Simplified_named.to_named defining_expr in let expr, uacc, creation_result = match (let_bound : Bindable_let_bound.t) with - | Singleton _ | Set_of_closures _ | Depth _ -> + | Singleton _ | Set_of_closures _ -> create_let uacc let_bound defining_expr ~free_names_of_defining_expr ~body:expr ~cost_metrics_of_defining_expr diff --git a/middle_end/flambda/simplify/rebuilt_expr.mli b/middle_end/flambda/simplify/rebuilt_expr.mli index f6e18fbada1a..8707beeba072 100644 --- a/middle_end/flambda/simplify/rebuilt_expr.mli +++ b/middle_end/flambda/simplify/rebuilt_expr.mli @@ -65,7 +65,7 @@ module Function_params_and_body : sig -> body:rebuilt_expr -> free_names_of_body:Name_occurrences.t -> my_closure:Variable.t - -> my_depth:Depth_variable.t + -> my_depth:Variable.t -> t (** This function may only be used when rebuilding terms. *) diff --git a/middle_end/flambda/simplify/rebuilt_static_const.ml b/middle_end/flambda/simplify/rebuilt_static_const.ml index a115213e5076..c98dcbdcd234 100644 --- a/middle_end/flambda/simplify/rebuilt_static_const.ml +++ b/middle_end/flambda/simplify/rebuilt_static_const.ml @@ -305,7 +305,7 @@ module Group = struct ~extra_args:[]) [] ~dbg:Debuginfo.none ~body:(Expr.create_invalid ()) ~free_names_of_body:Unknown ~my_closure:(Variable.create "my_closure") - ~my_depth:(Depth_variable.create "my_depth")) + ~my_depth:(Variable.create "my_depth")) let pieces_of_code_including_those_not_rebuilt t = let consts = diff --git a/middle_end/flambda/simplify/simplify_apply_expr.ml b/middle_end/flambda/simplify/simplify_apply_expr.ml index 489163c067b9..b8c1de89cfee 100644 --- a/middle_end/flambda/simplify/simplify_apply_expr.ml +++ b/middle_end/flambda/simplify/simplify_apply_expr.ml @@ -244,7 +244,7 @@ let simplify_direct_partial_application ~simplify_expr dacc apply ((Apply.callee apply) :: applied_args) in let my_closure = Variable.create "my_closure" in - let my_depth = Depth_variable.create "my_depth" in + let my_depth = Variable.create "my_depth" in let exn_continuation = Apply.exn_continuation apply |> Exn_continuation.without_extra_args diff --git a/middle_end/flambda/simplify/simplify_let_expr.ml b/middle_end/flambda/simplify/simplify_let_expr.ml index c309b8b98b78..8bc1adf90e91 100644 --- a/middle_end/flambda/simplify/simplify_let_expr.ml +++ b/middle_end/flambda/simplify/simplify_let_expr.ml @@ -145,8 +145,7 @@ let simplify_let ~simplify_expr ~simplify_toplevel dacc let_expr ~down_to_up = Data_flow.record_binding (VB.var v) free_names ~generate_phantom_lets acc) | Symbols _ -> - Data_flow.add_used_in_current_handler free_names acc - | Depth _ -> acc)) + Data_flow.add_used_in_current_handler free_names acc)) in (* Next remember any lifted constants that were generated during the simplification of the defining expression and sort them, since they diff --git a/middle_end/flambda/terms/flambda.mli b/middle_end/flambda/terms/flambda.mli index b0547cac543c..a3d95cfd4c82 100644 --- a/middle_end/flambda/terms/flambda.mli +++ b/middle_end/flambda/terms/flambda.mli @@ -432,7 +432,7 @@ end and Function_params_and_body : sig -> body:Expr.t -> free_names_of_body:Name_occurrences.t Or_unknown.t -> my_closure:Variable.t - -> my_depth:Depth_variable.t + -> my_depth:Variable.t -> t (** Choose a member of the alpha-equivalence class to enable examination @@ -452,7 +452,7 @@ end and Function_params_and_body : sig -> body:Expr.t -> my_closure:Variable.t -> is_my_closure_used:bool Or_unknown.t - -> my_depth:Depth_variable.t + -> my_depth:Variable.t -> 'a) -> 'a @@ -474,7 +474,7 @@ end and Function_params_and_body : sig -> body1:Expr.t -> body2:Expr.t -> my_closure:Variable.t - -> my_depth:Depth_variable.t + -> my_depth:Variable.t -> 'a) -> 'a diff --git a/middle_end/flambda/terms/flambda_unit.ml b/middle_end/flambda/terms/flambda_unit.ml index f693af52efb2..4d8134538903 100644 --- a/middle_end/flambda/terms/flambda_unit.ml +++ b/middle_end/flambda/terms/flambda_unit.ml @@ -124,7 +124,7 @@ module Iter = struct match bindable_let_bound with | Symbols { bound_symbols; _ } -> static_consts f_c f_s bound_symbols consts - | Singleton _ | Set_of_closures _ | Depth _ -> + | Singleton _ | Set_of_closures _ -> Misc.fatal_errorf "[Static_const] can only be bound to [Symbols]:@ %a" Let.print let_expr diff --git a/middle_end/flambda/terms/function_params_and_body.rec.ml b/middle_end/flambda/terms/function_params_and_body.rec.ml index f577b6260ffa..d59755f0e10d 100644 --- a/middle_end/flambda/terms/function_params_and_body.rec.ml +++ b/middle_end/flambda/terms/function_params_and_body.rec.ml @@ -25,7 +25,7 @@ module T2 = Name_abstraction.Make (Bindable_continuation) (T1) (* CR lmaurer: It would be good to avoid the extra abstraction when a function is known to be non-recursive. Maybe we should flatten all of these into one big [Bindable]? *) -module A = Name_abstraction.Make (Bindable_depth_variable) (T2) +module A = Name_abstraction.Make (Bindable_variable_in_terms) (T2) type t = { abst : A.t; @@ -89,14 +89,15 @@ let print_with_cache ~cache ppf t = fprintf ppf "@[(@<0>%s@<1>\u{03bb}@<0>%s@[\ @<1>\u{3008}%a@<1>\u{3009}@<1>\u{300a}%a@<1>\u{300b}\ - %a %a %a @<0>%s.@<0>%s@]@ %a))@]" + %a %a @<0>%s%a @<0>%s.@<0>%s@]@ %a))@]" (Flambda_colours.lambda ()) (Flambda_colours.normal ()) Continuation.print return_continuation Exn_continuation.print exn_continuation Kinded_parameter.List.print params Kinded_parameter.print my_closure - Bindable_depth_variable.print my_depth + (Flambda_colours.depth_variable ()) + Bindable_variable_in_terms.print my_depth (Flambda_colours.elide ()) (Flambda_colours.normal ()) (Expr.print_with_cache ~cache) body) diff --git a/middle_end/flambda/terms/function_params_and_body.rec.mli b/middle_end/flambda/terms/function_params_and_body.rec.mli index 1f27a10a8e75..7b6dadb8311c 100644 --- a/middle_end/flambda/terms/function_params_and_body.rec.mli +++ b/middle_end/flambda/terms/function_params_and_body.rec.mli @@ -42,7 +42,7 @@ val create -> body:Expr.t -> free_names_of_body:Name_occurrences.t Or_unknown.t -> my_closure:Variable.t - -> my_depth:Depth_variable.t + -> my_depth:Variable.t -> t (** Choose a member of the alpha-equivalence class to enable examination @@ -61,7 +61,7 @@ val pattern_match -> body:Expr.t -> my_closure:Variable.t -> is_my_closure_used:bool Or_unknown.t - -> my_depth:Depth_variable.t + -> my_depth:Variable.t -> 'a) -> 'a @@ -83,7 +83,7 @@ val pattern_match_pair -> body1:Expr.t -> body2:Expr.t -> my_closure:Variable.t - -> my_depth:Depth_variable.t + -> my_depth:Variable.t -> 'a) -> 'a diff --git a/middle_end/flambda/terms/let_expr.rec.ml b/middle_end/flambda/terms/let_expr.rec.ml index eb486f5a3c12..e3559a3ff9be 100644 --- a/middle_end/flambda/terms/let_expr.rec.ml +++ b/middle_end/flambda/terms/let_expr.rec.ml @@ -192,7 +192,7 @@ let flatten_for_printing t = (Named.must_be_static_consts t.defining_expr) in Some (flattened, body) - | Singleton _ | Set_of_closures _ | Depth _ -> None) + | Singleton _ | Set_of_closures _ -> None) let print_closure_binding ppf (closure_id, sym) = Format.fprintf ppf "@[%a @<0>%s\u{21a4}@<0>%s %a@]" @@ -302,10 +302,14 @@ let print_let_symbol_with_cache ~cache ppf t = let print_with_cache ~cache ppf ({ name_abstraction = _; defining_expr; } as t) = - let let_bound_var_colour bindable_let_bound = + let let_bound_var_colour bindable_let_bound defining_expr = let name_mode = Bindable_let_bound.name_mode bindable_let_bound in if Name_mode.is_phantom name_mode then Flambda_colours.elide () - else Flambda_colours.variable () + else match (defining_expr : Named.t) with + | Rec_info _ -> + Flambda_colours.depth_variable () + | Simple _ | Prim _ | Set_of_closures _ | Static_consts _ -> + Flambda_colours.variable () in let rec let_body (expr : Expr.t) = match Expr.descr expr with @@ -313,10 +317,10 @@ let print_with_cache ~cache ppf pattern_match t ~f:(fun (bindable_let_bound : Bindable_let_bound.t) ~body -> match bindable_let_bound with - | Singleton _ | Set_of_closures _ | Depth _ -> + | Singleton _ | Set_of_closures _ -> fprintf ppf "@ @[@<0>%s%a@<0>%s =@<0>%s@ %a@]" - (let_bound_var_colour bindable_let_bound) + (let_bound_var_colour bindable_let_bound defining_expr) Bindable_let_bound.print bindable_let_bound (Flambda_colours.elide ()) (Flambda_colours.normal ()) @@ -328,12 +332,12 @@ let print_with_cache ~cache ppf pattern_match t ~f:(fun (bindable_let_bound : Bindable_let_bound.t) ~body -> match bindable_let_bound with | Symbols _ -> print_let_symbol_with_cache ~cache ppf t - | Singleton _ | Set_of_closures _ | Depth _ -> + | Singleton _ | Set_of_closures _ -> fprintf ppf "@[(@<0>%slet@<0>%s@ (@[\ @[@<0>%s%a@<0>%s =@<0>%s@ %a@]" (Flambda_colours.expr_keyword ()) (Flambda_colours.normal ()) - (let_bound_var_colour bindable_let_bound) + (let_bound_var_colour bindable_let_bound defining_expr) Bindable_let_bound.print bindable_let_bound (Flambda_colours.elide ()) (Flambda_colours.normal ()) @@ -406,13 +410,7 @@ let invariant env t = | (Simple _ | Prim _ | Set_of_closures _ | Rec_info _), Symbols _ -> Misc.fatal_errorf "Cannot bind a non-[Static_const] to [Symbols]:@ %a" print t - | Rec_info _, Depth _ -> env - | Rec_info _, Singleton _ -> - Misc.fatal_errorf "Cannot bind a [Rec_info] to non-[Depth]:@ %a" - print t - | (Simple _ | Prim _ | Set_of_closures _ | Static_consts _), Depth _ -> - Misc.fatal_errorf "Cannot bind a non-[Rec_info] to [Depth]:@ %a" - print t + | Rec_info _, Singleton _ -> env in Expr.invariant env body) diff --git a/middle_end/flambda/terms/rec_info_expr.ml b/middle_end/flambda/terms/rec_info_expr.ml index b051e1f5ad68..ebad6ce10be7 100644 --- a/middle_end/flambda/terms/rec_info_expr.ml +++ b/middle_end/flambda/terms/rec_info_expr.ml @@ -18,7 +18,7 @@ type t = | Initial - | Var of Depth_variable.t + | Var of Variable.t | Succ of t | Unroll_to of int * t @@ -35,7 +35,10 @@ let rec print ppf = function | Initial -> Format.pp_print_string ppf "0" | Var dv -> - Depth_variable.print ppf dv + Format.fprintf ppf "@<0>%s%a@<0>%s" + (Flambda_colours.depth_variable ()) + Variable.print dv + (Flambda_colours.normal ()) | Succ t -> Format.fprintf ppf "@[(succ@ %a)@]" print t | Unroll_to (unroll_depth, t) -> @@ -47,7 +50,7 @@ let rec equal t1 t2 = match t1, t2 with | Initial, Initial -> true | Var dv1, Var dv2 -> - Depth_variable.equal dv1 dv2 + Variable.equal dv1 dv2 | Succ t1, Succ t2 -> equal t1 t2 | Unroll_to (unroll_depth1, t1), Unroll_to (unroll_depth2, t2) -> @@ -58,15 +61,17 @@ let rec apply_renaming t perm = match t with | Initial -> Initial | Var dv -> - Var (Renaming.apply_depth_variable perm dv) + let new_dv = Renaming.apply_variable perm dv in + if dv == new_dv then t else Var new_dv | Succ t -> Succ (apply_renaming t perm) | Unroll_to (unroll_depth, t) -> Unroll_to (unroll_depth, apply_renaming t perm) -let rec free_names = function +let rec free_names t = + match t with | Initial -> Name_occurrences.empty - | Var dv -> Name_occurrences.singleton_depth_variable dv + | Var dv -> Name_occurrences.singleton_variable dv Name_mode.normal | Succ t | Unroll_to (_, t) -> free_names t diff --git a/middle_end/flambda/terms/rec_info_expr.mli b/middle_end/flambda/terms/rec_info_expr.mli index e61474cc89e0..84c9c31ac680 100644 --- a/middle_end/flambda/terms/rec_info_expr.mli +++ b/middle_end/flambda/terms/rec_info_expr.mli @@ -23,7 +23,8 @@ type t = | Initial (** The initial recursion depth. In user code, all occurrences have depth zero. *) - | Var of Depth_variable.t + | Var of Variable.t + (** A variable of kind [Flambda_kind.rec_info]. *) | Succ of t (** The next depth. If we inline an occurrence with depth [d], then in the inlined body, recursive references will have depth [succ d]. *) @@ -33,7 +34,7 @@ type t = point all unrolling should stop. *) val initial : t -val var : Depth_variable.t -> t +val var : Variable.t -> t val succ : t -> t val unroll_to : int -> t -> t diff --git a/middle_end/flambda/to_cmm/un_cps.ml b/middle_end/flambda/to_cmm/un_cps.ml index 86528ae8c1ec..c7cb070eb814 100644 --- a/middle_end/flambda/to_cmm/un_cps.ml +++ b/middle_end/flambda/to_cmm/un_cps.ml @@ -690,11 +690,11 @@ and let_expr env res t = ~num_normal_occurrences_of_bound_vars soc | Symbols { bound_symbols; scoping_rule; }, Static_consts consts -> let_symbol env res bound_symbols scoping_rule consts body - | Depth _, Rec_info _ -> + | Singleton _, Rec_info _ -> (* Erase *) expr env res body (* Error cases *) - | Singleton _, (Set_of_closures _ | Static_consts _ | Rec_info _) -> + | Singleton _, (Set_of_closures _ | Static_consts _) -> Misc.fatal_errorf "Singleton binding neither a simple expression nor a primitive \ application:@ %a" @@ -708,10 +708,6 @@ and let_expr env res t = Misc.fatal_errorf "Symbols binding a non-Static const:@ %a" Let.print t - | Depth _, (Simple _ | Prim _ | Set_of_closures _ | Static_consts _) -> - Misc.fatal_errorf - "Depth variable binding a non-Rec_info:@ %a" - Let.print t end end)