text stringlengths 0 601k |
|---|
let udivmod n d = Nativeint . ( if d < 0n then if ucompare n d < 0 then ( 0n , n ) else ( 1n , sub n d ) else begin let q = shift_left ( div ( shift_right_logical n 1 ) d ) 1 in let r = sub n ( mul q d ) in if ucompare r d >= 0 then ( succ q , sub r d ) else ( q , r ) end ) |
let divimm_parameters d = Nativeint . ( assert ( d > 0n ) ; let twopsm1 = min_int in let nc = sub ( pred twopsm1 ) ( snd ( udivmod twopsm1 d ) ) in let rec loop p ( q1 , r1 ) ( q2 , r2 ) = let p = p + 1 in let q1 = shift_left q1 1 and r1 = shift_left r1 1 in let ( q1 , r1 ) = if ucompare r1 nc >= 0 then ( succ q1 , sub... |
let raise_symbol dbg symb = Cop ( Craise Lambda . Raise_regular , [ Cconst_symbol ( symb , dbg ) ] , dbg ) |
let rec div_int c1 c2 is_safe dbg = match ( c1 , c2 ) with ( c1 , Cconst_int ( 0 , _ ) ) -> Csequence ( c1 , raise_symbol dbg " caml_exn_Division_by_zero " ) | ( c1 , Cconst_int ( 1 , _ ) ) -> c1 | ( Cconst_int ( n1 , _ ) , Cconst_int ( n2 , _ ) ) -> Cconst_int ( n1 / n2 , dbg ) | ( c1 , Cconst_int ( n , _ ) ) when n <... |
let mod_int c1 c2 is_safe dbg = match ( c1 , c2 ) with ( c1 , Cconst_int ( 0 , _ ) ) -> Csequence ( c1 , raise_symbol dbg " caml_exn_Division_by_zero " ) | ( c1 , Cconst_int ( ( 1 | ( - 1 ) ) , _ ) ) -> Csequence ( c1 , Cconst_int ( 0 , dbg ) ) | ( Cconst_int ( n1 , _ ) , Cconst_int ( n2 , _ ) ) -> Cconst_int ( n1 mod ... |
let is_different_from x = function Cconst_int ( n , _ ) -> n <> x | Cconst_natint ( n , _ ) -> n <> Nativeint . of_int x | _ -> false |
let safe_divmod_bi mkop is_safe mkm1 c1 c2 bi dbg = bind " divisor " c2 ( fun c2 -> bind " dividend " c1 ( fun c1 -> let c = mkop c1 c2 is_safe dbg in if Arch . division_crashes_on_overflow && ( size_int = 4 || bi <> Primitive . Pint32 ) && not ( is_different_from ( - 1 ) c2 ) then Cifthenelse ( Cop ( Ccmpi Cne , [ c2 ... |
let safe_div_bi is_safe = safe_divmod_bi div_int is_safe ( fun c1 dbg -> Cop ( Csubi , [ Cconst_int ( 0 , dbg ) ; c1 ] , dbg ) ) |
let safe_mod_bi is_safe = safe_divmod_bi mod_int is_safe ( fun _ dbg -> Cconst_int ( 0 , dbg ) ) |
let test_bool dbg cmm = match cmm with | Cop ( Caddi , [ Cop ( Clsl , [ c ; Cconst_int ( 1 , _ ) ] , _ ) ; Cconst_int ( 1 , _ ) ] , _ ) -> c | Cconst_int ( n , dbg ) -> if n = 1 then Cconst_int ( 0 , dbg ) else Cconst_int ( 1 , dbg ) | c -> Cop ( Ccmpi Cne , [ c ; Cconst_int ( 1 , dbg ) ] , dbg ) |
let box_float dbg m c = Cop ( Calloc m , [ alloc_float_header m dbg ; c ] , dbg ) |
let unbox_float dbg = map_tail ( function | Cop ( Calloc _ , [ Cconst_natint ( hdr , _ ) ; c ] , _ ) when Nativeint . equal hdr float_header -> c | Cconst_symbol ( s , _dbg ) as cmm -> begin match Cmmgen_state . structured_constant_of_sym s with | Some ( Uconst_float x ) -> Cconst_float ( x , dbg ) | _ -> Cop ( Cload (... |
let box_complex dbg c_re c_im = Cop ( Calloc Lambda . alloc_heap , [ alloc_floatarray_header 2 dbg ; c_re ; c_im ] , dbg ) |
let complex_re c dbg = Cop ( Cload ( Double , Immutable ) , [ c ] , dbg ) |
let complex_im c dbg = Cop ( Cload ( Double , Immutable ) , [ Cop ( Cadda , [ c ; Cconst_int ( size_float , dbg ) ] , dbg ) ] , dbg ) |
let return_unit dbg c = Csequence ( c , Cconst_int ( 1 , dbg ) ) |
let rec remove_unit = function Cconst_int ( 1 , _ ) -> Ctuple [ ] | Csequence ( c , Cconst_int ( 1 , _ ) ) -> c | Csequence ( c1 , c2 ) -> Csequence ( c1 , remove_unit c2 ) | Cifthenelse ( cond , ifso_dbg , ifso , ifnot_dbg , ifnot , dbg ) -> Cifthenelse ( cond , ifso_dbg , remove_unit ifso , ifnot_dbg , remove_unit if... |
let field_address ptr n dbg = if n = 0 then ptr else Cop ( Cadda , [ ptr ; Cconst_int ( n * size_addr , dbg ) ] , dbg ) |
let get_field_gen mut ptr n dbg = Cop ( Cload ( Word_val , mut ) , [ field_address ptr n dbg ] , dbg ) |
let set_field ptr n newval init dbg = Cop ( Cstore ( Word_val , init ) , [ field_address ptr n dbg ; newval ] , dbg ) |
let non_profinfo_mask = if Config . profinfo then ( 1 lsl ( 64 - Config . profinfo_width ) ) - 1 else 0 |
let get_header ptr dbg = Cop ( Cload ( Word_int , Mutable ) , [ Cop ( Cadda , [ ptr ; Cconst_int ( - size_int , dbg ) ] , dbg ) ] , dbg ) |
let get_header_without_profinfo ptr dbg = if Config . profinfo then Cop ( Cand , [ get_header ptr dbg ; Cconst_int ( non_profinfo_mask , dbg ) ] , dbg ) else get_header ptr dbg |
let tag_offset = if big_endian then - 1 else - size_int |
let get_tag ptr dbg = if Proc . word_addressed then Cop ( Cand , [ get_header ptr dbg ; Cconst_int ( 255 , dbg ) ] , dbg ) else Cop ( Cload ( Byte_unsigned , Mutable ) , [ Cop ( Cadda , [ ptr ; Cconst_int ( tag_offset , dbg ) ] , dbg ) ] , dbg ) |
let get_size ptr dbg = Cop ( Clsr , [ get_header_without_profinfo ptr dbg ; Cconst_int ( 10 , dbg ) ] , dbg ) |
let log2_size_addr = Misc . log2 size_addr |
let log2_size_float = Misc . log2 size_float |
let numfloat_shift = 9 + log2_size_float - log2_size_addr |
let is_addr_array_hdr hdr dbg = Cop ( Ccmpi Cne , [ Cop ( Cand , [ hdr ; Cconst_int ( 255 , dbg ) ] , dbg ) ; floatarray_tag dbg ] , dbg ) |
let is_addr_array_ptr ptr dbg = Cop ( Ccmpi Cne , [ get_tag ptr dbg ; floatarray_tag dbg ] , dbg ) |
let addr_array_length_shifted hdr dbg = Cop ( Clsr , [ hdr ; Cconst_int ( wordsize_shift , dbg ) ] , dbg ) |
let float_array_length_shifted hdr dbg = Cop ( Clsr , [ hdr ; Cconst_int ( numfloat_shift , dbg ) ] , dbg ) |
let lsl_const c n dbg = if n = 0 then c else Cop ( Clsl , [ c ; Cconst_int ( n , dbg ) ] , dbg ) |
let array_indexing ? typ log2size ptr ofs dbg = let add = match typ with | None | Some Addr -> Cadda | Some Int -> Caddi | _ -> assert false in match ofs with | Cconst_int ( n , _ ) -> let i = n asr 1 in if i = 0 then ptr else Cop ( add , [ ptr ; Cconst_int ( i lsl log2size , dbg ) ] , dbg ) | Cop ( Caddi , [ Cop ( Cls... |
let addr_array_ref arr ofs dbg = Cop ( Cload ( Word_val , Mutable ) , [ array_indexing log2_size_addr arr ofs dbg ] , dbg ) |
let int_array_ref arr ofs dbg = Cop ( Cload ( Word_int , Mutable ) , [ array_indexing log2_size_addr arr ofs dbg ] , dbg ) |
let unboxed_float_array_ref arr ofs dbg = Cop ( Cload ( Double , Mutable ) , [ array_indexing log2_size_float arr ofs dbg ] , dbg ) |
let float_array_ref arr ofs dbg = box_float dbg Lambda . alloc_heap ( unboxed_float_array_ref arr ofs dbg ) |
let addr_array_set arr ofs newval dbg = Cop ( Cextcall ( " caml_modify " , typ_void , [ ] , false ) , [ array_indexing log2_size_addr arr ofs dbg ; newval ] , dbg ) |
let int_array_set arr ofs newval dbg = Cop ( Cstore ( Word_int , Assignment ) , [ array_indexing log2_size_addr arr ofs dbg ; newval ] , dbg ) |
let float_array_set arr ofs newval dbg = Cop ( Cstore ( Double , Assignment ) , [ array_indexing log2_size_float arr ofs dbg ; newval ] , dbg ) |
let addr_array_set_local arr ofs newval dbg = Cop ( Cextcall ( " caml_modify_local " , typ_void , [ ] , false ) , [ arr ; untag_int ofs dbg ; newval ] , dbg ) |
let string_length exp dbg = bind " str " exp ( fun str -> let tmp_var = V . create_local " tmp " in Clet ( VP . create tmp_var , Cop ( Csubi , [ Cop ( Clsl , [ get_size str dbg ; Cconst_int ( log2_size_addr , dbg ) ] , dbg ) ; Cconst_int ( 1 , dbg ) ] , dbg ) , Cop ( Csubi , [ Cvar tmp_var ; Cop ( Cload ( Byte_unsigned... |
let bigstring_length ba dbg = Cop ( Cload ( Word_int , Mutable ) , [ field_address ba 5 dbg ] , dbg ) |
let lookup_tag obj tag dbg = bind " tag " tag ( fun tag -> Cop ( Cextcall ( " caml_get_public_method " , typ_val , [ ] , false ) , [ obj ; tag ] , dbg ) ) |
let lookup_label obj lab dbg = bind " lab " lab ( fun lab -> let table = Cop ( Cload ( Word_val , Mutable ) , [ obj ] , dbg ) in addr_array_ref table lab dbg ) |
let send_function_name n ( mode : Lambda . alloc_mode ) = let suff = match mode with Alloc_heap -> " " | Alloc_local -> " L " in " caml_send " ^ Int . to_string n ^ suff |
let call_cached_method obj tag cache pos args ( apos , mode ) dbg = let arity = List . length args in let cache = array_indexing log2_size_addr cache pos dbg in Compilenv . need_send_fun arity mode ; Cop ( Capply ( typ_val , apos ) , Cconst_symbol ( send_function_name arity mode , dbg ) :: obj :: tag :: cache :: args ,... |
let make_alloc_generic ~ mode set_fn dbg tag wordsize args = if Lambda . is_local_mode mode || wordsize <= Config . max_young_wosize then let hdr = match mode with | Lambda . Alloc_local -> local_block_header tag wordsize | Lambda . Alloc_heap -> block_header tag wordsize in Cop ( Calloc mode , Cconst_natint ( hdr , db... |
let make_alloc ~ mode dbg tag args = let addr_array_init arr ofs newval dbg = Cop ( Cextcall ( " caml_initialize " , typ_void , [ ] , false ) , [ array_indexing log2_size_addr arr ofs dbg ; newval ] , dbg ) in make_alloc_generic ~ mode addr_array_init dbg tag ( List . length args ) args |
let make_float_alloc ~ mode dbg tag args = make_alloc_generic ~ mode float_array_set dbg tag ( List . length args * size_float / size_addr ) args |
let make_checkbound dbg = function | [ Cop ( Clsr , [ a1 ; Cconst_int ( n , _ ) ] , _ ) ; Cconst_int ( m , _ ) ] when ( m lsl n ) > n -> Cop ( Ccheckbound , [ a1 ; Cconst_int ( m lsl n + 1 lsl n - 1 , dbg ) ] , dbg ) | args -> Cop ( Ccheckbound , args , dbg ) |
let apply_function_name ( n , ( mode : Lambda . alloc_mode ) ) = let suff = match mode with Alloc_heap -> " " | Alloc_local -> " L " in " caml_apply " ^ Int . to_string n ^ suff |
let apply_function_sym n mode = assert ( n > 0 ) ; Compilenv . need_apply_fun n mode ; apply_function_name ( n , mode ) |
let curry_function_sym ar = Compilenv . need_curry_fun ar ; match ar with | Lambda . Curried { nlocal } , n -> " caml_curry " ^ Int . to_string n ^ ( if nlocal > 0 then " L " ^ Int . to_string nlocal else " " ) | Lambda . Tupled , n -> " caml_tuplify " ^ Int . to_string n |
let bigarray_elt_size : Lambda . bigarray_kind -> int = function Pbigarray_unknown -> assert false | Pbigarray_float32 -> 4 | Pbigarray_float64 -> 8 | Pbigarray_sint8 -> 1 | Pbigarray_uint8 -> 1 | Pbigarray_sint16 -> 2 | Pbigarray_uint16 -> 2 | Pbigarray_int32 -> 4 | Pbigarray_int64 -> 8 | Pbigarray_caml_int -> size_in... |
let bigarray_indexing unsafe elt_kind layout b args dbg = let check_ba_bound bound idx v = Csequence ( make_checkbound dbg [ bound ; idx ] , v ) in let rec ba_indexing dim_ofs delta_ofs = function [ ] -> assert false | [ arg ] -> if unsafe then arg else bind " idx " arg ( fun idx -> let bound = Cop ( Cload ( Word_int ,... |
let bigarray_word_kind : Lambda . bigarray_kind -> memory_chunk = function Pbigarray_unknown -> assert false | Pbigarray_float32 -> Single | Pbigarray_float64 -> Double | Pbigarray_sint8 -> Byte_signed | Pbigarray_uint8 -> Byte_unsigned | Pbigarray_sint16 -> Sixteen_signed | Pbigarray_uint16 -> Sixteen_unsigned | Pbiga... |
let bigarray_get unsafe elt_kind layout b args dbg = bind " ba " b ( fun b -> match ( elt_kind : Lambda . bigarray_kind ) with Pbigarray_complex32 | Pbigarray_complex64 -> let kind = bigarray_word_kind elt_kind in let sz = bigarray_elt_size elt_kind / 2 in bind " addr " ( bigarray_indexing unsafe elt_kind layout b args... |
let bigarray_set unsafe elt_kind layout b args newval dbg = bind " ba " b ( fun b -> match ( elt_kind : Lambda . bigarray_kind ) with Pbigarray_complex32 | Pbigarray_complex64 -> let kind = bigarray_word_kind elt_kind in let sz = bigarray_elt_size elt_kind / 2 in bind " newval " newval ( fun newv -> bind " addr " ( big... |
let ( ) = assert ( size_int = 4 || size_int = 8 ) |
let rec low_32 dbg = function | x when size_int = 4 -> x | Cop ( Casr , [ Cop ( Clsl , [ x ; Cconst_int ( 32 , _ ) ] , _ ) ; Cconst_int ( 32 , _ ) ] , _ ) | Cop ( Cand , [ x ; Cconst_natint ( 0xFFFFFFFFn , _ ) ] , _ ) -> low_32 dbg x | Clet ( id , e , body ) -> Clet ( id , e , low_32 dbg body ) | x -> x |
let sign_extend_32 dbg e = if size_int = 4 then e else Cop ( Casr , [ Cop ( Clsl , [ low_32 dbg e ; Cconst_int ( 32 , dbg ) ] , dbg ) ; Cconst_int ( 32 , dbg ) ] , dbg ) |
let zero_extend_32 dbg e = if size_int = 4 then e else Cop ( Cand , [ low_32 dbg e ; natint_const_untagged dbg 0xFFFFFFFFn ] , dbg ) |
let operations_boxed_int ( bi : Primitive . boxed_integer ) = match bi with Pnativeint -> caml_nativeint_ops | Pint32 -> caml_int32_ops | Pint64 -> caml_int64_ops |
let alloc_header_boxed_int ( bi : Primitive . boxed_integer ) mode dbg = match bi with Pnativeint -> alloc_boxedintnat_header mode dbg | Pint32 -> alloc_boxedint32_header mode dbg | Pint64 -> alloc_boxedint64_header mode dbg |
let box_int_gen dbg ( bi : Primitive . boxed_integer ) mode arg = let arg ' = if bi = Primitive . Pint32 && size_int = 8 then if big_endian then Cop ( Clsl , [ arg ; Cconst_int ( 32 , dbg ) ] , dbg ) else sign_extend_32 dbg arg else arg in Cop ( Calloc mode , [ alloc_header_boxed_int bi mode dbg ; Cconst_symbol ( opera... |
let split_int64_for_32bit_target arg dbg = bind " split_int64 " arg ( fun arg -> let first = Cop ( Cadda , [ Cconst_int ( size_int , dbg ) ; arg ] , dbg ) in let second = Cop ( Cadda , [ Cconst_int ( 2 * size_int , dbg ) ; arg ] , dbg ) in Ctuple [ Cop ( Cload ( Thirtytwo_unsigned , Mutable ) , [ first ] , dbg ) ; Cop ... |
let alloc_matches_boxed_int bi ~ hdr ~ ops = match ( bi : Primitive . boxed_integer ) , hdr , ops with | Pnativeint , Cconst_natint ( hdr , _dbg ) , Cconst_symbol ( sym , _ ) -> Nativeint . equal hdr boxedintnat_header && String . equal sym caml_nativeint_ops | Pint32 , Cconst_natint ( hdr , _dbg ) , Cconst_symbol ( sy... |
let unbox_int dbg bi = let default arg = if size_int = 4 && bi = Primitive . Pint64 then split_int64_for_32bit_target arg dbg else Cop ( Cload ( ( if bi = Primitive . Pint32 then Thirtytwo_signed else Word_int ) , Immutable ) , [ Cop ( Cadda , [ arg ; Cconst_int ( size_addr , dbg ) ] , dbg ) ] , dbg ) in map_tail ( fun... |
let make_unsigned_int bi arg dbg = if bi = Primitive . Pint32 && size_int = 8 then zero_extend_32 dbg arg else arg |
let unaligned_load_16 ptr idx dbg = if Arch . allow_unaligned_access then Cop ( Cload ( Sixteen_unsigned , Mutable ) , [ add_int ptr idx dbg ] , dbg ) else let cconst_int i = Cconst_int ( i , dbg ) in let v1 = Cop ( Cload ( Byte_unsigned , Mutable ) , [ add_int ptr idx dbg ] , dbg ) in let v2 = Cop ( Cload ( Byte_unsig... |
let unaligned_set_16 ptr idx newval dbg = if Arch . allow_unaligned_access then Cop ( Cstore ( Sixteen_unsigned , Assignment ) , [ add_int ptr idx dbg ; newval ] , dbg ) else let cconst_int i = Cconst_int ( i , dbg ) in let v1 = Cop ( Cand , [ Cop ( Clsr , [ newval ; cconst_int 8 ] , dbg ) ; cconst_int 0xFF ] , dbg ) i... |
let unaligned_load_32 ptr idx dbg = if Arch . allow_unaligned_access then Cop ( Cload ( Thirtytwo_unsigned , Mutable ) , [ add_int ptr idx dbg ] , dbg ) else let cconst_int i = Cconst_int ( i , dbg ) in let v1 = Cop ( Cload ( Byte_unsigned , Mutable ) , [ add_int ptr idx dbg ] , dbg ) in let v2 = Cop ( Cload ( Byte_uns... |
let unaligned_set_32 ptr idx newval dbg = if Arch . allow_unaligned_access then Cop ( Cstore ( Thirtytwo_unsigned , Assignment ) , [ add_int ptr idx dbg ; newval ] , dbg ) else let cconst_int i = Cconst_int ( i , dbg ) in let v1 = Cop ( Cand , [ Cop ( Clsr , [ newval ; cconst_int 24 ] , dbg ) ; cconst_int 0xFF ] , dbg ... |
let unaligned_load_64 ptr idx dbg = assert ( size_int = 8 ) ; if Arch . allow_unaligned_access then Cop ( Cload ( Word_int , Mutable ) , [ add_int ptr idx dbg ] , dbg ) else let cconst_int i = Cconst_int ( i , dbg ) in let v1 = Cop ( Cload ( Byte_unsigned , Mutable ) , [ add_int ptr idx dbg ] , dbg ) in let v2 = Cop ( ... |
let unaligned_set_64 ptr idx newval dbg = assert ( size_int = 8 ) ; if Arch . allow_unaligned_access then Cop ( Cstore ( Word_int , Assignment ) , [ add_int ptr idx dbg ; newval ] , dbg ) else let cconst_int i = Cconst_int ( i , dbg ) in let v1 = Cop ( Cand , [ Cop ( Clsr , [ newval ; cconst_int ( 8 * 7 ) ] , dbg ) ; c... |
let max_or_zero a dbg = bind " size " a ( fun a -> let sign = Cop ( Casr , [ a ; Cconst_int ( size_int * 8 - 1 , dbg ) ] , dbg ) in let sign_negation = Cop ( Cxor , [ sign ; Cconst_int ( - 1 , dbg ) ] , dbg ) in Cop ( Cand , [ sign_negation ; a ] , dbg ) ) |
let check_bound safety access_size dbg length a2 k = match ( safety : Lambda . is_safe ) with | Unsafe -> k | Safe -> let offset = match ( access_size : Clambda_primitives . memory_access_size ) with | Sixteen -> 1 | Thirty_two -> 3 | Sixty_four -> 7 in let a1 = sub_int length ( Cconst_int ( offset , dbg ) ) dbg in Cse... |
let opaque e dbg = Cop ( Copaque , [ e ] , dbg ) |
let unaligned_set size ptr idx newval dbg = match ( size : Clambda_primitives . memory_access_size ) with | Sixteen -> unaligned_set_16 ptr idx newval dbg | Thirty_two -> unaligned_set_32 ptr idx newval dbg | Sixty_four -> unaligned_set_64 ptr idx newval dbg |
let unaligned_load size ptr idx dbg = match ( size : Clambda_primitives . memory_access_size ) with | Sixteen -> unaligned_load_16 ptr idx dbg | Thirty_two -> unaligned_load_32 ptr idx dbg | Sixty_four -> unaligned_load_64 ptr idx dbg |
let box_sized size mode dbg exp = match ( size : Clambda_primitives . memory_access_size ) with | Sixteen -> tag_int exp dbg | Thirty_two -> box_int_gen dbg Pint32 mode exp | Sixty_four -> box_int_gen dbg Pint64 mode exp |
let default_prim name = Primitive . simple ~ name ~ arity : 0 ~ alloc : true |
let int64_native_prim name arity ~ alloc = let u64 = Primitive . ( Prim_global , Unboxed_integer Pint64 ) in let rec make_args = function 0 -> [ ] | n -> u64 :: make_args ( n - 1 ) in let effects = Primitive . Arbitrary_effects in let coeffects = Primitive . Has_coeffects in Primitive . make ~ name ~ native_name ( : na... |
let simplif_primitive_32bits : Clambda_primitives . primitive -> Clambda_primitives . primitive = function Pbintofint ( Pint64 , _ ) -> Pccall ( default_prim " caml_int64_of_int " ) | Pintofbint Pint64 -> Pccall ( default_prim " caml_int64_to_int " ) | Pcvtbint ( Pint32 , Pint64 , _ ) -> Pccall ( default_prim " caml_in... |
let simplif_primitive p : Clambda_primitives . primitive = match ( p : Clambda_primitives . primitive ) with | Pduprecord _ -> Pccall ( default_prim " caml_obj_dup " ) | Pbigarrayref ( _unsafe , n , Pbigarray_unknown , _layout ) -> Pccall ( default_prim ( " caml_ba_get_ " ^ string_of_int n ) ) | Pbigarrayset ( _unsafe ... |
let transl_isout h arg dbg = tag_int ( Cop ( Ccmpa Clt , [ h ; arg ] , dbg ) ) dbg |
let make_switch arg cases actions dbg = let extract_uconstant = function | Cconst_int ( n , _ ) , _dbg when ( n land 1 ) = 1 -> Some ( Cint ( Nativeint . of_int n ) ) | Cconst_natint ( n , _ ) , _dbg when Nativeint . ( to_int ( logand n one ) = 1 ) -> Some ( Cint n ) | Cconst_symbol ( s , _ ) , _dbg -> Some ( Csymbol_a... |
module SArgBlocks = struct type primitive = operation let eqint = Ccmpi Ceq let neint = Ccmpi Cne let leint = Ccmpi Cle let ltint = Ccmpi Clt let geint = Ccmpi Cge let gtint = Ccmpi Cgt type act = expression type loc = Debuginfo . t type value_kind = unit let make_const i = Cconst_int ( i , Debuginfo . none ) let make_... |
module StoreExpForSwitch = Switch . CtxStore ( struct type t = expression type key = int option * int type context = int let make_key index expr = let continuation = match expr with | Cexit ( i , [ ] ) -> Some i | _ -> None in Some ( continuation , index ) let compare_key ( cont , index ) ( cont ' , index ' ) = match c... |
module StoreExp = Switch . Store ( struct type t = expression type key = int let make_key = function | Cexit ( i , [ ] ) -> Some i | _ -> None let compare_key = Stdlib . compare end ) |
let transl_int_switch dbg arg low high cases default = match cases with let store = StoreExp . mk_store ( ) in assert ( store . Switch . act_store ( ) default = 0 ) ; let cases = List . map ( fun ( i , act ) -> i , store . Switch . act_store ( ) act ) cases in let rec inters plow phigh pact = function | [ ] -> if phigh... |
let transl_switch_clambda loc arg index cases = let store = StoreExpForSwitch . mk_store ( ) in let index = Array . map ( fun j -> store . Switch . act_store j cases . ( j ) ) index in let n_index = Array . length index in let inters = ref [ ] and this_high = ref ( n_index - 1 ) and this_low = ref ( n_index - 1 ) and t... |
let strmatch_compile = let module S = Strmatch . Make ( struct let string_block_length ptr = get_size ptr Debuginfo . none let transl_switch = transl_int_switch end ) in S . compile |
let ptr_offset ptr offset dbg = if offset = 0 then ptr else Cop ( Caddv , [ ptr ; Cconst_int ( offset * size_addr , dbg ) ] , dbg ) |
let direct_apply lbl args ( pos , _mode ) dbg = Cop ( Capply ( typ_val , pos ) , Cconst_symbol ( lbl , dbg ) :: args , dbg ) |
let generic_apply mut clos args ( pos , mode ) dbg = match args with | [ arg ] -> bind " fun " clos ( fun clos -> Cop ( Capply ( typ_val , pos ) , [ get_field_gen mut clos 0 dbg ; arg ; clos ] , dbg ) ) | _ -> let arity = List . length args in let cargs = Cconst_symbol ( apply_function_sym arity mode , dbg ) :: args @ ... |
let send kind met obj args akind dbg = let call_met obj args clos = generic_apply Asttypes . Mutable clos ( obj :: args ) akind dbg in bind " obj " obj ( fun obj -> match ( kind : Lambda . meth_kind ) , args with Self , _ -> bind " met " ( lookup_label obj met dbg ) ( call_met obj args ) | Cached , cache :: pos :: args... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.