-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
use sparse bitsets instead of dense ones for NLL results #48170
Copy link
Copy link
Closed
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.I-compilememIssue: Problems and improvements with respect to memory usage during compilation.Issue: Problems and improvements with respect to memory usage during compilation.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone
Metadata
Metadata
Assignees
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.I-compilememIssue: Problems and improvements with respect to memory usage during compilation.Issue: Problems and improvements with respect to memory usage during compilation.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
As part of #47879, it seems clear that using dense bitsets is going to be a problem for NLL sooner or later. We should move to a sparse set. I think that the
BTreeMapidea sketched in #47575 may be a good choice.The NLL region representation is defined here:
rust/src/librustc_mir/borrow_check/nll/region_infer/values.rs
Lines 186 to 200 in 16362c7
In particular, the field
matrixuses aBitMatrix. The "rows" in the matrix are inference variables, and the columns are the indices defined here (either cfg points or universal regions).I think we should add a new type
SparseBitMatrixthat offers the same API asBitMatrix. It might be represented with aVec<SparseSet>, per #47575, whereSparseSetis a bit set represented as sketched in this comment. Or it might even just use a singleSparseSetinternally, where each bit is indexed by an indexI = (row * num_columns) + column.