Skip to content

[WIP] Refactor dep graph representation both in memory and on disk #60035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2780,6 +2780,7 @@ name = "rustc_data_structures"
version = "0.0.0"
dependencies = [
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
"graphviz 0.0.0",
"indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ impl Config {
set(&mut config.lld_enabled, rust.lld);
set(&mut config.lldb_enabled, rust.lldb);
set(&mut config.llvm_tools_enabled, rust.llvm_tools);
config.rustc_parallel = rust.parallel_compiler.unwrap_or(false);
config.rustc_parallel = rust.parallel_compiler.unwrap_or(true);
config.rustc_default_linker = rust.default_linker.clone();
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
Expand Down
22 changes: 16 additions & 6 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,23 @@ macro_rules! define_dep_nodes {
$({ $($struct_arg_name:ident : $struct_arg_ty:ty),* })*
,)*
) => (
// Used to get an unique integer per dep kind
enum DepKindCounter {
$($variant),*
}

/// Encodes `eval_always` in the lowest bit of the discriminant
const fn dep_kind_discriminant(kind: DepKindCounter, eval_always: bool) -> isize {
(((kind as u16) << 1) | (eval_always as u16)) as isize
}

#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash,
RustcEncodable, RustcDecodable)]
pub enum DepKind {
$($variant),*
$($variant = dep_kind_discriminant(
DepKindCounter::$variant,
contains_eval_always_attr!($($attr),*),
)),*
}

impl DepKind {
Expand Down Expand Up @@ -155,11 +168,8 @@ macro_rules! define_dep_nodes {

#[inline(always)]
pub fn is_eval_always(&self) -> bool {
match *self {
$(
DepKind :: $variant => { contains_eval_always_attr!($($attr), *) }
)*
}
// `eval_always` is encoded in the lowest bit of DepNodeKind
*self as u16 & 1 == 1
}

#[allow(unreachable_code)]
Expand Down
Loading