Skip to content

Commit e1e8857

Browse files
committed
Add some comments about thread local indices
1 parent aeab281 commit e1e8857

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

compiler/rustc_query_system/src/dep_graph/serialized.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! node and edge count are stored at the end of the file, all the arrays can be
1313
//! pre-allocated with the right length.
1414
//!
15-
//! The encoding of the de-pgraph is generally designed around the fact that fixed-size
15+
//! The encoding of the dep-graph is generally designed around the fact that fixed-size
1616
//! reads of encoded data are generally faster than variable-sized reads. Ergo we adopt
1717
//! essentially the same varint encoding scheme used in the rmeta format; the edge lists
1818
//! for each node on the graph store a 2-bit integer which is the number of bytes per edge
@@ -34,6 +34,10 @@
3434
//! [`DepKind`], number of edges, and bytes per edge are all bit-packed together, if they fit.
3535
//! If the number of edges in this node does not fit in the bits available in the header, we
3636
//! store it directly after the header with leb128.
37+
//!
38+
//! Dep-graph indices are bulk allocated to threads inside `LocalEncoderState`. Having threads
39+
//! own these indices helps avoid races when they are conditionally used when marking nodes green.
40+
//! It also reduces congestion on the shared index count.
3741
3842
use std::cell::RefCell;
3943
use std::cmp::max;

0 commit comments

Comments
 (0)