diff options
| author | bors <bors@rust-lang.org> | 2021-01-08 18:16:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-08 18:16:00 +0000 |
| commit | 26438b473883ea607b30288e461187f0fb2fe589 (patch) | |
| tree | 367872d4228bcc704926734c49695738999bdd34 /compiler/rustc_query_system | |
| parent | ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09 (diff) | |
| parent | 0f334c3642257f711e0c397fec11707d86e14e70 (diff) | |
| download | rust-26438b473883ea607b30288e461187f0fb2fe589.tar.gz rust-26438b473883ea607b30288e461187f0fb2fe589.zip | |
Auto merge of #78452 - cjgillot:ddk-struct, r=Mark-Simulacrum
Access query (DepKind) metadata through fields This refactors the access to query definition metadata (attributes such as eval always, anon, has_params) and loading/forcing functions to generate a number of structs, instead of matching on the DepKind enum. This makes access to the fields cheaper to compile. Using a struct means that finding the metadata for a given query is just an offset away; previously the match may have been compiled to a jump table but likely not completely inlined as we expect here. A previous attempt explored a similar strategy, but using trait objects in #78314 that proved less effective, likely due to higher overheads due to forcing dynamic calls and poorer cache utilization (all metadata is fairly densely packed with this PR).
Diffstat (limited to 'compiler/rustc_query_system')
| -rw-r--r-- | compiler/rustc_query_system/src/dep_graph/dep_node.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_query_system/src/dep_graph/mod.rs | 2 |
2 files changed, 1 insertions, 7 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/dep_node.rs b/compiler/rustc_query_system/src/dep_graph/dep_node.rs index ff52fdab19c..64aba870502 100644 --- a/compiler/rustc_query_system/src/dep_graph/dep_node.rs +++ b/compiler/rustc_query_system/src/dep_graph/dep_node.rs @@ -153,12 +153,6 @@ where } } -impl<Ctxt: DepContext> DepNodeParams<Ctxt> for () { - fn to_fingerprint(&self, _: Ctxt) -> Fingerprint { - Fingerprint::ZERO - } -} - /// A "work product" corresponds to a `.o` (or other) file that we /// save in between runs. These IDs do not have a `DefId` but rather /// some independent path or string that persists between runs without diff --git a/compiler/rustc_query_system/src/dep_graph/mod.rs b/compiler/rustc_query_system/src/dep_graph/mod.rs index da0b5aad6c8..b1c901633a7 100644 --- a/compiler/rustc_query_system/src/dep_graph/mod.rs +++ b/compiler/rustc_query_system/src/dep_graph/mod.rs @@ -61,7 +61,7 @@ pub trait DepContext: Copy { } /// Describe the different families of dependency nodes. -pub trait DepKind: Copy + fmt::Debug + Eq + Ord + Hash { +pub trait DepKind: Copy + fmt::Debug + Eq + Hash { const NULL: Self; /// Return whether this kind always require evaluation. |
