Skip to content

Commit

Permalink
Save query results and the dep graph in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Jun 19, 2018
1 parent b5650f9 commit 71c26b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/librustc_incremental/lib.rs
Expand Up @@ -17,6 +17,8 @@
#![feature(fs_read_write)]
#![feature(specialization)]

#![recursion_limit="256"]

extern crate graphviz;
#[macro_use] extern crate rustc;
extern crate rustc_data_structures;
Expand Down
22 changes: 14 additions & 8 deletions src/librustc_incremental/persist/save.rs
Expand Up @@ -13,6 +13,7 @@ use rustc::session::Session;
use rustc::ty::TyCtxt;
use rustc::util::common::time;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::join;
use rustc_serialize::Encodable as RustcEncodable;
use rustc_serialize::opaque::Encoder;
use std::io::{self, Cursor};
Expand All @@ -33,23 +34,28 @@ pub fn save_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
return;
}

time(sess, "persist query result cache", || {
save_in(sess,
query_cache_path(sess),
|e| encode_query_cache(tcx, e));
});
let query_cache_path = query_cache_path(sess);
let dep_graph_path = dep_graph_path(sess);

if tcx.sess.opts.debugging_opts.incremental_queries {
join(move || {
if tcx.sess.opts.debugging_opts.incremental_queries {
time(sess, "persist query result cache", || {
save_in(sess,
query_cache_path,
|e| encode_query_cache(tcx, e));
});
}
}, || {
time(sess, "persist dep-graph", || {
save_in(sess,
dep_graph_path(sess),
dep_graph_path,
|e| {
time(sess, "encode dep-graph", || {
encode_dep_graph(tcx, e)
})
});
});
}
});

dirty_clean::check_dirty_clean_annotations(tcx);
})
Expand Down

0 comments on commit 71c26b3

Please sign in to comment.