From 65a8681a1701fa01e62a9fc9698e682df465f2ec Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Wed, 17 Mar 2021 19:23:17 +0100 Subject: Add documentation. --- compiler/rustc_query_system/src/dep_graph/serialized.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'compiler/rustc_query_system') diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs index ab97222e19a..663113543fc 100644 --- a/compiler/rustc_query_system/src/dep_graph/serialized.rs +++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs @@ -1,4 +1,16 @@ //! The data that we will serialize and deserialize. +//! +//! The dep-graph is serialized as a sequence of NodeInfo, with the dependencies +//! specified inline. The total number of nodes and edges are stored as the last +//! 16 bytes of the file, so we can find them easily at decoding time. +//! +//! The serialisation is performed on-demand when each node is emitted. Using this +//! scheme, we do not need to keep the current graph in memory. +//! +//! The deserisalisation is performed manually, in order to convert from the stored +//! sequence of NodeInfos to the different arrays in SerializedDepGraph. Since the +//! node and edge count are stored at the end of the file, all the arrays can be +//! pre-allocated with the right length. use super::query::DepGraphQuery; use super::{DepKind, DepNode, DepNodeIndex}; -- cgit 1.4.1-3-g733a5