From 558b0688957d052d7a050317d579a70f0a9792ac Mon Sep 17 00:00:00 2001 From: Fedor Isakov Date: Wed, 20 Jun 2018 17:51:22 +0200 Subject: [PATCH] Disable an awkward optimization that had caused problems (failure to yield a correct match). --- .../mps/logic/reactor/core/PartialMatchTrie.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/reactor/Core/src/jetbrains/mps/logic/reactor/core/PartialMatchTrie.kt b/reactor/Core/src/jetbrains/mps/logic/reactor/core/PartialMatchTrie.kt index 32cb5618..8c73c8cc 100644 --- a/reactor/Core/src/jetbrains/mps/logic/reactor/core/PartialMatchTrie.kt +++ b/reactor/Core/src/jetbrains/mps/logic/reactor/core/PartialMatchTrie.kt @@ -73,14 +73,14 @@ internal class MatchTrieSet(val rule: Rule, val profiler: Profiler?) { val constraints = keptConstraints + discardedConstraints val relevantTries = ArrayList() - val newTries = ArrayList() + val copyTries = ArrayList() for (t in tries) { if (!t.vacant.isEmpty) { - newTries.add(t) + copyTries.add(t) for (idx in t.vacant.stream()) { if (constraints[idx].probablyMatches(activeOcc)) { relevantTries.add(PartialMatchTrie(activeOcc, occIndex, t)) - newTries.removeAt(newTries.size - 1) + copyTries.removeAt(copyTries.size - 1) break } } @@ -91,10 +91,10 @@ internal class MatchTrieSet(val rule: Rule, val profiler: Profiler?) { } this.tries.clear() - this.tries.addAll(newTries) + this.tries.addAll(copyTries) this.tries.addAll(relevantTries) - return relevantTries.asSequence().flatMap { t -> t.matches() } + return tries.asSequence().flatMap { t -> t.matches() } } inner class PartialMatchTrie(val activeOcc: ConstraintOccurrence, @@ -317,7 +317,8 @@ internal class MatchTrieSet(val rule: Rule, val profiler: Profiler?) { else { val (result, auxOccurrences) = lookupAuxOccurrences(nextCst) when (result) { - Result.DEFINITIVE -> parent + // FIXME: this optimization is causing major problems, drop it? + Result.DEFINITIVE -> null /*parent*/ Result.NONE -> this Result.INCONCLUSIVE -> null }?.forEachInPath { mtn -> mtn.setSeen() }