text stringlengths 12 786k |
|---|
let free_names t = List . fold_left ( fun free_names cont -> Name_occurrences . add_continuation free_names cont ~ has_traps : true ) Name_occurrences . empty t |
let apply_renaming t renaming = List . map ( Renaming . apply_continuation renaming ) t |
let all_ids_for_export t = List . fold_left Ids_for_export . add_continuation Ids_for_export . empty t |
let rename t = List . map Continuation . rename t |
let renaming t1 ~ guaranteed_fresh : t2 = try List . fold_left2 Renaming . add_continuation Renaming . empty t1 t2 with Invalid_argument _ -> assert ( List . compare_lengths t1 t2 <> 0 ) ; Misc . fatal_errorf " Continuation lists are of differing lengths :@ % a @ and @ % a " print t1 pri... |
type t = { return_continuation : Continuation . t ; exn_continuation : Continuation . t ; params : Bound_parameters . t ; my_closure : Variable . t ; my_depth : Variable . t } { return_continuation ; exn_continuation ; params ; my_closure ; my_depth } = Format . fprintf ppf " ... |
let create ~ return_continuation ~ exn_continuation ~ params ~ my_closure ~ my_depth = Bound_parameters . check_no_duplicates params ; ( if Flambda_features . check_invariants ( ) then let params_set = Bound_parameters . var_set params in if Variable . equal my_closure my_depth || Variable . S... |
let return_continuation t = t . return_continuation |
let exn_continuation t = t . exn_continuation |
let params t = t . params |
let my_closure t = t . my_closure |
let my_depth t = t . my_depth |
let free_names { return_continuation ; exn_continuation ; params ; my_closure ; my_depth } = let free_names = Name_occurrences . add_continuation Name_occurrences . empty return_continuation ~ has_traps : true in let free_names = Name_occurrences . add_continuation free_names exn_continuation ~ ... |
let apply_renaming { return_continuation ; exn_continuation ; params ; my_closure ; my_depth } renaming = let return_continuation = Renaming . apply_continuation renaming return_continuation in let exn_continuation = Renaming . apply_continuation renaming exn_continuation in let params = Bound_param... |
let all_ids_for_export { return_continuation ; exn_continuation ; params ; my_closure ; my_depth } = let ids = Ids_for_export . add_continuation Ids_for_export . empty return_continuation in let ids = Ids_for_export . add_continuation ids exn_continuation in let ids = Ids_for_export . union ids ... |
let rename { return_continuation ; exn_continuation ; params ; my_closure ; my_depth } = { return_continuation = Continuation . rename return_continuation ; exn_continuation = Continuation . rename exn_continuation ; params = Bound_parameters . rename params ; my_closure = Variable . re... |
let renaming { return_continuation = return_continuation1 ; exn_continuation = exn_continuation1 ; params = params1 ; my_closure = my_closure1 ; my_depth = my_depth1 } ~ guaranteed_fresh : { return_continuation = return_continuation2 ; exn_continuation = exn_continuation2 ; params = params2 ... |
type t = { param : Variable . t ; kind : Flambda_kind . With_subkind . t } type nonrec t = t let compare { param = param1 ; kind = kind1 } { param = param2 ; kind = kind2 } = let c = Variable . compare param1 param2 in if c <> 0 then c else Flambda_kind . With_subkind . compare... |
let create param kind = { param ; kind } |
let var t = t . param |
let name t = Name . var ( var t ) |
let simple t = Simple . var ( var t ) |
let kind t = t . kind |
let with_kind t kind = { t with kind } |
let rename t = { t with param = Variable . rename t . param } |
let equal_kinds t1 t2 = Flambda_kind . With_subkind . equal t1 . kind t2 . kind |
let free_names ( { param = _ ; kind = _ } as t ) = Name_occurrences . singleton_variable ( var t ) Name_mode . normal |
let apply_renaming ( { param = _ ; kind } as t ) perm = Name . pattern_match ( Renaming . apply_name perm ( name t ) ) ~ var ( : fun var -> create var kind ) ~ symbol ( : fun _ -> Misc . fatal_errorf " Illegal name permutation on [ Bound_parameter ] : % a " Renaming . ... |
let all_ids_for_export { param ; kind = _ } = Ids_for_export . add_variable Ids_for_export . empty param |
type t = BP . t list |
let print ppf t = Format . fprintf ppf " [ @< hov 0 >% a ] " @ ( Format . pp_print_list ~ pp_sep : Format . pp_print_space BP . print ) t |
let create params = ( if Flambda_features . check_invariants ( ) then let params_set = BP . Set . of_list params in if List . length params <> BP . Set . cardinal params_set then Misc . fatal_errorf " Names provided to [ Bound_parameters . create ] must be disjoint :@ % a " print para... |
let cons param t = create ( param :: t ) |
let append t1 t2 = create ( t1 @ t2 ) |
let to_list t = t |
let is_empty t = match t with [ ] -> true | _ :: _ -> false |
let same_number t1 t2 = List . compare_lengths t1 t2 = 0 |
let cardinal t = List . length t |
let vars t = List . map BP . var t |
let simples t = List . map BP . simple t |
let to_set t = Bound_parameter . Set . of_list t |
let var_set t = Variable . Set . of_list ( vars t ) |
let rename t = List . map ( fun t -> BP . rename t ) t |
let arity t = List . map ( fun t -> Flambda_kind . With_subkind . kind ( BP . kind t ) ) t |> Flambda_arity . create |
let arity_with_subkinds t = List . map ( fun t -> BP . kind t ) t |> Flambda_arity . With_subkinds . create |
let free_names t = List . fold_left ( fun result param -> Name_occurrences . union result ( BP . free_names param ) ) Name_occurrences . empty t |
let apply_renaming t perm = List . map ( fun param -> BP . apply_renaming param perm ) t |
let all_ids_for_export t = Ids_for_export . union_list ( List . map BP . all_ids_for_export t ) |
let check_no_duplicates t = if not ( Flambda_features . check_invariants ( ) ) then ( ) else let t_set = BP . Set . of_list t in if BP . Set . cardinal t_set <> List . length t then Misc . fatal_errorf " Duplicates in bound parameter list :@ % a " print t |
let renaming t1 ~ guaranteed_fresh : t2 = try List . fold_left2 ( fun renaming param1 param2 -> Renaming . add_variable renaming ( BP . var param1 ) ( BP . var param2 ) ) Renaming . empty t1 t2 with Invalid_argument _ -> assert ( List . compare_lengths t1 t2 <> 0 ) ; Misc . fatal... |
let filter f t = List . filter f t |
let exists f t = List . exists f t |
type t = | Singleton of Bound_var . t | Set_of_closures of Bound_var . t list | Static of Bound_static . t |
let [ @ ocamlformat " disable " ] print ppf t = match t with | Singleton bound_var -> Bound_var . print ppf bound_var | Set_of_closures bound_vars -> Format . fprintf ppf " [ @< hov 1 ( >% a ) ] " @ ( Format . pp_print_list ~ pp_sep : Format . pp_print_space Bound_var . print... |
let free_names t = match t with | Singleton bound_var -> Name_occurrences . singleton_variable ( Bound_var . var bound_var ) Name_mode . normal | Set_of_closures bound_vars -> List . fold_left ( fun free_names bound_var -> Name_occurrences . add_variable free_names ( Bound_var . var bound_var ... |
let rec map_sharing f l0 = match l0 with | a :: l -> let a ' = f a in let l ' = map_sharing f l in if a ' == a && l ' == l then l0 else a ' :: l ' | [ ] -> [ ] |
let apply_renaming t renaming = match t with | Singleton bound_var -> let bound_var ' = Bound_var . apply_renaming bound_var renaming in if bound_var == bound_var ' then t else Singleton bound_var ' | Set_of_closures bound_vars -> let bound_vars ' = map_sharing ( fun bound_var -> Bound_var . appl... |
let all_ids_for_export t = match t with | Singleton bound_var -> Bound_var . all_ids_for_export bound_var | Set_of_closures bound_vars -> List . fold_left ( fun ids bound_var -> Ids_for_export . union ids ( Bound_var . all_ids_for_export bound_var ) ) Ids_for_export . empty bound_vars | Static ... |
let rename t = match t with | Singleton bound_var -> Singleton ( Bound_var . rename bound_var ) | Set_of_closures bound_vars -> let bound_vars = List . map ( fun bound_var -> Bound_var . rename bound_var ) bound_vars in Set_of_closures bound_vars | Static _ -> t |
let renaming t1 ~ guaranteed_fresh : t2 = match t1 , t2 with | Singleton bound_var1 , Singleton bound_var2 -> Renaming . add_fresh_variable Renaming . empty ( Bound_var . var bound_var1 ) ~ guaranteed_fresh ( : Bound_var . var bound_var2 ) | Set_of_closures bound_vars1 , Set_of_closures bo... |
let singleton var = Singleton var |
let set_of_closures bound_vars = let name_mode = List . fold_left ( fun name_mode bound_var -> let next_name_mode = Bound_var . name_mode bound_var in match name_mode with | None -> Some next_name_mode | Some name_mode -> if not ( Name_mode . equal name_mode next_name_mode ) then Misc . fatal_erro... |
let static bound_static = Static bound_static |
let name_mode t = match t with | Singleton bound_var | Set_of_closures ( bound_var :: _ ) -> Bound_var . name_mode bound_var | Set_of_closures [ ] -> assert false | Static _ -> Name_mode . normal |
let with_name_mode t name_mode = match t with | Singleton bound_var -> Singleton ( Bound_var . with_name_mode bound_var name_mode ) | Set_of_closures bound_vars -> Set_of_closures ( List . map ( fun bound_var -> Bound_var . with_name_mode bound_var name_mode ) bound_vars ) | Static _ -> t |
let must_be_singleton t = match t with | Singleton bound_var -> bound_var | Set_of_closures _ | Static _ -> Misc . fatal_errorf " Bound pattern is not [ Singleton ] :@ % a " print t |
let must_be_singleton_opt t = match t with | Singleton bound_var -> Some bound_var | Set_of_closures _ | Static _ -> None |
let must_be_set_of_closures t = match t with | Set_of_closures bound_vars -> bound_vars | Singleton _ | Static _ -> Misc . fatal_errorf " Bound pattern is not [ Set_of_closures ] :@ % a " print t |
let must_be_static t = match t with | Static bound_static -> bound_static | Singleton _ | Set_of_closures _ -> Misc . fatal_errorf " Bound pattern is not [ Static ] :@ % a " print t |
let may_be_static t = match t with | Static bound_static -> Some bound_static | Singleton _ | Set_of_closures _ -> None |
let exists_all_bound_vars t ~ f = match t with | Singleton var -> f var | Set_of_closures bound_vars -> ListLabels . exists bound_vars ~ f | Static _ -> false |
let fold_all_bound_vars t ~ init ~ f = match t with | Singleton bound_var -> f init bound_var | Set_of_closures bound_vars -> ListLabels . fold_left bound_vars ~ init ~ f | Static _ -> init |
let fold_all_bound_names t ~ init ~ var ~ symbol ~ code_id = match t with | Singleton bound_var -> var init bound_var | Set_of_closures bound_vars -> ListLabels . fold_left bound_vars ~ init ~ f : var | Static bound_static -> Code_id . Set . fold ( fun cid acc -> code_id acc cid ) ( Bound_sta... |
module Pattern = struct type t = | Code of Code_id . t | Set_of_closures of Symbol . t Function_slot . Lmap . t | Block_like of Symbol . t let code code_id = Code code_id let set_of_closures closure_symbols = Set_of_closures closure_symbols let block_like symbol = Block_like symbol let [ @ ocamlfor... |
type t = Pattern . t list |
let check_pattern_list_invariant pattern_list = let everything_being_defined = List . map Pattern . everything_being_defined_as_list pattern_list |> List . concat in let everything_being_defined_as_set = Code_id_or_symbol . Set . of_list everything_being_defined in if List . compare_length_with everythi... |
let create pattern_list = if Flambda_features . check_invariants ( ) then check_pattern_list_invariant pattern_list ; pattern_list |
let singleton pattern = [ pattern ] |
let to_list t = t |
let [ @ ocamlformat " disable " ] print ppf t = Format . fprintf ppf " [ @< hov 1 ( >% a ) ] " @ ( Format . pp_print_list ~ pp_sep : Format . pp_print_space Pattern . print ) t |
let symbols_being_defined t = List . map Pattern . symbols_being_defined t |> Symbol . Set . union_list |
let code_being_defined t = List . fold_left ( fun code_ids pattern -> Code_id . Set . union code_ids ( Pattern . code_being_defined pattern ) ) Code_id . Set . empty t |
let binds_code t = List . exists Pattern . binds_code t |
let binds_symbols t = List . exists Pattern . binds_symbols t |
let everything_being_defined t = List . map Pattern . everything_being_defined t |> Code_id_or_symbol . Set . union_list |
let apply_renaming t perm = List . map ( fun pattern -> Pattern . apply_renaming pattern perm ) t |
let free_names t = List . map Pattern . free_names t |> Name_occurrences . union_list |
let all_ids_for_export t = List . map Pattern . all_ids_for_export t |> Ids_for_export . union_list |
let concat t1 t2 = t1 @ t2 |
let gc_roots t = List . map Pattern . gc_roots t |> List . concat |
type t = { var : Variable . t ; name_mode : Name_mode . t } |
let [ @ ocamlformat " disable " ] print ppf { var ; name_mode ; } = match name_mode with | Normal -> Variable . print ppf var | In_types -> assert false | Phantom -> Variable . print ppf var |
let create var name_mode = { var ; name_mode } |
let var t = t . var |
let name_mode t = t . name_mode |
let with_var t var = { t with var } |
let with_name_mode t name_mode = { t with name_mode } |
let rename t = with_var t ( Variable . rename t . var ) |
let apply_renaming t perm = with_var t ( Renaming . apply_variable perm t . var ) |
let free_names t = Name_occurrences . singleton_variable t . var t . name_mode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.