From 1214610451e221e9036be38aa9bb52298c5c4c12 Mon Sep 17 00:00:00 2001 From: XFFXFF <1247714429@qq.com> Date: Sat, 24 Sep 2022 01:02:29 +0000 Subject: [PATCH] remove inputs method of QueryEdges --- .../salsa-2022/src/function/accumulated.rs | 20 ++++++++----------- .../salsa-2022/src/runtime/local_state.rs | 15 ++------------ 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/components/salsa-2022/src/function/accumulated.rs b/components/salsa-2022/src/function/accumulated.rs index b44d737b..1a159b65 100644 --- a/components/salsa-2022/src/function/accumulated.rs +++ b/components/salsa-2022/src/function/accumulated.rs @@ -1,7 +1,6 @@ use crate::{ hash::FxHashSet, - key::DependencyIndex, - runtime::local_state::QueryOrigin, + runtime::local_state::{EdgeKind, QueryOrigin}, storage::{HasJar, HasJarsDyn}, DatabaseKeyIndex, }; @@ -67,18 +66,15 @@ impl Stack { match origin { None | Some(QueryOrigin::Assigned(_)) | Some(QueryOrigin::BaseInput) => {} Some(QueryOrigin::Derived(edges)) | Some(QueryOrigin::DerivedUntracked(edges)) => { - for DependencyIndex { - ingredient_index, - key_index, - } in edges.inputs().iter().copied() + for (_, dependency_index) in edges + .input_outputs + .iter() + .filter(|edge| edge.0 == EdgeKind::Input) + .copied() { - if let Some(key_index) = key_index { - let i = DatabaseKeyIndex { - ingredient_index, - key_index, - }; + if let Ok(i) = DatabaseKeyIndex::try_from(dependency_index) { if self.s.insert(i) { - self.v.push(i); + self.v.push(i) } } } diff --git a/components/salsa-2022/src/runtime/local_state.rs b/components/salsa-2022/src/runtime/local_state.rs index 3d0bb3c5..caa3ba91 100644 --- a/components/salsa-2022/src/runtime/local_state.rs +++ b/components/salsa-2022/src/runtime/local_state.rs @@ -76,7 +76,7 @@ pub enum QueryOrigin { impl QueryOrigin { /// Indices for queries *written* by this query (or `vec![]` if its value was assigned). - pub(crate) fn outputs(&self) -> impl Iterator + '_ { + pub(crate) fn outputs(&self) -> impl Iterator { let slice = match self { QueryOrigin::Derived(edges) | QueryOrigin::DerivedUntracked(edges) => edges.outputs(), QueryOrigin::Assigned(_) | QueryOrigin::BaseInput => vec![], @@ -115,18 +115,7 @@ pub struct QueryEdges { } impl QueryEdges { - /// Returns the (tracked) inputs that were executed in computing this memoized value. - /// - /// These will always be in execution order. - pub(crate) fn inputs(&self) -> Vec { - self.input_outputs - .iter() - .filter(|(edge_kind, _)| *edge_kind == EdgeKind::Input) - .map(|(_, dependency_index)| *dependency_index) - .collect() - } - - /// Returns the (tracked) inputs that were executed in computing this memoized value. + /// Returns the (tracked) outputs that were executed in computing this memoized value. /// /// These will always be in execution order. pub(crate) fn outputs(&self) -> Vec {