Skip to content

Commit 36fa327

Browse files
committed
Tweak edges
1 parent 4ec74df commit 36fa327

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

compiler/rustc_query_system/src/dep_graph/serialized.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,11 @@ impl SerializedDepGraph {
107107
let header = self.edge_list_indices[source];
108108
let mut raw = &self.edge_list_data[header.start()..];
109109

110-
// The number of edges for this node is implicitly stored in the combination of the byte
111-
// width and the length.
112110
let bytes_per_index = header.bytes_per_index();
113-
let len = header.edges;
114111

115112
// LLVM doesn't hoist EdgeHeader::mask so we do it ourselves.
116113
let mask = header.mask();
117-
(0..len).map(move |_| {
114+
(0..header.num_edges).map(move |_| {
118115
// Doing this slicing in this order ensures that the first bounds check suffices for
119116
// all the others.
120117
let index = &raw[..DEP_NODE_SIZE];
@@ -157,7 +154,7 @@ impl SerializedDepGraph {
157154
#[derive(Debug, Clone, Copy)]
158155
struct EdgeHeader {
159156
repr: usize,
160-
edges: u32,
157+
num_edges: u32,
161158
}
162159

163160
impl EdgeHeader {
@@ -206,7 +203,7 @@ impl SerializedDepGraph {
206203
);
207204
let mut fingerprints = IndexVec::from_elem_n(Fingerprint::ZERO, node_count);
208205
let mut edge_list_indices =
209-
IndexVec::from_elem_n(EdgeHeader { repr: 0, edges: 0 }, node_count);
206+
IndexVec::from_elem_n(EdgeHeader { repr: 0, num_edges: 0 }, node_count);
210207

211208
// This estimation assumes that all of the encoded bytes are for the edge lists or for the
212209
// 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> {
419416
}
420417

421418
#[inline]
422-
fn edges_header(&self, edge_list_data: &[u8], edges: u32) -> EdgeHeader {
419+
fn edges_header(&self, edge_list_data: &[u8], num_edges: u32) -> EdgeHeader {
423420
EdgeHeader {
424421
repr: (edge_list_data.len() << DEP_NODE_WIDTH_BITS) | (self.bytes_per_index() - 1),
425-
edges,
422+
num_edges,
426423
}
427424
}
428425
}

0 commit comments

Comments
 (0)