diff --git a/src/function.rs b/src/function.rs index 34987f107..e6e36be57 100644 --- a/src/function.rs +++ b/src/function.rs @@ -685,9 +685,6 @@ mod persistence { QueryOrigin::assigned(key) } - QueryOriginRef::FixpointInitial => unreachable!( - "`should_serialize` returns `false` for provisional queries" - ), }; let memo = memo.with_origin(flattened_origin); diff --git a/src/function/maybe_changed_after.rs b/src/function/maybe_changed_after.rs index 6ea17b13f..abc600e40 100644 --- a/src/function/maybe_changed_after.rs +++ b/src/function/maybe_changed_after.rs @@ -440,14 +440,6 @@ where // in rev 1 but not in rev 2. VerifyResult::changed() } - // Return `Unchanged` similar to the initial value that we insert - // when we hit the cycle. Any dependencies accessed when creating the fixpoint initial - // are tracked by the outer query. Nothing should have changed assuming that the - // fixpoint initial function is deterministic. - QueryOriginRef::FixpointInitial => { - cycle_heads.insert_head(database_key_index); - VerifyResult::unchanged() - } QueryOriginRef::DerivedUntracked(_) => { // Untracked inputs? Have to assume that it changed. VerifyResult::changed() diff --git a/src/function/memo.rs b/src/function/memo.rs index 4d259bb1d..7c25da750 100644 --- a/src/function/memo.rs +++ b/src/function/memo.rs @@ -58,7 +58,7 @@ impl IngredientImpl { } /// Evicts the existing memo for the given key, replacing it - /// with an equivalent memo that has no value. If the memo is untracked, FixpointInitial, + /// with an equivalent memo that has no value. If the memo is untracked /// or has values assigned as output of another query, this has no effect. pub(super) fn evict_value_from_memo_for( table: MemoTableWithTypesMut<'_>, @@ -66,9 +66,7 @@ impl IngredientImpl { ) { let map = |memo: &mut Memo<'static, C>| { match memo.revisions.origin.as_ref() { - QueryOriginRef::Assigned(_) - | QueryOriginRef::DerivedUntracked(_) - | QueryOriginRef::FixpointInitial => { + QueryOriginRef::Assigned(_) | QueryOriginRef::DerivedUntracked(_) => { // Careful: Cannot evict memos whose values were // assigned as output of another query // or those with untracked inputs diff --git a/src/zalsa_local.rs b/src/zalsa_local.rs index ac06a6de7..b1b180be7 100644 --- a/src/zalsa_local.rs +++ b/src/zalsa_local.rs @@ -628,7 +628,7 @@ impl QueryRevisions { Self { changed_at: Revision::start(), durability: Durability::MAX, - origin: QueryOrigin::fixpoint_initial(), + origin: QueryOrigin::derived(Box::default()), #[cfg(feature = "accumulator")] accumulated_inputs: Default::default(), verified_final: AtomicBool::new(false), @@ -813,9 +813,6 @@ pub enum QueryOriginRef<'a> { /// The [`QueryEdges`] argument contains a listing of all the inputs we saw /// (but we know there were more). DerivedUntracked(&'a [QueryEdge]) = QueryOriginKind::DerivedUntracked as u8, - - /// The value is an initial provisional value for a query that supports fixpoint iteration. - FixpointInitial = QueryOriginKind::FixpointInitial as u8, } impl<'a> QueryOriginRef<'a> { @@ -825,7 +822,7 @@ impl<'a> QueryOriginRef<'a> { pub(crate) fn inputs(self) -> impl DoubleEndedIterator + use<'a> { let opt_edges = match self { QueryOriginRef::Derived(edges) | QueryOriginRef::DerivedUntracked(edges) => Some(edges), - QueryOriginRef::Assigned(_) | QueryOriginRef::FixpointInitial => None, + QueryOriginRef::Assigned(_) => None, }; opt_edges.into_iter().flat_map(input_edges) } @@ -834,7 +831,7 @@ impl<'a> QueryOriginRef<'a> { pub(crate) fn outputs(self) -> impl DoubleEndedIterator + use<'a> { let opt_edges = match self { QueryOriginRef::Derived(edges) | QueryOriginRef::DerivedUntracked(edges) => Some(edges), - QueryOriginRef::Assigned(_) | QueryOriginRef::FixpointInitial => None, + QueryOriginRef::Assigned(_) => None, }; opt_edges.into_iter().flat_map(output_edges) } @@ -843,7 +840,7 @@ impl<'a> QueryOriginRef<'a> { pub(crate) fn edges(self) -> &'a [QueryEdge] { let opt_edges = match self { QueryOriginRef::Derived(edges) | QueryOriginRef::DerivedUntracked(edges) => Some(edges), - QueryOriginRef::Assigned(_) | QueryOriginRef::FixpointInitial => None, + QueryOriginRef::Assigned(_) => None, }; opt_edges.unwrap_or_default() @@ -856,11 +853,6 @@ impl<'a> QueryOriginRef<'a> { #[derive(Clone, Copy)] #[repr(u8)] enum QueryOriginKind { - /// An initial provisional value. - /// - /// This will occur occur in queries that support fixpoint iteration. - FixpointInitial = 0b00, - /// The value was assigned as the output of another query. /// /// This can, for example, can occur when `specify` is used. @@ -896,8 +888,6 @@ pub struct QueryOrigin { /// /// For `QueryOriginKind::Assigned`, this is the `IngredientIndex` of assigning query. /// Combined with the `Id` data, this forms a complete `DatabaseKeyIndex`. - /// - /// For `QueryOriginKind::FixpointInitial`, this field is zero. metadata: u32, } @@ -923,9 +913,6 @@ union QueryOriginData { /// The identity of the assigning query for `QueryOriginKind::Assigned`. index: Id, - - /// `QueryOriginKind::FixpointInitial` holds no data. - empty: (), } /// SAFETY: The `input_outputs` pointer is owned and not accessed or shared concurrently. @@ -934,15 +921,6 @@ unsafe impl Send for QueryOriginData {} unsafe impl Sync for QueryOriginData {} impl QueryOrigin { - /// Create a query origin of type `QueryOriginKind::FixpointInitial`. - pub fn fixpoint_initial() -> QueryOrigin { - QueryOrigin { - kind: QueryOriginKind::FixpointInitial, - metadata: 0, - data: QueryOriginData { empty: () }, - } - } - pub fn is_derived_untracked(&self) -> bool { matches!(self.kind, QueryOriginKind::DerivedUntracked) } @@ -1021,8 +999,6 @@ impl QueryOrigin { QueryOriginRef::DerivedUntracked(input_outputs) } - - QueryOriginKind::FixpointInitial => QueryOriginRef::FixpointInitial, } } } @@ -1051,14 +1027,12 @@ impl<'de> serde::Deserialize<'de> for QueryOrigin { Assigned(DatabaseKeyIndex) = QueryOriginKind::Assigned as u8, Derived(Box<[QueryEdge]>) = QueryOriginKind::Derived as u8, DerivedUntracked(Box<[QueryEdge]>) = QueryOriginKind::DerivedUntracked as u8, - FixpointInitial = QueryOriginKind::FixpointInitial as u8, } Ok(match QueryOriginOwned::deserialize(deserializer)? { QueryOriginOwned::Assigned(key) => QueryOrigin::assigned(key), QueryOriginOwned::Derived(edges) => QueryOrigin::derived(edges), QueryOriginOwned::DerivedUntracked(edges) => QueryOrigin::derived_untracked(edges), - QueryOriginOwned::FixpointInitial => QueryOrigin::fixpoint_initial(), }) } } @@ -1083,8 +1057,8 @@ impl Drop for QueryOrigin { }; } - // The data stored for this variants is `Copy`. - QueryOriginKind::FixpointInitial | QueryOriginKind::Assigned => {} + // The data stored for this variant is `Copy`. + QueryOriginKind::Assigned => {} } } }