diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2025-04-22 03:47:22 +0200 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2025-04-22 16:57:28 +0200 |
| commit | 36fa327623b6013b0a3da6e39ee1e85ac5275cd9 (patch) | |
| tree | dc7463e7f509abd055027e8f74449bdb75f1b63b | |
| parent | 4ec74df81f9a56e2eef5defea6edaa9eecd4fd10 (diff) | |
| download | rust-36fa327623b6013b0a3da6e39ee1e85ac5275cd9.tar.gz rust-36fa327623b6013b0a3da6e39ee1e85ac5275cd9.zip | |
Tweak edges
| -rw-r--r-- | compiler/rustc_query_system/src/dep_graph/serialized.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs index 9dabb26e8b2..0d4913e798d 100644 --- a/compiler/rustc_query_system/src/dep_graph/serialized.rs +++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs @@ -107,14 +107,11 @@ impl SerializedDepGraph { let header = self.edge_list_indices[source]; let mut raw = &self.edge_list_data[header.start()..]; - // The number of edges for this node is implicitly stored in the combination of the byte - // width and the length. let bytes_per_index = header.bytes_per_index(); - let len = header.edges; // LLVM doesn't hoist EdgeHeader::mask so we do it ourselves. let mask = header.mask(); - (0..len).map(move |_| { + (0..header.num_edges).map(move |_| { // Doing this slicing in this order ensures that the first bounds check suffices for // all the others. let index = &raw[..DEP_NODE_SIZE]; @@ -157,7 +154,7 @@ impl SerializedDepGraph { #[derive(Debug, Clone, Copy)] struct EdgeHeader { repr: usize, - edges: u32, + num_edges: u32, } impl EdgeHeader { @@ -206,7 +203,7 @@ impl SerializedDepGraph { ); let mut fingerprints = IndexVec::from_elem_n(Fingerprint::ZERO, node_count); let mut edge_list_indices = - IndexVec::from_elem_n(EdgeHeader { repr: 0, edges: 0 }, node_count); + IndexVec::from_elem_n(EdgeHeader { repr: 0, num_edges: 0 }, node_count); // This estimation assumes that all of the encoded bytes are for the edge lists or for the // fixed-size node headers. But that's not necessarily true; if any edge list has a length @@ -419,10 +416,10 @@ impl<D: Deps> SerializedNodeHeader<D> { } #[inline] - fn edges_header(&self, edge_list_data: &[u8], edges: u32) -> EdgeHeader { + fn edges_header(&self, edge_list_data: &[u8], num_edges: u32) -> EdgeHeader { EdgeHeader { repr: (edge_list_data.len() << DEP_NODE_WIDTH_BITS) | (self.bytes_per_index() - 1), - edges, + num_edges, } } } |
