about summary refs log tree commit diff
path: root/compiler/rustc_query_system
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2025-05-05 21:01:43 +0200
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2025-05-05 21:01:43 +0200
commite1e8857d544b743419a8caddb7f4b5e0fb9610f4 (patch)
treea9d243a91b53c1b5dda948da5644814dd9e6f164 /compiler/rustc_query_system
parentaeab2819f650d180eb0e7238ff8a0733af70b3ae (diff)
downloadrust-e1e8857d544b743419a8caddb7f4b5e0fb9610f4.tar.gz
rust-e1e8857d544b743419a8caddb7f4b5e0fb9610f4.zip
Add some comments about thread local indices
Diffstat (limited to 'compiler/rustc_query_system')
-rw-r--r--compiler/rustc_query_system/src/dep_graph/serialized.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs
index b5eda7b04a7..b01f65a5e45 100644
--- a/compiler/rustc_query_system/src/dep_graph/serialized.rs
+++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs
@@ -12,7 +12,7 @@
 //! node and edge count are stored at the end of the file, all the arrays can be
 //! pre-allocated with the right length.
 //!
-//! The encoding of the de-pgraph is generally designed around the fact that fixed-size
+//! The encoding of the dep-graph is generally designed around the fact that fixed-size
 //! reads of encoded data are generally faster than variable-sized reads. Ergo we adopt
 //! essentially the same varint encoding scheme used in the rmeta format; the edge lists
 //! for each node on the graph store a 2-bit integer which is the number of bytes per edge
@@ -34,6 +34,10 @@
 //! [`DepKind`], number of edges, and bytes per edge are all bit-packed together, if they fit.
 //! If the number of edges in this node does not fit in the bits available in the header, we
 //! store it directly after the header with leb128.
+//!
+//! Dep-graph indices are bulk allocated to threads inside `LocalEncoderState`. Having threads
+//! own these indices helps avoid races when they are conditionally used when marking nodes green.
+//! It also reduces congestion on the shared index count.
 
 use std::cell::RefCell;
 use std::cmp::max;