Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekdohibs committed May 27, 2024
1 parent cd9cdac commit 4136c50
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion middle_end/flambda2/to_cmm/to_cmm.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
9 changes: 6 additions & 3 deletions middle_end/flambda2/to_cmm/to_cmm_expr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions middle_end/flambda2/to_cmm/to_cmm_shared.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@ 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
| Skip_param -> None
| 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
Expand Down
4 changes: 2 additions & 2 deletions middle_end/flambda2/to_cmm/to_cmm_shared.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4136c50

Please sign in to comment.