summary refs log tree commit diff
path: root/compiler/rustc_query_system
diff options
context:
space:
mode:
authorTyson Nottingham <tgnottingham@gmail.com>2020-11-03 22:23:08 -0800
committerTyson Nottingham <tgnottingham@gmail.com>2020-11-18 12:49:09 -0800
commitf09d474836d14811af1f9ebead4c1649c54e4e4c (patch)
treeddf66a7bde0377b6618015c6090a0818577f608d /compiler/rustc_query_system
parent8d2d0014922e9f541694bfe87642749239990e0e (diff)
downloadrust-f09d474836d14811af1f9ebead4c1649c54e4e4c.tar.gz
rust-f09d474836d14811af1f9ebead4c1649c54e4e4c.zip
Use PackedFingerprint in DepNode to reduce memory consumption
Diffstat (limited to 'compiler/rustc_query_system')
-rw-r--r--compiler/rustc_query_system/src/dep_graph/dep_node.rs8
-rw-r--r--compiler/rustc_query_system/src/dep_graph/graph.rs4
2 files changed, 6 insertions, 6 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 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<K> {
     pub kind: K,
-    pub hash: Fingerprint,
+    pub hash: PackedFingerprint,
 }
 
 impl<K: DepKind> DepNode<K> {
@@ -62,7 +62,7 @@ impl<K: DepKind> DepNode<K> {
     /// does not require any parameters.
     pub fn new_no_params(kind: K) -> DepNode<K> {
         debug_assert!(!kind.has_params());
-        DepNode { kind, hash: Fingerprint::ZERO }
+        DepNode { kind, hash: PackedFingerprint(Fingerprint::ZERO) }
     }
 
     pub fn construct<Ctxt, Key>(tcx: Ctxt, kind: K, arg: &Key) -> DepNode<K>
@@ -71,7 +71,7 @@ impl<K: DepKind> DepNode<K> {
         Key: DepNodeParams<Ctxt>,
     {
         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<K: DepKind> CurrentDepGraph<K> {
             // 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)