-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
incr.comp.: Make DepNode Copy
and valid across compilation sessions
#42537
Conversation
Looks like tidy failed here:
|
b24ce4a
to
f4342b0
Compare
f4342b0
to
7f48280
Compare
OK, this should be ready for review. |
Copy
and valid across compilation sessionsCopy
and valid across compilation sessions
src/librustc/dep_graph/dep_node.rs
Outdated
@@ -17,6 +17,58 @@ use rustc_data_structures::stable_hasher::{StableHasher, HashStable}; | |||
use ich::StableHashingContext; | |||
use std::hash::Hash; | |||
|
|||
//! This module defines the `DepNode` type which the compiler uses to represent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥂 love the comments
// erase!() just makes tokens go away. It's used to specify which macro argument | ||
// is repeated (i.e. which sub-expression of the macro we are in) but don't need | ||
// to actually use any of the arguments. | ||
macro_rules! erase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cute.
This is really nice. r=me once errors are resolved. |
3fc1e09
to
fdff2d3
Compare
@bors r=nikomatsakis |
📌 Commit fdff2d3 has been approved by |
incr.comp.: Make DepNode `Copy` and valid across compilation sessions This PR moves `DepNode` to a representation that does not need retracing and thus simplifies comparing dep-graphs from different compilation sessions. The code also gets a lot simpler in many places, since we don't need the generic parameter on `DepNode` anymore. See #42294 for details. ~~NOTE: Only the last commit of this is new, the rest is already reviewed in #42504 This PR is almost done but there are some things I still want to do: - [x] Add some module-level documentation to `dep_node.rs`, explaining especially what the `define_dep_nodes!()` macro is about. - [x] Do another pass over the dep-graph loading logic. I suspect that we can get rid of building the `edges` map and also use arrays instead of hash maps in some places. cc @rust-lang/compiler r? @nikomatsakis
☀️ Test successful - status-appveyor, status-travis |
incr.comp.: Make DepNode's std::fmt::Debug implementation useful again. With #42537 a regular `DepNode` only contains an opaque hash as its identifier. In most cases, this hash is actually a `DefPathHash` and we can reconstruct the `DefId` it came from via a table lookup --- and then use that to print something intelligible for debug outputs. For cases where we cannot reconstruct information from the DepNode's hash, this PR will cache a string representation of the `DepNode` in a side-table. This string is later used for debug outputs. r? @nikomatsakis
incr.comp.: Make DepNode's std::fmt::Debug implementation useful again. With #42537 a regular `DepNode` only contains an opaque hash as its identifier. In most cases, this hash is actually a `DefPathHash` and we can reconstruct the `DefId` it came from via a table lookup --- and then use that to print something intelligible for debug outputs. For cases where we cannot reconstruct information from the DepNode's hash, this PR will cache a string representation of the `DepNode` in a side-table. This string is later used for debug outputs. r? @nikomatsakis
This PR moves
DepNode
to a representation that does not need retracing and thus simplifies comparing dep-graphs from different compilation sessions. The code also gets a lot simpler in many places, since we don't need the generic parameter onDepNode
anymore. See #42294 for details.NOTE: Only the last commit of this is new, the rest is already reviewed in #42504.This PR is almost done but there are some things I still want to do:
dep_node.rs
, explaining especially what thedefine_dep_nodes!()
macro is about.edges
map and also use arrays instead of hash maps in some places.cc @rust-lang/compiler
r? @nikomatsakis