Skip to content

Commit 2209768

Browse files
authored
Fixing issue #845 (#846)
Reusing more cached snapshot maps
1 parent ad3593f commit 2209768

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/main/scala/rules/QuantifiedChunkSupport.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ object quantifiedChunkSupporter extends QuantifiedChunkSupport {
12871287
codomainQVars,
12881288
relevantChunks,
12891289
v1,
1290-
optSmDomainDefinitionCondition = if (s2.smDomainNeeded) Some(True) else None,
1290+
optSmDomainDefinitionCondition = None,
12911291
optQVarsInstantiations = Some(arguments))
12921292
val permsTaken = result match {
12931293
case Complete() => rPerm
@@ -1332,7 +1332,7 @@ object quantifiedChunkSupporter extends QuantifiedChunkSupport {
13321332
resource = resource,
13331333
codomainQVars = codomainQVars,
13341334
relevantChunks = relevantChunks,
1335-
optSmDomainDefinitionCondition = if (s1.smDomainNeeded) Some(True) else None,
1335+
optSmDomainDefinitionCondition = None,
13361336
optQVarsInstantiations = Some(arguments),
13371337
v = v)
13381338
val s2 = s1.copy(functionRecorder = s1.functionRecorder.recordFvfAndDomain(smDef1),

src/main/scala/state/SnapshotMapCache.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ case class SnapshotMapCache private (
4646
: Option[SnapshotMapCache.Value] = {
4747

4848
cache.get(key) match {
49-
case Some((smDef, totalPermissions, `optSmDomainDefinitionCondition`)) =>
49+
case Some((smDef, totalPermissions, cachedSmDomainDefinitionCondition))
50+
if cachedSmDomainDefinitionCondition == optSmDomainDefinitionCondition || // defined under the same condition
51+
(cachedSmDomainDefinitionCondition.contains(terms.True) && optSmDomainDefinitionCondition.isEmpty) // cached is always defined and we don't need a domain
52+
=>
5053
Some((smDef, totalPermissions))
5154

5255
case _ =>

0 commit comments

Comments
 (0)