diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2025-02-10 20:28:39 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-10 20:28:39 +0900 |
| commit | 67ba6a6acfd886f1c175e0f5a64a3d2228ac143f (patch) | |
| tree | 2d6f32e88ad42b1ced7529c15488473bfe8b2abd /compiler/rustc_data_structures/src/vec_cache.rs | |
| parent | cf15b33e3b8c6a2b1e629af9ae253bf7e4b18799 (diff) | |
| parent | 81f21f0cce8be1e4dd1c8f4b9c6d0434029a13be (diff) | |
| download | rust-67ba6a6acfd886f1c175e0f5a64a3d2228ac143f.tar.gz rust-67ba6a6acfd886f1c175e0f5a64a3d2228ac143f.zip | |
Merge pull request #2244 from rust-lang/rustc-pull
Rustc pull update
Diffstat (limited to 'compiler/rustc_data_structures/src/vec_cache.rs')
| -rw-r--r-- | compiler/rustc_data_structures/src/vec_cache.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/vec_cache.rs b/compiler/rustc_data_structures/src/vec_cache.rs index eb251b587c8..2ff60ab7f36 100644 --- a/compiler/rustc_data_structures/src/vec_cache.rs +++ b/compiler/rustc_data_structures/src/vec_cache.rs @@ -206,6 +206,19 @@ impl SlotIndex { } } +/// In-memory cache for queries whose keys are densely-numbered IDs +/// (e.g `CrateNum`, `LocalDefId`), and can therefore be used as indices +/// into a dense vector of cached values. +/// +/// (As of [#124780] the underlying storage is not an actual `Vec`, but rather +/// a series of increasingly-large buckets, for improved performance when the +/// parallel frontend is using multiple threads.) +/// +/// Each entry in the cache stores the query's return value (`V`), and also +/// an associated index (`I`), which in practice is a `DepNodeIndex` used for +/// query dependency tracking. +/// +/// [#124780]: https://github.com/rust-lang/rust/pull/124780 pub struct VecCache<K: Idx, V, I> { // Entries per bucket: // Bucket 0: 4096 2^12 |
