Clear LogicalState for occurrences dropped during incremental invalidation
This commit is contained in:
parent
f13691668c
commit
43e39ca4a1
|
|
@ -64,9 +64,8 @@ internal class ConstraintsProcessing(private var dispatchingFront: Dispatcher.Di
|
|||
fun activateContinue(controller: Controller, activeOcc: Occurrence, parent: MatchJournal.MatchChunk): FeedbackStatus {
|
||||
assert(activeOcc.stored)
|
||||
|
||||
// Forget that occ was seen. Otherwise it will be
|
||||
// Forget that occurrence was seen. Otherwise it will be
|
||||
// processed as with reactivation through observers.
|
||||
// Incremental reactivation should proceed more like usual activation.
|
||||
this.dispatchingFront = dispatchingFront.forgetExpanded(activeOcc)
|
||||
|
||||
trace.activateContinue(activeOcc)
|
||||
|
|
@ -113,10 +112,10 @@ internal class ConstraintsProcessing(private var dispatchingFront: Dispatcher.Di
|
|||
}
|
||||
|
||||
private fun invalidateChunk(chunk: MatchJournal.Chunk, invalidJustifications: Collection<Justified>): Iterable<Occurrence> {
|
||||
// 'Undo' all activated in this chunk occurrences
|
||||
// todo: need clearing observers in logicalState for occurrences we drop?
|
||||
// 'Undo' all activated in this chunk occurrences: clear Dispatcher & LogicalState
|
||||
chunk.activatedLog().forEach {
|
||||
dispatchingFront = dispatchingFront.forget(it)
|
||||
it.clearLogicalState(logicalState)
|
||||
}
|
||||
|
||||
val validOccs: Sequence<Occurrence>
|
||||
|
|
@ -339,9 +338,7 @@ internal class ConstraintsProcessing(private var dispatchingFront: Dispatcher.Di
|
|||
|
||||
profiler.profile("terminateOccurrence") {
|
||||
|
||||
occ.terminate(logicalState)
|
||||
|
||||
occurrenceContractObserver?.onDiscarded(occ)
|
||||
occ.clearLogicalState(logicalState)
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -351,6 +348,13 @@ internal class ConstraintsProcessing(private var dispatchingFront: Dispatcher.Di
|
|||
}
|
||||
}
|
||||
|
||||
private fun Occurrence.clearLogicalState(observable: LogicalStateObservable) {
|
||||
terminate(logicalState)
|
||||
if (occurrenceContractObserver != null && this.isPrincipal) {
|
||||
occurrenceContractObserver.onDiscarded(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Incapsulates logic for deriving [Evidence] and [Justifications] for a new [Occurrence].
|
||||
|
|
|
|||
Loading…
Reference in New Issue