summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Absy.cs21
-rw-r--r--Source/Core/LambdaHelper.cs2
-rw-r--r--Source/ExecutionEngine/ExecutionEngine.cs2
-rw-r--r--Source/ExecutionEngine/VerificationResultCache.cs56
4 files changed, 80 insertions, 1 deletions
diff --git a/Source/Core/Absy.cs b/Source/Core/Absy.cs
index 649b4930..9a871e93 100644
--- a/Source/Core/Absy.cs
+++ b/Source/Core/Absy.cs
@@ -2013,6 +2013,27 @@ namespace Microsoft.Boogie {
// the body is only set if the function is declared with {:inline}
public Expr Body;
public Axiom DefinitionAxiom;
+
+ public IList<Axiom> otherDefinitionAxioms;
+ public IEnumerable<Axiom> OtherDefinitionAxioms
+ {
+ get
+ {
+ return otherDefinitionAxioms;
+ }
+ }
+
+ public void AddOtherDefinitionAxiom(Axiom axiom)
+ {
+ Contract.Requires(axiom != null);
+
+ if (otherDefinitionAxioms == null)
+ {
+ otherDefinitionAxioms = new List<Axiom>();
+ }
+ otherDefinitionAxioms.Add(axiom);
+ }
+
public bool doingExpansion;
private bool neverTrigger;
diff --git a/Source/Core/LambdaHelper.cs b/Source/Core/LambdaHelper.cs
index 6b435836..81da2cce 100644
--- a/Source/Core/LambdaHelper.cs
+++ b/Source/Core/LambdaHelper.cs
@@ -96,7 +96,7 @@ namespace Microsoft.Boogie {
if (0 < CommandLineOptions.Clo.VerifySnapshots && QKeyValue.FindStringAttribute(lambdaAttrs, "checksum") == null)
{
// Attach a dummy checksum to avoid issues in the dependency analysis.
- var checksumAttr = new QKeyValue(lambda.tok, "checksum", new List<object> { "dummy" }, null);
+ var checksumAttr = new QKeyValue(lambda.tok, "checksum", new List<object> { "stable" }, null);
if (lambdaAttrs == null)
{
lambdaAttrs = checksumAttr;
diff --git a/Source/ExecutionEngine/ExecutionEngine.cs b/Source/ExecutionEngine/ExecutionEngine.cs
index 74d299d1..f1f18667 100644
--- a/Source/ExecutionEngine/ExecutionEngine.cs
+++ b/Source/ExecutionEngine/ExecutionEngine.cs
@@ -871,6 +871,8 @@ namespace Microsoft.Boogie
Implementation[] stablePrioritizedImpls = null;
if (0 < CommandLineOptions.Clo.VerifySnapshots)
{
+ // TODO(wuestholz): Maybe we should speed up this lookup.
+ OtherDefinitionAxiomsCollector.Collect(program.TopLevelDeclarations.OfType<Axiom>());
impls.Iter(impl => { DependencyCollector.DependenciesChecksum(impl); });
stablePrioritizedImpls = impls.OrderByDescending(
impl => impl.Priority != 1 ? impl.Priority : Cache.VerificationPriority(impl)).ToArray();
diff --git a/Source/ExecutionEngine/VerificationResultCache.cs b/Source/ExecutionEngine/VerificationResultCache.cs
index 60a6555a..9d1eea24 100644
--- a/Source/ExecutionEngine/VerificationResultCache.cs
+++ b/Source/ExecutionEngine/VerificationResultCache.cs
@@ -197,6 +197,52 @@ namespace Microsoft.Boogie
}
+ public class OtherDefinitionAxiomsCollector : ReadOnlyVisitor
+ {
+ Axiom currentAxiom;
+ Trigger currentTrigger;
+
+ public static void Collect(IEnumerable<Axiom> axioms)
+ {
+ var v = new OtherDefinitionAxiomsCollector();
+ foreach (var a in axioms)
+ {
+ v.currentAxiom = a;
+ v.VisitExpr(a.Expr);
+ v.currentAxiom = null;
+ }
+ }
+
+ public override QuantifierExpr VisitQuantifierExpr(QuantifierExpr node)
+ {
+ currentTrigger = node.Triggers;
+ while (currentTrigger != null)
+ {
+ foreach (var e in currentTrigger.Tr)
+ {
+ VisitExpr(e);
+ }
+ currentTrigger = currentTrigger.Next;
+ }
+ return base.VisitQuantifierExpr(node);
+ }
+
+ public override Expr VisitNAryExpr(NAryExpr node)
+ {
+ if (currentTrigger != null)
+ {
+ // We found a function call within a trigger of a quantifier expression.
+ var funCall = node.Fun as FunctionCall;
+ if (funCall != null && funCall.Func != null && funCall.Func.Checksum != null && funCall.Func.Checksum != "stable")
+ {
+ funCall.Func.AddOtherDefinitionAxiom(currentAxiom);
+ }
+ }
+ return base.VisitNAryExpr(node);
+ }
+ }
+
+
class DependencyCollector : ReadOnlyVisitor
{
private HashSet<Procedure> procedureDependencies;
@@ -301,6 +347,16 @@ namespace Microsoft.Boogie
{
VisitAxiom(node.DefinitionAxiom);
}
+ if (node.OtherDefinitionAxioms != null)
+ {
+ foreach (var a in node.OtherDefinitionAxioms)
+ {
+ if (a != node.DefinitionAxiom)
+ {
+ VisitAxiom(a);
+ }
+ }
+ }
return base.VisitFunction(node);
}