Separate Analysis and Results.
`Results` contains and `Analysis` and an `EntryStates`. The unfortunate thing about this is that the analysis needs to be mutable everywhere (`&mut Analysis`) which forces the `Results` to be mutable everywhere, even though `EntryStates` is immutable everywhere. To fix this, this commit renames `Results` as `AnalysisAndResults`, renames `EntryStates` as `Results`, and separates the analysis and results as much as possible. (`AnalysisAndResults` doesn't get much use, it's mostly there to facilitate method chaining of `iterate_to_fixpoint`.) `Results` is immutable everywhere, which: - is a bit clearer on how the data is used, - avoids an unnecessary clone of entry states in `locals_live_across_suspend_points`, and - moves the results outside the `RefCell` in Formatter. The commit also reformulates `ResultsHandle` as the generic `CowMut`, which is simpler than `ResultsHandle` because it doesn't need the `'tcx` lifetime and the trait bounds. It also which sits nicely alongside the new use of `Cow` in `ResultsCursor`.
This commit is contained in:
@@ -98,7 +98,8 @@ rustc_index::newtype_index! {
|
||||
pub fn save_as_intervals<'tcx, N, A>(
|
||||
elements: &DenseLocationMap,
|
||||
body: &mir::Body<'tcx>,
|
||||
mut results: Results<'tcx, A>,
|
||||
mut analysis: A,
|
||||
results: Results<A::Domain>,
|
||||
) -> SparseIntervalMatrix<N, PointIndex>
|
||||
where
|
||||
N: Idx,
|
||||
@@ -109,7 +110,8 @@ where
|
||||
visit_results(
|
||||
body,
|
||||
body.basic_blocks.reverse_postorder().iter().copied(),
|
||||
&mut results,
|
||||
&mut analysis,
|
||||
&results,
|
||||
&mut visitor,
|
||||
);
|
||||
visitor.values
|
||||
|
||||
Reference in New Issue
Block a user