text
stringlengths
0
601k
let theme = ref " dark "
let ocaml_cmd , ocaml_opts , stdlib_dir = if Sys . os_type <> " Win32 " then ref " ocaml " , ref [ ] , None else if Sys . command " ocamlrun ocaml - vnum " = 0 then ref " ocamlrun " , ref [ " ocaml " ] , None else ref ( program_dir / " bin " / " ocamlrun " ) , ref [ program_dir / " bin " / " ocaml " ; " - I " ; program...
module State : sig type t val make : fun_name : string -> tailrec_label : Label . t -> contains_calls : bool -> Cfg . basic_block Label . Tbl . t -> t val get_fun_name : t -> string val get_tailrec_label : t -> Label . t val get_contains_calls : t -> bool val add_block : t -> label : Label . t -> block : Cfg . basic_bl...
type basic_or_terminator = | Basic of Cfg . basic | Terminator of Cfg . terminator
let basic_or_terminator_of_operation : State . t -> Mach . operation -> basic_or_terminator = fun state op -> match op with | Imove -> Basic ( Op Move ) | Ispill -> Basic ( Op Spill ) | Ireload -> Basic ( Op Reload ) | Iconst_int i -> Basic ( Op ( Const_int i ) ) | Iconst_float f -> Basic ( Op ( Const_float f ) ) | Ico...
let float_test_of_float_comparison : Cmm . float_comparison -> label_false : Label . t -> label_true : Label . t -> Cfg . float_test = fun comparison ~ label_false ~ label_true -> let lt , eq , gt , uo = match comparison with | CFeq -> label_false , label_true , label_false , label_false | CFneq -> label_true , label_f...
let int_test_of_integer_comparison : Cmm . integer_comparison -> signed : bool -> immediate : int option -> label_false : Label . t -> label_true : Label . t -> Cfg . int_test = fun comparison ~ signed : is_signed ~ immediate : imm ~ label_false ~ label_true -> let lt , eq , gt = match comparison with | Ceq -> label_fa...
let terminator_of_test : Mach . test -> label_false : Label . t -> label_true : Label . t -> Cfg . terminator = fun test ~ label_false ~ label_true -> let int_test comparison immediate = let signed , comparison = match comparison with | Mach . Isigned comparison -> true , comparison | Mach . Iunsigned comparison -> fal...
let make_instruction : type a . State . t -> desc : a -> a Cfg . instruction = fun state ~ desc -> let arg = [ ] || in let res = [ ] || in let dbg = Debuginfo . none in let live = Reg . Set . empty in let stack_offset = invalid_stack_offset in let id = State . get_next_instruction_id state in let fdo = Fdo_info . none ...
let copy_instruction : type a . State . t -> Mach . instruction -> desc : a -> a Cfg . instruction = fun state instr ~ desc -> let { Mach . arg ; res ; dbg ; live ; desc = _ ; next = _ ; available_before = _ ; available_across = _ } = instr in let stack_offset = invalid_stack_offset in let id = State . get_next_instruc...
let copy_instruction_no_reg : type a . State . t -> Mach . instruction -> desc : a -> a Cfg . instruction = fun state instr ~ desc -> let { Mach . arg = _ ; res = _ ; dbg ; live ; desc = _ ; next = _ ; available_before = _ ; available_across = _ } = instr in let arg = [ ] || in let res = [ ] || in let stack_offset = in...
let rec get_end : Mach . instruction -> Mach . instruction = fun instr -> match instr . Mach . desc with | Iend -> instr | Iop _ | Ireturn _ | Iifthenelse _ | Iswitch _ | Icatch _ | Iexit _ | Itrywith _ | Iraise _ -> get_end instr . Mach . next
type block_info = { instrs : Cfg . basic Cfg . instruction list ; last : Mach . instruction ; terminator : Cfg . terminator Cfg . instruction option }
let extract_block_info : State . t -> Mach . instruction -> block_info = fun state first -> let rec loop ( instr : Mach . instruction ) acc = let return terminator instrs = let instrs = List . rev instrs in { instrs ; last = instr ; terminator } in match instr . desc with | Iop op -> begin match basic_or_terminator_of_...
let fallthrough_label : Label . t = - 1
let rec add_blocks : Mach . instruction -> State . t -> starts_with_pushtrap : Label . t option -> start : Label . t -> next : Label . t -> unit = fun instr state ~ starts_with_pushtrap ~ start ~ next -> let { instrs ; last ; terminator } = extract_block_info state instr in let terminate_block ~ trap_actions terminator...
let update_trap_handler_blocks : State . t -> Cfg . t -> unit = fun state cfg -> List . iter ( fun label -> match Label . Tbl . find_opt cfg . blocks label with | None -> Misc . fatal_errorf " Cfgize . update_trap_handler_blocks : inconsistent state ( no block \ labelled % d ) " label | Some block -> block . is_trap_ha...
module Stack_offset_and_exn = struct type handler_stack = Label . t list let compute_stack_offset ~ stack_offset ~ traps = stack_offset + ( Proc . trap_size_in_bytes * List . length traps ) let check_and_set_stack_offset : ' a Cfg . instruction -> stack_offset : int -> traps : handler_stack -> ' a Cfg . instruction = f...
let fundecl : Mach . fundecl -> preserve_orig_labels : bool -> simplify_terminators : bool -> Cfg_with_layout . t = fun fundecl ~ preserve_orig_labels ~ simplify_terminators -> let { Mach . fun_name ; fun_args ; fun_body ; fun_codegen_options ; fun_dbg ; fun_num_stack_slots ; fun_contains_calls } = fundecl in let start...
module type Forward_domain = sig type t val top : t val bot : t val compare : t -> t -> int val join : t -> t -> t val to_string : t -> string end
module type Forward_transfer = sig type domain type t = { normal : domain ; exceptional : domain } val basic : domain -> Cfg . basic Cfg . instruction -> t val terminator : domain -> Cfg . terminator Cfg . instruction -> t end
module type Forward_S = sig type domain type map = domain Label . Tbl . t val run : Cfg . t -> ? max_iteration : int -> ? init : domain -> unit -> ( map , map ) Result . t end
module Forward ( D : Forward_domain ) ( T : Forward_transfer with type domain = D . t ) : Forward_S with type domain = D . t = struct type domain = D . t type transfer = T . t type map = domain Label . Tbl . t module WorkSetElement = struct type t = { label : Label . t ; value : domain } let compare { label = left_labe...
module type Backward_domain = sig type t val bot : t val compare : t -> t -> int val join : t -> t -> t val less_equal : t -> t -> bool val to_string : t -> string end
module type Backward_transfer = sig type domain val basic : domain -> exn : domain -> Cfg . basic Cfg . instruction -> domain val terminator : domain -> exn : domain -> Cfg . terminator Cfg . instruction -> domain val exception_ : domain -> domain end
module type Backward_S = sig type domain type _ map = | Block : domain Label . Tbl . t map | Instr : domain Instr . Tbl . t map val run : Cfg . t -> ? max_iteration : int -> init : domain -> map ' : a map -> unit -> ( ' a , ' a ) Result . t end
module Backward ( D : Backward_domain ) ( T : Backward_transfer with type domain = D . t ) : Backward_S with type domain = D . t = struct type domain = D . t type _ map = | Block : domain Label . Tbl . t map | Instr : domain Instr . Tbl . t map module WorkSetElement = struct type t = { label : Label . t ; value : domai...
type location = string exception Different of { location : location ; message : string }
let different : location -> string -> _ = fun location message -> raise ( Different { location ; message } )
module type State = sig type t val make : unit -> t val add_to_explore : t -> Label . t -> Label . t -> unit val to_explore : t -> ( Label . t * Label . t ) option val add_seen : t -> Label . t -> unit val has_seen : t -> Label . t -> bool val num_seen : t -> int val add_labels_to_check : t -> location -> Label . t -> ...
module type Container = sig type ' a t val make : unit -> ' a t val add : ' a -> ' a t -> unit val get : ' a t -> ' a option end
module StackContainer : Container = struct type ' a t = ' a Stack . t let make = Stack . create let add = Stack . push let get = Stack . pop_opt end
module Make_state ( C : Container ) : State = struct type t = { subst : Label . t Label . Tbl . t ; to_explore : ( Label . t * Label . t ) C . t ; mutable seen : Label . Set . t ; mutable labels_to_check : ( location * Label . t * Label . t ) list ; mutable label_sets_to_check : ( location * Label . Set . t * Label . S...
module State = Make_state ( StackContainer )
let equal_raise_kind : Lambda . raise_kind -> Lambda . raise_kind -> bool = fun left right -> match left , right with | Raise_regular , Raise_regular -> true | Raise_reraise , Raise_reraise -> true | Raise_notrace , Raise_notrace -> true | Raise_regular , ( Raise_reraise | Raise_notrace ) | Raise_reraise , ( Raise_regu...
let array_equal eq left right = Array . length left = Array . length right && Array . for_all2 eq left right
let is_valid_stack_offset : int -> bool = fun stack_offset -> stack_offset >= 0
let check_external_call_operation : location -> Cfg . external_call_operation -> Cfg . external_call_operation -> unit = fun location expected result -> if not ( String . equal expected . func_symbol result . func_symbol ) then different location " function symbol " ; if not ( Bool . equal expected . alloc result . all...
let check_operation : location -> Cfg . operation -> Cfg . operation -> unit = fun location expected result -> match expected , result with | Move , Move -> ( ) | Spill , Spill -> ( ) | Reload , Reload -> ( ) | Const_int expected , Const_int result when Nativeint . equal expected result -> ( ) | Const_float expected , ...
let check_prim_call_operation : location -> Cfg . prim_call_operation -> Cfg . prim_call_operation -> unit = fun location expected result -> match expected , result with | External expected , External result -> check_external_call_operation location expected result | ( Alloc { bytes = expected_bytes ; dbginfo = _expect...
let check_func_call_operation : location -> Cfg . func_call_operation -> Cfg . func_call_operation -> unit = fun location expected result -> match expected , result with | Indirect , Indirect -> ( ) | ( Direct { func_symbol = expected_func_symbol } , Direct { func_symbol = result_func_symbol } ) when String . equal exp...
let check_tail_call_operation : State . t -> location -> Cfg . tail_call_operation -> Cfg . tail_call_operation -> unit = fun state location expected result -> match expected , result with | ( Self { destination = expected_destination } , Self { destination = result_destination } ) -> State . add_labels_to_check state ...
let check_call_operation : location -> Cfg . call_operation -> Cfg . call_operation -> unit = fun location expected result -> match expected , result with | P expected , P result -> check_prim_call_operation location expected result | F expected , F result -> check_func_call_operation location expected result | _ -> di...
let check_basic : State . t -> location -> Cfg . basic -> Cfg . basic -> unit = fun state location expected result -> match expected , result with | Op expected , Op result -> check_operation location expected result | Call expected , Call result -> check_call_operation location expected result | Reloadretaddr , Reload...
let check_instruction : type a . check_live : bool -> check_dbg : bool -> check_arg : bool -> int -> location -> a Cfg . instruction -> a Cfg . instruction -> unit = fun ~ check_live ~ check_dbg ~ check_arg idx location expected result -> let location = Printf . sprintf " % s ( index % d ) " location idx in if check_ar...
let check_basic_instruction : State . t -> location -> int -> Cfg . basic Cfg . instruction -> Cfg . basic Cfg . instruction -> unit = fun state location idx expected result -> check_basic state location expected . desc result . desc ; let check_dbg = match expected . desc with Prologue -> false | _ -> true [ @@ ocaml ...
let rec check_basic_instruction_list : State . t -> location -> int -> Cfg . basic Cfg . instruction list -> Cfg . basic Cfg . instruction list -> unit = fun state location idx expected result -> match expected , result with | [ ] , [ ] -> ( ) | _ :: _ , [ ] -> different location " bodies with different sizes ( expecte...
let check_terminator_instruction : State . t -> location -> Cfg . terminator Cfg . instruction -> Cfg . terminator Cfg . instruction -> unit = fun state location expected result -> begin match expected . desc , result . desc with | Never , Never -> ( ) | Always lbl1 , Always lbl2 -> State . add_to_explore state lbl1 lb...
let check_basic_block : State . t -> Cfg . basic_block -> Cfg . basic_block -> unit = fun state expected result -> let location = Printf . sprintf " block % s /% s " ( Label . to_string expected . start ) ( Label . to_string result . start ) in check_basic_instruction_list state location 0 expected . body result . body...
let rec explore_cfg : State . t -> Cfg . t -> Cfg . t -> unit = fun state expected result -> match State . to_explore state with | None -> ( ) | Some ( lbl1 , lbl2 ) -> ( if not ( State . has_seen state lbl1 ) then let expected_block = Label . Tbl . find_opt expected . blocks lbl1 in let result_block = Label . Tbl . fi...
let check_cfg : State . t -> Cfg . t -> Cfg . t -> unit = fun state expected result -> let expected_num_blocks = Label . Tbl . length expected . blocks in let result_num_blocks = Label . Tbl . length result . blocks in if not ( Int . equal expected_num_blocks result_num_blocks ) then different " CFG " " number of block...
let _check_layout : State . t -> Label . t list -> Label . t list -> unit = fun state expected result -> let expected_length = List . length expected in let result_length = List . length result in if expected_length <> result_length then different " layout sizes " ( Printf . sprintf " expected % d , got % d " expected_...
let save_cfg_as_dot : Cfg_with_layout . t -> string -> unit = fun cfg_with_layout msg -> Cfg_with_layout . save_as_dot cfg_with_layout ~ show_instr : true ~ show_exn : true ~ annotate_succ ( : Printf . sprintf " % d ->% d " ) msg
let check_cfg_with_layout : ? mach : Mach . fundecl -> ? linear : Linear . fundecl -> Cfg_with_layout . t -> Cfg_with_layout . t -> unit = fun ? mach ? linear expected result -> try let state = State . make ( ) in check_cfg state ( Cfg_with_layout . cfg expected ) ( Cfg_with_layout . cfg result ) ; State . check state ...
type cfg_item_info = | Cfg of Cfg_with_layout . t | Data of Cmm . data_item list
type cfg_unit_info = { mutable unit_name : string ; mutable items : cfg_item_info list ; mutable for_pack : string option }
type error = | Wrong_format of string | Wrong_version of string | Corrupted of string | Marshal_failed of string
let save filename cfg_unit_info = let ch = open_out_bin filename in Misc . try_finally ( fun ( ) -> output_string ch Config . cfg_magic_number ; output_value ch cfg_unit_info ; output_value ch ( Cmm . cur_label ( ) ) ; flush ch ; let crc = Digest . file filename in Digest . output ch crc ) ~ always ( : fun ( ) -> close...
let restore filename = let ic = open_in_bin filename in Misc . try_finally ( fun ( ) -> let magic = Config . cfg_magic_number in let buffer = really_input_string ic ( String . length magic ) in if String . equal buffer magic then begin try let cfg_unit_info = ( input_value ic : cfg_unit_info ) in let last_label = ( inp...
let report_error ppf = function | Wrong_format filename -> fprintf ppf " Expected Cfg format . Incompatible file % a " Location . print_filename filename | Wrong_version filename -> fprintf ppf " % a @ is not compatible with this version of OCaml " Location . print_filename filename | Corrupted filename -> fprintf ppf ...
let ( ) = Location . register_error_of_exn ( function | Error err -> Some ( Location . error_of_printer_file report_error err ) | _ -> None )
module S = struct type func_call_operation = | Indirect | Direct of { func_symbol : string } type tail_call_operation = | Self of { destination : Label . t } | Func of func_call_operation type external_call_operation = { func_symbol : string ; alloc : bool ; ty_res : Cmm . machtype ; ty_args : Cmm . exttype list } type...
type domain = { before : Reg . Set . t ; across : Reg . Set . t }
module Domain : Cfg_dataflow . Backward_domain with type t = domain = struct type t = domain = { before : Reg . Set . t ; across : Reg . Set . t } let bot = { before = Reg . Set . empty ; across = Reg . Set . empty } let compare { before = left_before ; across = _ } { before = right_before ; across = _ } = Reg . Set . ...
module Transfer : Cfg_dataflow . Backward_transfer with type domain = domain = struct type nonrec domain = domain = { before : Reg . Set . t ; across : Reg . Set . t } let basic : domain -> exn : domain -> Cfg . basic Cfg . instruction -> domain = fun { before ; across = _ } ~ exn instr -> match instr . desc with | Op ...
module Liveness = Cfg_dataflow . Backward ( Domain ) ( Transfer )
let to_linear_instr ( ? like : _ Cfg . instruction option ) desc ~ next : L . instruction = let arg , res , dbg , live , fdo = match like with | None -> [ ] , || [ ] , || Debuginfo . none , Reg . Set . empty , Fdo_info . none | Some like -> like . arg , like . res , like . dbg , like . live , like . fdo in { desc ; nex...
let from_basic ( basic : Cfg . basic ) : L . instruction_desc = match basic with | Prologue -> Lprologue | Reloadretaddr -> Lreloadretaddr | Pushtrap { lbl_handler } -> Lpushtrap { lbl_handler } | Poptrap -> Lpoptrap | Call ( F Indirect ) -> Lop Icall_ind | Call ( F ( Direct { func_symbol } ) ) -> Lop ( Icall_imm { fun...
let basic_to_linear ( i : _ Cfg . instruction ) ~ next = let desc = from_basic i . desc in to_linear_instr ~ like : i desc ~ next
let mk_int_test ~ lt ~ eq ~ gt : Cmm . integer_comparison = match eq , lt , gt with | true , false , false -> Ceq | false , true , false -> Clt | false , false , true -> Cgt | false , true , true -> Cne | true , true , false -> Cle | true , false , true -> Cge | true , true , true -> assert false | false , false , fals...
type float_cond = | Must_be_last | Any of Cmm . float_comparison list
let mk_float_cond ~ lt ~ eq ~ gt ~ uo = match eq , lt , gt , uo with | true , false , false , false -> Any [ CFeq ] | false , true , false , false -> Any [ CFlt ] | false , false , true , false -> Any [ CFgt ] | true , true , false , false -> Any [ CFle ] | true , false , true , false -> Any [ CFge ] | false , true , t...
let linearize_terminator cfg ( terminator : Cfg . terminator Cfg . instruction ) ( ~ next : Linear_utils . labelled_insn ) : L . instruction * Label . t option = let branch_or_fallthrough lbl = if Label . equal next . label lbl then [ ] else [ L . Lbranch lbl ] in let emit_bool ( c1 , l1 ) ( c2 , l2 ) = match Label . e...
let need_starting_label ( cfg_with_layout : CL . t ) ( block : Cfg . basic_block ) ( ~ prev_block : Cfg . basic_block ) = if block . is_trap_handler then true else match Label . Set . elements block . predecessors with | [ ] | _ :: _ :: _ -> true | [ pred ] when not ( Label . equal pred prev_block . start ) -> true | [...
let adjust_stack_offset body ( block : Cfg . basic_block ) ( ~ prev_block : Cfg . basic_block ) = let block_stack_offset = block . stack_offset in let prev_stack_offset = prev_block . terminator . stack_offset in if block_stack_offset = prev_stack_offset then body else let delta_bytes = block_stack_offset - prev_stack_...
let run cfg_with_layout = let cfg = CL . cfg cfg_with_layout in let layout = Array . of_list ( CL . layout cfg_with_layout ) in let len = Array . length layout in let next = ref Linear_utils . labelled_insn_end in let tailrec_label = ref None in for i = len - 1 downto 0 do let label = layout . ( i ) in if not ( Label ....
let print_assembly ( blocks : Cfg . basic_block list ) = let layout = List . map ( fun ( b : Cfg . basic_block ) -> b . start ) blocks in let fun_name = " _fun_start_ " in let cfg = Cfg . create ~ fun_name ~ fun_args [ ] :|| ~ fun_dbg : Debuginfo . none ~ fun_fast : false ~ fun_contains_calls : true ~ fun_num_stack_slo...
type t = { cfg : Cfg . t ; mutable layout : Label . t list ; mutable new_labels : Label . Set . t ; preserve_orig_labels : bool }
let create cfg ~ layout ~ preserve_orig_labels ~ new_labels = { cfg ; layout ; new_labels ; preserve_orig_labels }
let cfg t = t . cfg
let layout t = t . layout
let preserve_orig_labels t = t . preserve_orig_labels
let new_labels t = t . new_labels
let set_layout t layout = let cur_layout = Label . Set . of_list t . layout in let new_layout = Label . Set . of_list layout in if not ( Label . Set . equal cur_layout new_layout && Label . equal ( List . hd layout ) t . cfg . entry_label ) then Misc . fatal_error " Cfg set_layout : new layout is not a permutation of t...
let remove_block t label = Cfg . remove_block_exn t . cfg label ; t . layout <- List . filter ( fun l -> not ( Label . equal l label ) ) t . layout ; t . new_labels <- Label . Set . remove label t . new_labels
let is_trap_handler t label = let block = Cfg . get_block_exn t . cfg label in block . is_trap_handler
let dump ppf t ~ msg = let open Format in fprintf ppf " \ ncfg for % s \ n " msg ; fprintf ppf " % s \ n " t . cfg . fun_name ; fprintf ppf " layout . length =% d \ n " ( List . length t . layout ) ; fprintf ppf " blocks . length =% d \ n " ( Label . Tbl . length t . cfg . blocks ) ; let print_block label = let block =...
let print_dot ( ? show_instr = true ) ( ? show_exn = true ) ? annotate_block ? annotate_succ ppf t = Format . fprintf ppf " strict digraph " \% s " \ { \ n " t . cfg . fun_name ; let annotate_block label = match annotate_block with | None -> " " | Some f -> Printf . sprintf " \ n % s " ( f label ) in let annotate_succ ...
let save_as_dot t ? show_instr ? show_exn ? annotate_block ? annotate_succ msg = let filename = Printf . sprintf " % s % s % s . dot " ( X86_proc . string_of_symbol " " t . cfg . fun_name ) ( if msg = " " then " " else " . " ) msg in if ! Cfg . verbose then Printf . printf " Writing cfg for % s to % s \ n " msg filenam...
module Permute = struct external unsafe_set : ' a array -> int -> ' a -> unit = " % array_unsafe_set " external unsafe_get : ' a array -> int -> ' a = " % array_unsafe_get " let default_random_state = Random . State . make_self_init ( ) let array ( ? random_state = default_random_state ) t = let swap t i j = let elt_i ...
let reorder_blocks_random ? random_state t = let original_layout = layout t in let new_layout = List . hd original_layout :: Permute . list ? random_state ( List . tl original_layout ) in set_layout t new_layout
let create ( ) = { id = Runtime . Chan_id . gen ( ) ; channel = Event . new_channel ( ) ; closed_flag = false ; clients_count = 0 ; mutex = Mutex . create ( ) ; } ; ;
let maintain_clients_count chan delta = let will_block = ( delta * chan . clients_count >= 0 ) in ( if will_block then ( chan . clients_count <- chan . clients_count + delta ; Runtime . Fiber . blocked ( ) ) else ( chan . clients_count <- chan . clients_count + delta ; Runtime . Fiber . unblocked ( ) ) ) ; ; ;
let unblocked_send_impl chan value = if None <> Event . poll ( Event . send chan . channel value ) then ( maintain_clients_count chan 1 ; true ) else false ; ;
let unblocked_send chan value = Mutex . lock chan . mutex ; if chan . closed_flag then ( Mutex . unlock chan . mutex ; false ) else let rst = unblocked_send_impl chan value in Mutex . unlock chan . mutex ; rst ; ;
let send chan value = Mutex . lock chan . mutex ; if chan . closed_flag then ( Mutex . unlock chan . mutex ; closed_chan chan ) ; if unblocked_send_impl chan value then Mutex . unlock chan . mutex else ( maintain_clients_count chan 1 ; Mutex . unlock chan . mutex ; Event . sync ( Event . send chan . channel value ) ) ;...
let unblocked_receive_impl chan = if chan . closed_flag then Some EofObject else ( let rst = Event . poll ( Event . receive chan . channel ) in if None <> rst then maintain_clients_count chan ( - 1 ) ; rst ) ; ;
let unblocked_receive chan = Mutex . lock chan . mutex ; if chan . closed_flag then ( Mutex . unlock chan . mutex ; None ) else let rst = unblocked_receive_impl chan in Mutex . unlock chan . mutex ; rst ; ;
let receive chan = Mutex . lock chan . mutex ; match unblocked_receive_impl chan with | Some value -> ( Mutex . unlock chan . mutex ; value ) | None -> ( maintain_clients_count chan ( - 1 ) ; Mutex . unlock chan . mutex ; Event . sync ( Event . receive chan . channel ) ) ; ;
let close chan = Mutex . lock chan . mutex ; if chan . closed_flag then ( Mutex . unlock chan . mutex ; closed_chan chan ) else chan . closed_flag <- true ; if chan . clients_count > 0 then closed_chan chan else for i = 1 to ( - chan . clients_count ) do Event . sync ( Event . send chan . channel EofObject ) ; Runtime ...