text
stringlengths
12
786k
type var_info = { used : V . Set . t ; linear : V . Set . t ; assigned : V . Set . t ; closure_environment : V . Set . t ; let_bound_vars_that_can_be_moved : V . Set . t ; }
let ignore_uconstant ( _ : Clambda . uconstant ) = ( )
let ignore_ulambda ( _ : Clambda . ulambda ) = ( )
let ignore_ulambda_list ( _ : Clambda . ulambda list ) = ( )
let ignore_uphantom_defining_expr_option ( _ : Clambda . uphantom_defining_expr option ) = ( )
let ignore_function_label ( _ : Clambda . function_label ) = ( )
let ignore_debuginfo ( _ : Debuginfo . t ) = ( )
let ignore_int ( _ : int ) = ( )
let ignore_var ( _ : V . t ) = ( )
let ignore_var_option ( _ : V . t option ) = ( )
let ignore_primitive ( _ : Clambda_primitives . primitive ) = ( )
let ignore_string ( _ : string ) = ( )
let ignore_int_array ( _ : int array ) = ( )
let ignore_var_with_provenance ( _ : VP . t ) = ( )
let ignore_params_with_value_kind ( _ : ( VP . t * Lambda . value_kind ) list ) = ( )
let ignore_direction_flag ( _ : Asttypes . direction_flag ) = ( )
let ignore_meth_kind ( _ : Lambda . meth_kind ) = ( )
let ignore_value_kind ( _ : Lambda . value_kind ) = ( )
let closure_environment_var ( ufunction : Clambda . ufunction ) = if List . length ufunction . params = ufunction . arity + 1 then let ( env_var , _ ) = List . nth ufunction . params ufunction . arity in assert ( VP . name env_var = " env " ) ; Some env_var else None
let make_var_info ( clam : Clambda . ulambda ) : var_info = let t : int V . Tbl . t = V . Tbl . create 42 in let assigned_vars = ref V . Set . empty in let environment_vars = ref V . Set . empty in let rec loop : Clambda . ulambda -> unit = function | Uvar var -> begin match V . T...
let let_bound_vars_that_can_be_moved var_info ( clam : Clambda . ulambda ) = let obviously_constant = ref V . Set . empty in let can_move = ref V . Set . empty in let let_stack = ref [ ] in let examine_argument_list args = let rec loop let_bound_vars ( args : Clambda . ulambda list ) = m...
let rec substitute_let_moveable is_let_moveable env ( clam : Clambda . ulambda ) : Clambda . ulambda = match clam with | Uvar var -> if not ( V . Set . mem var is_let_moveable ) then clam else begin match V . Map . find var env with | clam -> clam | exception Not_found -> Misc . fatal_err...
type moveable = Fixed | Constant | Moveable
let both_moveable a b = match a , b with | Constant , Constant -> Constant | Constant , Moveable | Moveable , Constant | Moveable , Moveable -> Moveable | Constant , Fixed | Moveable , Fixed | Fixed , Constant | Fixed , Moveable | Fixed , Fixed -> Fixed
let primitive_moveable ( prim : Clambda_primitives . primitive ) ( args : Clambda . ulambda list ) ( var_info : var_info ) = match prim , args with | Pfield _ , [ Uconst ( Uconst_ref ( _ , _ ) ) ] -> Moveable | Pfield _ , [ Uvar var ] when V . Set . mem var var_inf...
type moveable_for_env = Constant | Moveable
let rec un_anf_and_moveable var_info env ( clam : Clambda . ulambda ) : Clambda . ulambda * moveable = match clam with | Uvar var -> begin match V . Map . find var env with | Constant , def -> def , Constant | Moveable , def -> def , Moveable | exception Not_found -> let moveable : move...
let apply ~ what ~ ppf_dump clam = let var_info = make_var_info clam in let let_bound_vars_that_can_be_moved = let_bound_vars_that_can_be_moved var_info clam in let clam = substitute_let_moveable let_bound_vars_that_can_be_moved V . Map . empty clam in let var_info = make_var_info clam in let clam = un_anf ...
type ' a t = ' a
let none = " Uopt . none " |> ( Obj . magic : string -> _ t )
let is_none t = phys_equal t none
let is_some t = not ( is_none t )
let invariant invariant_a t = if is_some t then invariant_a t
let sexp_of_t sexp_of_a t = if is_none t then [ % sexp None ] else [ % sexp Some ( t : a ) ]
let some a = a
let value_exn t = if is_none t then failwith " Uopt . value_exn " else t
let unsafe_value t = t
let to_option t = if is_none t then None else Some t
let of_option = function | None -> none | Some a -> some a ; ;
module Optional_syntax = struct module Optional_syntax = struct let is_none = is_none let unsafe_value = unsafe_value end end
let usage ( ) = prerr_endline { | Usage : PIPELINE =< PIPELINE_ID > dune exec tezt / records / update . exe exit 1
let pipeline = match Sys . getenv_opt " PIPELINE " with | None -> usage ( ) | Some value -> ( match int_of_string_opt value with | None -> prerr_endline " Invalid pipeline ID ( not an integer ) . \ n " ; usage ( ) | Some value -> value )
let project = Sys . getenv_opt " PROJECT " |> Option . value ~ default " : tezos / tezos "
let rec get_all_pages ( ? from = 1 ) ( ? acc = [ ] ) url = let full_url = url ^ " ? page " = ^ string_of_int from in let * response_body = Process . run_and_read_stdout " curl " [ full_url ] in let list = JSON . parse ~ origin : url response_body |> JSON . as_list in Log ....
let fetch_record ( url , index ) = let local = records_directory // ( index ^ " . json " ) in let * ( ) = Process . run " curl " [ url ; " -- location " ; " -- output " ; local ] in Log . info " Downloaded : % s " local ; match JSON . parse_file local with...
let remove_existing_records ( ) = let remove_if_looks_like_a_record filename = if filename =~ rex " ^\\ d . +\\ json " $ then ( let filename = records_directory // filename in Sys . remove filename ; Log . info " Removed outdated record : % s " filename ) in Array . iter remove_if_lo...
let fetch_pipeline_records ( ) = let * jobs = get_all_pages ( " https :// gitlab . com / api / v4 / projects " / ^ Uri . pct_encode project ^ " / pipelines " / ^ string_of_int pipeline ^ " / jobs " ) in let get_record job = let job_id = JSON . ( job |-> " id " |> as_in...
let ( ) = Cli . init ( ) ; ( Test . register ~ __FILE__ ~ title " : update records " ~ tags [ " : update " ] @@ fun ( ) -> remove_existing_records ( ) ; fetch_pipeline_records ( ) ) ; Test . run ( )
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2014 - 11 - 06 " ] ) ; ( " Action " , [ " UpdateAssociationS...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " UpdateAssociationStatusResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp UpdateAssociationStatusResult . parse ) ( let open Error in BadResponse { body ; message = " Could not ...
let parse_error code err = let errors = [ Errors_internal . TooManyUpdates ; Errors_internal . StatusUnchanged ; Errors_internal . AssociationDoesNotExist ; Errors_internal . InvalidDocument ; Errors_internal . InvalidInstanceId ; Errors_internal . InternalServerError ] @ Errors_internal . ...
let location_map = ref ( NodeMap . create 103 : location NodeMap . t )
let getLoc ( node : Node . t ) = try NodeMap . find ! location_map node with Not_found -> Node . location node
let store_node_location ( n : Node . t ) ( l : location ) : unit = NodeMap . add ! location_map n l
let update_ids ( old_file : file ) ( ids : max_ids ) ( new_file : file ) ( changes : change_info ) = let vid_max = ref ids . max_vid in let sid_max = ref ids . max_sid in let update_vid_max vid = update_id_max vid_max vid in let update_sid_max sid = update_id_max sid_max sid in let make_vid...
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2013 - 04 - 01 " ] ) ; ( " Action " , [ " UpdateHealthCheck ...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " UpdateHealthCheckResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp UpdateHealthCheckResponse . parse ) ( let open Error in BadResponse { body ; message = " Could not find well ...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | N...
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2013 - 04 - 01 " ] ) ; ( " Action " , [ " UpdateHostedZoneCo...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " UpdateHostedZoneCommentResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp UpdateHostedZoneCommentResponse . parse ) ( let open Error in BadResponse { body ; message = " Could no...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | N...
let datadir = ref None
let get_datadir ( ) = match ! datadir with | None -> Events . ( emit node_uninitialized ) ( ) >>= fun ( ) -> Lwt_exit . exit_and_raise 1 | Some m -> Lwt . return m
let init dir = datadir := Some dir
let then_false ( ) = Lwt . return_false
let do_compile hash p = get_datadir ( ) >>= fun datadir -> let source_dir = datadir // Protocol_hash . to_short_b58check hash // " src " in let log_file = datadir // Protocol_hash . to_short_b58check hash // " LOG " in let plugin_file = datadir // Protocol_hash . to_short_b58check hash // ...
let compile hash p = if Tezos_protocol_registerer . Registerer . mem hash then Lwt . return_true else do_compile hash p >>= fun success -> let loaded = Tezos_protocol_registerer . Registerer . mem hash in if success && not loaded then Events . ( emit internal_error ) hash >>= fun ( ) -> Lwt ....
let node_uninitialized = declare_0 ~ section ~ level ~ name " : node_uninitialized " ~ msg " : node not initialized " ( )
let compiler_exit_error = declare_1 ~ section ~ level ~ name " : compiler_exit_error " ~ msg " : error : { error } " ( " error " , Error_monad . ( TzTrace . encoding error_encoding ) )
let compilation_interrupted = declare_1 ~ section ~ level ~ name " : compilation_interrupted " ~ msg " : compilation interrupted ( see logs in : { filename } ) " ( " filename " , Data_encoding . string )
let compilation_error = declare_1 ~ section ~ level ~ name " : compilation_error " ~ msg " : compilation error ( logs in file : { filename } ) " ( " filename " , Data_encoding . string )
let dynlink_error = declare_2 ~ section ~ level ~ name " : dynlink_error " ~ msg " : can ' t load plugin : { plugin } ( { reason } ) " ( " plugin " , Data_encoding . string ) ( " reason " , Data_encoding . string )
let dynlink_error_static = declare_2 ~ section ~ level ~ name " : dynlink_error_static " ~ msg : " can ' t load plugin either because the binary is statically linked or \ because there was an error in its compilation : { plugin } ( { reason } ) " ( " plugin " , Data_encoding . s...
let internal_error = declare_1 ~ section ~ level ~ name " : internal_error " ~ msg " : internal error while compiling { protocol } " ( " protocol " , Protocol_hash . encoding )
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2016 - 11 - 15 " ] ) ; ( " Action " , [ " UpdateSecurityGrou...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " UpdateSecurityGroupRuleDescriptionsEgressResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp UpdateSecurityGroupRuleDescriptionsEgressResult . parse ) ( let open Error in BadResponse { ...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | N...
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2016 - 11 - 15 " ] ) ; ( " Action " , [ " UpdateSecurityGrou...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " UpdateSecurityGroupRuleDescriptionsIngressResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp UpdateSecurityGroupRuleDescriptionsIngressResult . parse ) ( let open Error in BadResponse ...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | N...
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2010 - 05 - 15 " ] ) ; ( " Action " , [ " UpdateStack " ] ...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " UpdateStackResponse " ( snd xml ) ) ( Xml . member " UpdateStackResult " ) in try Util . or_error ( Util . option_bind resp UpdateStackOutput . parse ) ( let open Error...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | N...
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2010 - 05 - 15 " ] ) ; ( " Action " , [ " UpdateStackInstanc...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " UpdateStackInstancesResponse " ( snd xml ) ) ( Xml . member " UpdateStackInstancesResult " ) in try Util . or_error ( Util . option_bind resp UpdateStackInstancesOutput . p...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | N...
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2010 - 05 - 15 " ] ) ; ( " Action " , [ " UpdateStackSet " ...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " UpdateStackSetResponse " ( snd xml ) ) ( Xml . member " UpdateStackSetResult " ) in try Util . or_error ( Util . option_bind resp UpdateStackSetOutput . parse ) ( let o...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | N...
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2010 - 05 - 15 " ] ) ; ( " Action " , [ " UpdateTerminationP...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " UpdateTerminationProtectionResponse " ( snd xml ) ) ( Xml . member " UpdateTerminationProtectionResult " ) in try Util . or_error ( Util . option_bind resp UpdateTerminationP...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | N...
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2013 - 04 - 01 " ] ) ; ( " Action " , [ " UpdateTrafficPolic...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " UpdateTrafficPolicyCommentResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp UpdateTrafficPolicyCommentResponse . parse ) ( let open Error in BadResponse { body ; message = " Co...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | N...
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2013 - 04 - 01 " ] ) ; ( " Action " , [ " UpdateTrafficPolic...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " UpdateTrafficPolicyInstanceResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp UpdateTrafficPolicyInstanceResponse . parse ) ( let open Error in BadResponse { body ; message = " ...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | N...
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2013 - 11 - 01 " ] ) ; ( " Action " , [ " UpdateTrail " ] ...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " UpdateTrailResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp UpdateTrailResponse . parse ) ( let open Error in BadResponse { body ; message = " Could not find well formed Updat...