From f09d474836d14811af1f9ebead4c1649c54e4e4c Mon Sep 17 00:00:00 2001 From: Tyson Nottingham Date: Tue, 3 Nov 2020 22:23:08 -0800 Subject: Use PackedFingerprint in DepNode to reduce memory consumption --- compiler/rustc_query_system/src/dep_graph/dep_node.rs | 8 ++++---- compiler/rustc_query_system/src/dep_graph/graph.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'compiler/rustc_query_system/src') 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 7808a28dff0..2ab3834468c 100644 --- a/compiler/rustc_query_system/src/dep_graph/dep_node.rs +++ b/compiler/rustc_query_system/src/dep_graph/dep_node.rs @@ -44,7 +44,7 @@ use super::{DepContext, DepKind}; -use rustc_data_structures::fingerprint::Fingerprint; +use rustc_data_structures::fingerprint::{Fingerprint, PackedFingerprint}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use std::fmt; @@ -53,7 +53,7 @@ use std::hash::Hash; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Encodable, Decodable)] pub struct DepNode { pub kind: K, - pub hash: Fingerprint, + pub hash: PackedFingerprint, } impl DepNode { @@ -62,7 +62,7 @@ impl DepNode { /// does not require any parameters. pub fn new_no_params(kind: K) -> DepNode { debug_assert!(!kind.has_params()); - DepNode { kind, hash: Fingerprint::ZERO } + DepNode { kind, hash: PackedFingerprint(Fingerprint::ZERO) } } pub fn construct(tcx: Ctxt, kind: K, arg: &Key) -> DepNode @@ -71,7 +71,7 @@ impl DepNode { Key: DepNodeParams, { let hash = arg.to_fingerprint(tcx); - let dep_node = DepNode { kind, hash }; + let dep_node = DepNode { kind, hash: PackedFingerprint(hash) }; #[cfg(debug_assertions)] { diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs index d9b687c48af..893017ac3bc 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fingerprint::Fingerprint; +use rustc_data_structures::fingerprint::{Fingerprint, PackedFingerprint}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::profiling::QueryInvocationId; use rustc_data_structures::sharded::{self, Sharded}; @@ -976,7 +976,7 @@ impl CurrentDepGraph { // Fingerprint::combine() is faster than sending Fingerprint // through the StableHasher (at least as long as StableHasher // is so slow). - hash: self.anon_id_seed.combine(hasher.finish()), + hash: PackedFingerprint(self.anon_id_seed.combine(hasher.finish())), }; self.intern_node(target_dep_node, task_deps.reads, Fingerprint::ZERO) -- cgit 1.4.1-3-g733a5