Skip to content

Commit

Permalink
Fixing issue #845 (#846)
Browse files Browse the repository at this point in the history
Reusing more cached snapshot maps
  • Loading branch information
marcoeilers authored Jun 7, 2024
1 parent ad3593f commit 2209768
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/rules/QuantifiedChunkSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ object quantifiedChunkSupporter extends QuantifiedChunkSupport {
codomainQVars,
relevantChunks,
v1,
optSmDomainDefinitionCondition = if (s2.smDomainNeeded) Some(True) else None,
optSmDomainDefinitionCondition = None,
optQVarsInstantiations = Some(arguments))
val permsTaken = result match {
case Complete() => rPerm
Expand Down Expand Up @@ -1332,7 +1332,7 @@ object quantifiedChunkSupporter extends QuantifiedChunkSupport {
resource = resource,
codomainQVars = codomainQVars,
relevantChunks = relevantChunks,
optSmDomainDefinitionCondition = if (s1.smDomainNeeded) Some(True) else None,
optSmDomainDefinitionCondition = None,
optQVarsInstantiations = Some(arguments),
v = v)
val s2 = s1.copy(functionRecorder = s1.functionRecorder.recordFvfAndDomain(smDef1),
Expand Down
5 changes: 4 additions & 1 deletion src/main/scala/state/SnapshotMapCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ case class SnapshotMapCache private (
: Option[SnapshotMapCache.Value] = {

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

case _ =>
Expand Down

0 comments on commit 2209768

Please sign in to comment.