Skip to content

Commit

Permalink
Merge pull request #792 from viperproject/meilers_field_read_smcache_fix
Browse files Browse the repository at this point in the history
Properly use snapshot map cache for QP field reads
  • Loading branch information
marcoeilers committed Dec 22, 2023
2 parents 9d7abee + d52b7bd commit 529d2a4
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/main/scala/rules/Evaluator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ object evaluator extends EvaluationRules {
Q(s2, fvfLookup, v1)}
}
case _ =>
val (_, smDef1, pmDef1) =
val (s2, smDef1, pmDef1) =
quantifiedChunkSupporter.heapSummarisingMaps(
s = s1,
resource = fa.field,
Expand All @@ -236,27 +236,26 @@ object evaluator extends EvaluationRules {
optSmDomainDefinitionCondition = None,
optQVarsInstantiations = None,
v = v1)
if (s1.heapDependentTriggers.contains(fa.field)){
if (s2.heapDependentTriggers.contains(fa.field)){
val trigger = FieldTrigger(fa.field.name, smDef1.sm, tRcvr)
v1.decider.assume(trigger)
}
val permCheck =
if (s1.triggerExp) {
if (s2.triggerExp) {
True
} else {
val totalPermissions = PermLookup(fa.field.name, pmDef1.pm, tRcvr)
IsPositive(totalPermissions)
}
v1.decider.assert(permCheck) {
case false =>
createFailure(pve dueTo InsufficientPermission(fa), v1, s1)
createFailure(pve dueTo InsufficientPermission(fa), v1, s2)
case true =>
val smLookup = Lookup(fa.field.name, smDef1.sm, tRcvr)
val fr2 =
s1.functionRecorder.recordSnapshot(fa, v1.decider.pcs.branchConditions, smLookup)
s2.functionRecorder.recordSnapshot(fa, v1.decider.pcs.branchConditions, smLookup)
.recordFvfAndDomain(smDef1)
val s3 = s1.copy(functionRecorder = fr2/*,
smCache = smCache1*/)
val s3 = s2.copy(functionRecorder = fr2)
Q(s3, smLookup, v1)}
}})

Expand Down

0 comments on commit 529d2a4

Please sign in to comment.