Skip to content

Commit

Permalink
Time type checking passes separately
Browse files Browse the repository at this point in the history
  • Loading branch information
sanxiyn committed Mar 21, 2013
1 parent 64d923f commit dad5c30
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 3 additions & 5 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,9 @@ pub fn compile_rest(sess: Session, cfg: ast::crate_cfg,
let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars,
region_map, rp_set, lang_items, crate);

let (method_map, vtable_map) =
time(time_passes, ~"typechecking", ||
typeck::check_crate(ty_cx,
trait_map,
crate));
// passes are timed inside typeck
let (method_map, vtable_map) = typeck::check_crate(
ty_cx, trait_map, crate);

// These next two const passes can probably be merged
time(time_passes, ~"const marking", ||
Expand Down
14 changes: 11 additions & 3 deletions src/librustc/middle/typeck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ use core::prelude::*;
use middle::resolve;
use middle::ty::{ty_param_substs_and_ty, vstore_uniq};
use middle::ty;
use util::common::time;
use util::ppaux;

use core::result;
Expand Down Expand Up @@ -329,17 +330,24 @@ pub fn check_crate(tcx: ty::ctxt,
trait_map: resolve::TraitMap,
crate: @ast::crate)
-> (method_map, vtable_map) {
let time_passes = tcx.sess.time_passes();
let ccx = @mut CrateCtxt {
trait_map: trait_map,
method_map: oldmap::HashMap(),
vtable_map: oldmap::HashMap(),
coherence_info: @coherence::CoherenceInfo(),
tcx: tcx
};
collect::collect_item_types(ccx, crate);
coherence::check_coherence(ccx, crate);

check::check_item_types(ccx, crate);
time(time_passes, ~"type collecting", ||
collect::collect_item_types(ccx, crate));

time(time_passes, ~"method resolution", ||
coherence::check_coherence(ccx, crate));

time(time_passes, ~"type checking", ||
check::check_item_types(ccx, crate));

check_for_main_fn(ccx);
tcx.sess.abort_if_errors();
(ccx.method_map, ccx.vtable_map)
Expand Down

0 comments on commit dad5c30

Please sign in to comment.