text stringlengths 12 786k |
|---|
type code_id = string located |
type function_slot = string located |
type value_slot = string located |
type compilation_unit = { ident : string ; linkage_name : string option } |
type symbol = ( compilation_unit option * string ) located |
type special_continuation = | Done | Error |
type continuation = | Named of continuation_id | Special of special_continuation |
type result_continuation = | Return of continuation | Never_returns |
type continuation_sort = | Normal | Exn | Define_root_symbol |
type const = | Naked_immediate of immediate | Tagged_immediate of immediate | Naked_float of float | Naked_int32 of int32 | Naked_int64 of int64 | Naked_nativeint of targetint |
type field_of_block = | Symbol of symbol | Tagged_immediate of immediate | Dynamically_computed of variable |
type is_recursive = | Nonrecursive | Recursive |
type mutability = Mutability . t = | Mutable | Immutable | Immutable_unique |
type ' a or_variable = | Const of ' a | Var of variable |
type static_data = | Block of { tag : tag_scannable ; mutability : mutability ; elements : field_of_block list } | Boxed_float of float or_variable | Boxed_int32 of int32 or_variable | Boxed_int64 of int64 or_variable | Boxed_nativeint of targetint or_variable | Immutable_float_block of float or_varia... |
type naked_number_kind = Flambda_kind . Naked_number_kind . t = | Naked_immediate | Naked_float | Naked_int32 | Naked_int64 | Naked_nativeint |
type kind = | Value | Naked_number of naked_number_kind | Region | Rec_info |
type kind_with_subkind = | Any_value | Block of { tag : Tag . t ; fields : kind_with_subkind list } | Float_block of { num_fields : int } | Naked_number of naked_number_kind | Boxed_float | Boxed_int32 | Boxed_int64 | Boxed_nativeint | Tagged_immediate | Rec_info | Float_array | Immediate_ar... |
type static_data_binding = { symbol : symbol ; defining_expr : static_data } |
type raise_kind = Trap_action . Raise_kind . t = | Regular | Reraise | No_trace |
type trap_action = | Push of { exn_handler : continuation } | Pop of { exn_handler : continuation ; raise_kind : raise_kind option } |
type rec_info = | Depth of int | Infinity | Do_not_inline | Var of variable | Succ of rec_info | Unroll of int * rec_info |
type coercion = | Id | Change_depth of { from : rec_info ; to_ : rec_info } |
type kinded_parameter = { param : variable ; kind : kind_with_subkind option } |
type name = | Var of variable | Symbol of symbol |
type simple = | Var of variable | Symbol of symbol | Const of const | Coerce of simple * coercion |
type array_kind = Flambda_primitive . Array_kind . t = | Immediates | Values | Naked_floats |
type box_kind = Flambda_kind . Boxable_number . t = | Naked_float | Naked_int32 | Naked_int64 | Naked_nativeint |
type generic_array_specialisation = | No_specialisation | Full_of_naked_floats | Full_of_immediates | Full_of_arbitrary_values_but_not_floats |
type block_access_field_kind = Flambda_primitive . Block_access_field_kind . t = | Any_value | Immediate |
type block_access_kind = | Values of { tag : tag_scannable option ; size : targetint option ; field_kind : block_access_field_kind } | Naked_floats of { size : targetint option } |
type standard_int = Flambda_kind . Standard_int . t = | Tagged_immediate | Naked_immediate | Naked_int32 | Naked_int64 | Naked_nativeint |
type standard_int_or_float = Flambda_kind . Standard_int_or_float . t = | Tagged_immediate | Naked_immediate | Naked_float | Naked_int32 | Naked_int64 | Naked_nativeint |
type string_or_bytes = Flambda_primitive . string_or_bytes = | String | Bytes |
type init_or_assign = Flambda_primitive . Init_or_assign . t = | Initialization | Assignment of Alloc_mode . t |
type comparison = Flambda_primitive . comparison = | Eq | Neq | Lt | Gt | Le | Ge |
type ordered_comparison = Flambda_primitive . ordered_comparison = | Lt | Gt | Le | Ge |
type equality_comparison = Flambda_primitive . equality_comparison = | Eq | Neq |
type signed_or_unsigned = Flambda_primitive . signed_or_unsigned = | Signed | Unsigned |
type unop = | Array_length | Box_number of box_kind | Get_tag | Is_int | Num_conv of { src : standard_int_or_float ; dst : standard_int_or_float } | Opaque_identity | Project_value_slot of { project_from : function_slot ; value_slot : value_slot } | Project_function_slot of { move_from : fun... |
type ' a comparison_behaviour = ' a Flambda_primitive . comparison_behaviour = | Yielding_bool of ' a | Yielding_int_like_compare_functions |
type binary_int_arith_op = Flambda_primitive . binary_int_arith_op = | Add | Sub | Mul | Div | Mod | And | Or | Xor |
type int_shift_op = Flambda_primitive . int_shift_op = | Lsl | Lsr | Asr |
type binary_float_arith_op = Flambda_primitive . binary_float_arith_op = | Add | Sub | Mul | Div |
type infix_binop = | Int_arith of binary_int_arith_op | Int_shift of int_shift_op | Int_comp of ordered_comparison comparison_behaviour | Float_arith of binary_float_arith_op | Float_comp of comparison comparison_behaviour |
type binop = | Array_load of array_kind * mutability | Block_load of block_access_kind * mutability | Phys_equal of kind option * equality_comparison | Int_arith of standard_int * binary_int_arith_op | Int_comp of standard_int * signed_or_unsigned * ordered_comparison comparison_behaviour | Int_shift of st... |
type ternop = Array_set of array_kind * init_or_assign |
type varop = Make_block of tag_scannable * mutability |
type prim = | Unary of unop * simple | Binary of binop * simple * simple | Ternary of ternop * simple * simple * simple | Variadic of varop * simple list |
type arity = kind_with_subkind list |
type function_call = | Direct of { code_id : code_id ; function_slot : function_slot option } | Indirect |
type method_kind = | Self | Public | Cached |
type call_kind = | Function of function_call | C_call of { alloc : bool } |
type function_arities = { params_arity : arity option ; ret_arity : arity } |
type inline_attribute = Inline_attribute . t = | Always_inline | Available_inline | Never_inline | Unroll of int | Default_inline |
type inlined_attribute = Inlined_attribute . t = | Always_inlined | Hint_inlined | Never_inlined | Unroll of int | Default_inlined |
type inlining_state = { depth : int } |
type apply = { func : name ; continuation : result_continuation ; exn_continuation : continuation ; args : simple list ; call_kind : call_kind ; arities : function_arities option ; inlined : inlined_attribute option ; inlining_state : inlining_state option } |
type apply_cont = { cont : continuation ; trap_action : trap_action option ; args : simple list } |
type expr = | Let of let_ | Let_cont of let_cont | Let_symbol of let_symbol | Apply of apply | Apply_cont of apply_cont | Switch of { scrutinee : simple ; cases : ( int * apply_cont ) list } | Invalid of { message : string } { var : value_slot ; value : simple } { bindings : let_bin... |
type flambda_unit = { body : expr } |
type expect_test_spec = { before : flambda_unit ; after : flambda_unit } |
type markdown_node = | Text of string | Expect of expect_test_spec |
type markdown_doc = markdown_node list |
let map_accum_left f env l = let next ( acc , env ) x = let y , env = f env x in y :: acc , env in let acc , env = List . fold_left next ( [ ] , env ) l in List . rev acc , env |
module C = struct type t = string let compare = String . compare end |
module CM = Map . Make ( C ) |
module V = struct type t = string let compare = String . compare end |
module VM = Map . Make ( V ) |
module S = struct type t = string let compare = String . compare end |
module SM = Map . Make ( S ) |
module D = struct type t = string let compare = String . compare end |
module DM = Map . Make ( D ) |
module U = struct type t = string let equal = String . equal let hash = Hashtbl . hash end |
module UT = Hashtbl . Make ( U ) |
module W = struct type t = string let equal = String . equal let hash = Hashtbl . hash end |
module WT = Hashtbl . Make ( W ) |
type env = { done_continuation : Continuation . t ; error_continuation : Exn_continuation . t ; continuations : ( Continuation . t * int ) CM . t ; exn_continuations : Exn_continuation . t CM . t ; variables : Variable . t VM . t ; symbols : Symbol . t SM . t ; code_ids : ... |
let init_env ( ) = let done_continuation = Continuation . create ~ sort : Toplevel_return ~ name " : done " ( ) in let exn_handler = Continuation . create ~ name " : error " ( ) in let error_continuation = Exn_continuation . create ~ exn_handler ~ extra_args [ ] : in { done_... |
let enter_code env = { continuations = CM . empty ; exn_continuations = CM . empty ; variables = env . variables ; done_continuation = env . done_continuation ; error_continuation = env . error_continuation ; symbols = env . symbols ; code_ids = env . code_ids ; function_slots = e... |
let fresh_cont env { Fexpr . txt = name ; loc = _ } ~ sort ~ arity = let c = Continuation . create ~ sort ~ name ( ) in c , { env with continuations = CM . add name ( c , arity ) env . continuations } |
let fresh_exn_cont env { Fexpr . txt = name ; loc = _ } = let c = Continuation . create ~ name ( ) in let e = Exn_continuation . create ~ exn_handler : c ~ extra_args [ ] : in ( e , { env with continuations = CM . add name ( c , 1 ) env . continuations ; exn_continuati... |
let fresh_var env { Fexpr . txt = name ; loc = _ } = let v = Variable . create name ~ user_visible ( ) : in v , { env with variables = VM . add name v env . variables } |
let fresh_code_id env { Fexpr . txt = name ; loc = _ } = let c = Code_id . create ~ name ( Compilation_unit . get_current_exn ( ) ) in c , { env with code_ids = DM . add name c env . code_ids } |
let fresh_function_slot env { Fexpr . txt = name ; loc = _ } = let c = Function_slot . create ( Compilation_unit . get_current_exn ( ) ) ~ name in UT . add env . function_slots name c ; c |
let fresh_or_existing_function_slot env ( { Fexpr . txt = name ; loc = _ } as id ) = match UT . find_opt env . function_slots name with | None -> fresh_function_slot env id | Some function_slot -> function_slot |
let fresh_value_slot env { Fexpr . txt = name ; loc = _ } = let c = Value_slot . create ( Compilation_unit . get_current_exn ( ) ) ~ name in WT . add env . vars_within_closures name c ; c |
let fresh_or_existing_value_slot env ( { Fexpr . txt = name ; _ } as id ) = match WT . find_opt env . vars_within_closures name with | None -> fresh_value_slot env id | Some value_slot -> value_slot |
let print_scoped_location ppf loc = match ( loc : Lambda . scoped_location ) with | Loc_unknown -> Format . pp_print_string ppf " Unknown " | Loc_known { loc ; _ } -> Location . print_loc ppf loc |
let declare_symbol ( env : env ) ( { Fexpr . txt = cu , name ; loc } as symbol ) = if Option . is_some cu then Misc . fatal_errorf " Cannot declare non - local symbol % a : % a " Print_fexpr . symbol symbol print_scoped_location loc else if SM . mem name env . symbols then Misc . ... |
let find_with ~ descr ~ find map { Fexpr . txt = name ; loc } = match find name map with | None -> Misc . fatal_errorf " Unbound % s % s : % a " descr name print_scoped_location loc | Some a -> a |
let get_symbol ( env : env ) sym = match sym with | { Fexpr . txt = Some cunit , name ; loc = _ } -> let cunit = let { Fexpr . ident ; linkage_name } = cunit in Compilation_unit . create ~ name : ident ( Linkage_name . create ( linkage_name |> Option . value ~ default : ide... |
let find_cont_id env c = find_with ~ descr " : continuation id " ~ find : CM . find_opt env . continuations c |
let find_cont env ( c : Fexpr . continuation ) = match c with | Special Done -> env . done_continuation , 1 | Special Error -> Exn_continuation . exn_handler env . error_continuation , 1 | Named cont_id -> find_cont_id env cont_id |
let find_result_cont env ( c : Fexpr . result_continuation ) : Apply_expr . Result_continuation . t = match c with | Return c -> Return ( fst ( find_cont env c ) ) | Never_returns -> Never_returns |
let find_exn_cont_id env c = find_with ~ descr " : exn_continuation " ~ find : CM . find_opt env . exn_continuations c |
let find_exn_cont env ( c : Fexpr . continuation ) = match c with | Special Done -> Misc . fatal_error " done is not an exception continuation " | Special Error -> env . error_continuation | Named cont_id -> find_exn_cont_id env cont_id |
let find_var env v = find_with ~ descr " : variable " ~ find : VM . find_opt env . variables v |
let find_code_id env code_id = find_with ~ descr " : code id " ~ find : DM . find_opt env . code_ids code_id |
let targetint ( i : Fexpr . targetint ) : Targetint_32_64 . t = Targetint_32_64 . of_int64 i |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.