From 0e493160c0cdbaa71f61af64fd7c439410e8c8b1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 12 Sep 2018 17:16:58 +0300 Subject: store params in the graph --- crates/libanalysis/src/db.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'crates') diff --git a/crates/libanalysis/src/db.rs b/crates/libanalysis/src/db.rs index d67cc189c..d30e75fe2 100644 --- a/crates/libanalysis/src/db.rs +++ b/crates/libanalysis/src/db.rs @@ -91,12 +91,13 @@ impl Clone for Db { } } +type QueryDeps = Vec<(QueryInvocationId, Arc, OutputHash)>; #[derive(Default, Debug)] pub(crate) struct Cache { gen: Gen, green: im::HashMap, - deps: im::HashMap>, + deps: im::HashMap, results: im::HashMap>, } @@ -124,7 +125,7 @@ impl Cache { pub(crate) struct QueryCtx { db: Arc, - stack: RefCell)>>, + stack: RefCell>, pub(crate) trace: RefCell>, } @@ -148,7 +149,8 @@ impl QueryCtx { { let mut stack = self.stack.borrow_mut(); if let Some((_, ref mut deps)) = stack.last_mut() { - deps.push((me, output_hash::(&res))); + let params = Arc::new(params.clone()); + deps.push((me, params, output_hash::(&res))); } } @@ -161,7 +163,7 @@ impl QueryCtx { pub(crate) trait Query { const ID: u32; - type Params: Hash + Eq + Debug + Any + 'static; + type Params: Hash + Eq + Debug + Clone + Any + 'static; type Output: Hash + Debug + Any + 'static; } @@ -212,7 +214,7 @@ where }; let deps_are_fresh = cache.deps[&id] .iter() - .all(|&(dep_id, dep_hash)| { + .all(|&(dep_id, _, dep_hash)| { match cache.green.get(&dep_id) { //TODO: store the value of parameters, and re-execute the query Some((gen, hash)) if gen == &curr_gen && hash == &dep_hash => true, -- cgit v1.2.3