diff options
| author | Graydon Hoare <[email protected]> | 2011-01-12 14:49:35 -0800 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-01-12 14:49:35 -0800 |
| commit | 19e70d76fc9443a7424a62c0b66a23aea3a27022 (patch) | |
| tree | 7bac915cf8377d1780efe3c8454927d2e75319ce /src/boot | |
| parent | Produce better errors for invalid imports. (diff) | |
| download | rust-19e70d76fc9443a7424a62c0b66a23aea3a27022.tar.xz rust-19e70d76fc9443a7424a62c0b66a23aea3a27022.zip | |
Guard a bunch more logging calls. Cut 10s off rustc compile time.
Diffstat (limited to 'src/boot')
| -rw-r--r-- | src/boot/me/resolve.ml | 38 | ||||
| -rw-r--r-- | src/boot/me/trans.ml | 11 |
2 files changed, 31 insertions, 18 deletions
diff --git a/src/boot/me/resolve.ml b/src/boot/me/resolve.ml index b2f29d27..02f862e3 100644 --- a/src/boot/me/resolve.ml +++ b/src/boot/me/resolve.ml @@ -429,10 +429,13 @@ let type_resolving_visitor let visit_slot_identified_pre slot = let slot = resolve_slot_identified slot in htab_put cx.ctxt_all_defns slot.id (DEFN_slot slot.node); - log cx "collected resolved slot #%d with type %s" (int_of_node slot.id) - (match slot.node.Ast.slot_ty with - None -> "??" - | Some t -> (Fmt.fmt_to_str Ast.fmt_ty t)); + iflog cx + (fun _ -> + log cx "collected resolved slot #%d with type %s" + (int_of_node slot.id) + (match slot.node.Ast.slot_ty with + None -> "??" + | Some t -> (Fmt.fmt_to_str Ast.fmt_ty t))); inner.Walk.visit_slot_identified_pre slot in @@ -440,7 +443,9 @@ let type_resolving_visitor let resolve_and_store_type _ = let t = ty_of_mod_item item in let ty = resolve_ty ~loc:item.id t in - log cx "resolved item %s, type as %a" id Ast.sprintf_ty ty; + iflog cx + (fun _ -> + log cx "resolved item %s, type as %a" id Ast.sprintf_ty ty); htab_put cx.ctxt_all_item_types item.id ty; in begin @@ -448,8 +453,10 @@ let type_resolving_visitor match item.node.Ast.decl_item with Ast.MOD_ITEM_type (_, ty) -> let ty = resolve_ty ~loc:item.id ty in - log cx "resolved item %s, defining type %a" - id Ast.sprintf_ty ty; + iflog cx + (fun _ -> + log cx "resolved item %s, defining type %a" + id Ast.sprintf_ty ty); htab_put cx.ctxt_all_type_items item.id ty; htab_put cx.ctxt_all_item_types item.id Ast.TY_type; if Hashtbl.mem cx.ctxt_all_item_names item.id then @@ -492,7 +499,9 @@ let type_resolving_visitor let visit_obj_fn_pre obj ident fn = let fty = resolve_ty ~loc:fn.id (Ast.TY_fn (ty_fn_of_fn fn.node)) in - log cx "resolved obj fn %s as %a" ident Ast.sprintf_ty fty; + iflog cx + (fun _ -> + log cx "resolved obj fn %s as %a" ident Ast.sprintf_ty fty); htab_put cx.ctxt_all_item_types fn.id fty; inner.Walk.visit_obj_fn_pre obj ident fn in @@ -629,20 +638,23 @@ let lval_base_resolving_visitor (inner:Walk.visitor) : Walk.visitor = let lookup_defn_by_ident id ident = - log cx "looking up slot or item with ident '%s'" ident; + iflog cx + (fun _ -> log cx "looking up slot or item with ident '%s'" ident); match lookup cx (!scopes) (Ast.KEY_ident ident) with RES_failed _ -> err (Some id) "unresolved identifier '%s'" ident - | RES_ok (_, id) -> (log cx "resolved to node id #%d" - (int_of_node id); id) + | RES_ok (_, id) -> ((iflog cx (fun _ -> log cx "resolved to node id #%d" + (int_of_node id))); id) in let lookup_slot_by_temp id temp = - log cx "looking up temp slot #%d" (int_of_temp temp); + iflog cx (fun _ -> log cx "looking up temp slot #%d" (int_of_temp temp)); let res = lookup cx (!scopes) (Ast.KEY_temp temp) in match res with RES_failed _ -> err (Some id) "unresolved temp node #%d" (int_of_temp temp) | RES_ok (_, id) -> - (log cx "resolved to node id #%d" (int_of_node id); id) + (iflog cx + (fun _ -> log cx "resolved to node id #%d" (int_of_node id)); + id) in let lookup_defn_by_name_base id nb = match nb with diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml index db285274..4f717219 100644 --- a/src/boot/me/trans.ml +++ b/src/boot/me/trans.ml @@ -2925,8 +2925,9 @@ let trans_visitor let (dst_cell, dst_ty) = deref_ty DEREF_one_box true dst_cell dst_ty in - let _ = log cx "init_box: dst ty %a, src ty %a" - Ast.sprintf_ty dst_ty Ast.sprintf_ty src_ty + let _ = + iflog (fun _ -> log cx "init_box: dst ty %a, src ty %a" + Ast.sprintf_ty dst_ty Ast.sprintf_ty src_ty) in let _ = assert (dst_ty = src_ty) in trans_copy_ty (get_ty_params_of_current_frame()) true @@ -2971,7 +2972,7 @@ let trans_visitor td and get_tydesc (idopt:node_id option) (ty:Ast.ty) : Il.cell = - log cx "getting tydesc for %a" Ast.sprintf_ty ty; + iflog (fun _ -> log cx "getting tydesc for %a" Ast.sprintf_ty ty); let (ty', mut) = simplified_ty_innermost_was_mutable ty in match ty' with Ast.TY_param (idx, _) -> @@ -4402,8 +4403,8 @@ let trans_visitor (arg_slot:Ast.slot) (arg:Ast.atom) : unit = - log cx "trans_argN: arg slot %a, arg atom %a" - Ast.sprintf_slot arg_slot Ast.sprintf_atom arg; + iflog (fun _ -> log cx "trans_argN: arg slot %a, arg atom %a" + Ast.sprintf_slot arg_slot Ast.sprintf_atom arg); trans_init_slot_from_atom clone arg_cell arg_slot arg and code_of_cell (cell:Il.cell) : Il.code = |