diff --git a/middle_end/flambda2/to_cmm/to_cmm.ml b/middle_end/flambda2/to_cmm/to_cmm.ml index 7c3647e11e6..8c364f7dfd7 100644 --- a/middle_end/flambda2/to_cmm/to_cmm.ml +++ b/middle_end/flambda2/to_cmm/to_cmm.ml @@ -115,7 +115,7 @@ let unit0 ~offsets ~all_code ~reachable_names flambda_unit = C.create_ccatch ~rec_flag:false ~body ~handlers: [ C.handler ~dbg return_cont - (C.actual_params return_cont_params) + (C.remove_skipped_params return_cont_params) unit_value false ] in let body = diff --git a/middle_end/flambda2/to_cmm/to_cmm_expr.ml b/middle_end/flambda2/to_cmm/to_cmm_expr.ml index e29c29b0587..21fdb37d6d3 100644 --- a/middle_end/flambda2/to_cmm/to_cmm_expr.ml +++ b/middle_end/flambda2/to_cmm/to_cmm_expr.ml @@ -401,7 +401,7 @@ let translate_jump_to_continuation ~dbg_with_inlined:dbg env res apply types let cont = Env.get_cmm_continuation env exn_handler in [Cmm.Push cont] in - let args = C.actual_args args types in + let args = C.remove_skipped_args args types in let args, free_vars, env, res, _ = C.simple_list ~dbg env res args in let wrap, _, res = Env.flush_delayed_lets ~mode:Branching_point env res in let cmm, free_vars = wrap (C.cexit cont args trap_actions) free_vars in @@ -646,7 +646,9 @@ and let_cont_not_inlined env res k handler body = in ( C.create_ccatch ~rec_flag:false ~body ~handlers: - [C.handler ~dbg catch_id (C.actual_params vars) handler is_cold], + [ C.handler ~dbg catch_id + (C.remove_skipped_params vars) + handler is_cold ], free_vars, res ) in @@ -775,7 +777,8 @@ and let_cont_rec env res invariant_params conts body = (C.remove_vars_with_machtype free_vars_of_handler vars) in let id = Env.get_cmm_continuation env k in - ( C.handler ~dbg id (C.actual_params vars) handler false :: handlers, + ( C.handler ~dbg id (C.remove_skipped_params vars) handler false + :: handlers, free_vars )) conts_to_handlers ([], free_vars_of_body) in diff --git a/middle_end/flambda2/to_cmm/to_cmm_shared.ml b/middle_end/flambda2/to_cmm/to_cmm_shared.ml index 81f5dc6b4d4..855b7f62c76 100644 --- a/middle_end/flambda2/to_cmm/to_cmm_shared.ml +++ b/middle_end/flambda2/to_cmm/to_cmm_shared.ml @@ -16,7 +16,7 @@ open! Cmm_helpers open! Cmm_builtins module Ece = Effects_and_coeffects -let actual_params params_with_types = +let remove_skipped_params params_with_types = List.filter_map (fun (v, param_type) -> match (param_type : Cmm.machtype To_cmm_env.param_type) with @@ -24,13 +24,14 @@ let actual_params params_with_types = | Param machtype -> Some (v, machtype)) params_with_types -let rec actual_args args param_types = +let rec remove_skipped_args args param_types = match args, (param_types : _ To_cmm_env.param_type list) with | [], [] -> [] - | _ :: r, Skip_param :: r' -> actual_args r r' - | arg :: r, Param _ :: r' -> arg :: actual_args r r' + | _ :: r, Skip_param :: r' -> remove_skipped_args r r' + | arg :: r, Param _ :: r' -> arg :: remove_skipped_args r r' | _ :: _, [] | [], _ :: _ -> - Misc.fatal_errorf "Mismatched list sizes in To_cmm_shared.actual_args" + Misc.fatal_errorf + "Mismatched list sizes in To_cmm_shared.remove_skipped_args" let remove_var_with_provenance free_vars var = let v = Backend_var.With_provenance.var var in diff --git a/middle_end/flambda2/to_cmm/to_cmm_shared.mli b/middle_end/flambda2/to_cmm/to_cmm_shared.mli index 60997ddfe42..bb35f910673 100644 --- a/middle_end/flambda2/to_cmm/to_cmm_shared.mli +++ b/middle_end/flambda2/to_cmm/to_cmm_shared.mli @@ -16,11 +16,11 @@ this module, unlike the ones in [Cmm_helpers], depend on Flambda 2 data types. *) -val actual_params : +val remove_skipped_params : (Backend_var.With_provenance.t * Cmm.machtype To_cmm_env.param_type) list -> (Backend_var.With_provenance.t * Cmm.machtype) list -val actual_args : 'a list -> _ To_cmm_env.param_type list -> 'a list +val remove_skipped_args : 'a list -> _ To_cmm_env.param_type list -> 'a list val remove_var_with_provenance : To_cmm_env.free_vars -> Backend_var.With_provenance.t -> To_cmm_env.free_vars