Fix calls to trace.reactivate (there were extra calls in some exec paths)

This commit is contained in:
Grigorii Kirgizov 2019-11-19 15:39:50 +03:00
parent 8fdd80c54e
commit e7b374ce50
2 changed files with 6 additions and 12 deletions

View File

@ -45,8 +45,7 @@ internal class ControllerImpl (
override fun <V : Any> variable(metaLogical: MetaLogical<V>): Logical<V>? = null
})
traceActivated(occ)
trace.activate(occ)
val status = state.processActivated(this, active, NORMAL())
if (status is FAILED) {
throw status.failure.failureCause()
@ -94,7 +93,7 @@ internal class ControllerImpl (
}
override fun reactivate(occ: Occurrence): FeedbackStatus {
trace.reactivateIncremental(occ)
trace.reactivate(occ)
return state.processActivated(this, occ, NORMAL())
}
@ -217,19 +216,12 @@ internal class ControllerImpl (
return context.eval { status ->
constraint.occurrence(this, args, justsCopy(justs), context.logicalContext, context.ruleUniqueTag).let { occ ->
traceActivated(occ)
trace.activate(occ)
state.processActivated(this, occ, status)
}
}
}
private fun traceActivated(occ: Occurrence) =
if (!occ.stored)
trace.activate(occ)
else
trace.reactivate(occ)
private fun askPredicate(predicate: Predicate, context: Context) : Boolean =
profiler.profile<Boolean>("ask_${predicate.symbol()}") {

View File

@ -66,7 +66,9 @@ internal class ProcessingStateImpl(private var dispatchingFront: Dispatcher.Disp
// Incremental reactivation should proceed more like usual activation.
this.dispatchingFront = dispatchingFront.forgetExpanded(activeOcc)
return controller.reactivate(activeOcc)
trace.reactivateIncremental(activeOcc)
return processActivated(controller, activeOcc, FeedbackStatus.NORMAL())
}
/**