Skip to content
Snippets Groups Projects
Commit 8d08a552 authored by Nicolas Voirol's avatar Nicolas Voirol
Browse files

Fixed call blocker positioning

parent 940e7dec
Branches
Tags
No related merge requests found
...@@ -183,12 +183,17 @@ trait TemplateGenerator { self: Templates => ...@@ -183,12 +183,17 @@ trait TemplateGenerator { self: Templates =>
storeGuarded(pathVar, Equals(newExpr, rec(pathVar, x, pol))) storeGuarded(pathVar, Equals(newExpr, rec(pathVar, x, pol)))
case x :: xs => case x :: xs =>
val newRes: Variable = Variable(FreshIdentifier("res", true), BooleanType)
storeExpr(newRes)
val xrec = rec(pathVar, x, pol)
storeGuarded(pathVar, Equals(newRes, xrec))
val newBool: Variable = Variable(FreshIdentifier("b", true), BooleanType) val newBool: Variable = Variable(FreshIdentifier("b", true), BooleanType)
storeCond(pathVar, newBool) storeCond(pathVar, newBool)
val xrec = rec(pathVar, x, pol) storeGuarded(pathVar, implies(not(newRes), not(newExpr)))
iff(and(pathVar, xrec), newBool) iff(and(pathVar, newRes), newBool)
storeGuarded(pathVar, implies(not(xrec), not(newExpr)))
recAnd(newBool, xs) recAnd(newBool, xs)
...@@ -212,12 +217,17 @@ trait TemplateGenerator { self: Templates => ...@@ -212,12 +217,17 @@ trait TemplateGenerator { self: Templates =>
storeGuarded(pathVar, Equals(newExpr, rec(pathVar, x, None))) storeGuarded(pathVar, Equals(newExpr, rec(pathVar, x, None)))
case x :: xs => case x :: xs =>
val newRes: Variable = Variable(FreshIdentifier("res", true), BooleanType)
storeExpr(newRes)
val xrec = rec(pathVar, x, pol)
storeGuarded(pathVar, Equals(newRes, xrec))
val newBool: Variable = Variable(FreshIdentifier("b", true), BooleanType) val newBool: Variable = Variable(FreshIdentifier("b", true), BooleanType)
storeCond(pathVar, newBool) storeCond(pathVar, newBool)
val xrec = rec(pathVar, x, None) storeGuarded(pathVar, implies(newRes, newExpr))
storeGuarded(pathVar, implies(xrec, newExpr)) iff(and(pathVar, not(newRes)), newBool)
iff(and(pathVar, not(xrec)), newBool)
recOr(newBool, xs) recOr(newBool, xs)
...@@ -235,17 +245,20 @@ trait TemplateGenerator { self: Templates => ...@@ -235,17 +245,20 @@ trait TemplateGenerator { self: Templates =>
val newBool1 : Variable = Variable(FreshIdentifier("b", true), BooleanType) val newBool1 : Variable = Variable(FreshIdentifier("b", true), BooleanType)
val newBool2 : Variable = Variable(FreshIdentifier("b", true), BooleanType) val newBool2 : Variable = Variable(FreshIdentifier("b", true), BooleanType)
val newExpr : Variable = Variable(FreshIdentifier("e", true), i.getType) val newExpr : Variable = Variable(FreshIdentifier("e", true), i.getType)
val condVar : Variable = Variable(FreshIdentifier("c", true), BooleanType)
storeCond(pathVar, newBool1) storeCond(pathVar, newBool1)
storeCond(pathVar, newBool2) storeCond(pathVar, newBool2)
storeExpr(newExpr) storeExpr(newExpr)
storeExpr(condVar)
val crec = rec(pathVar, cond, None) val crec = rec(pathVar, cond, None)
val trec = rec(newBool1, thenn, None) val trec = rec(newBool1, thenn, None)
val erec = rec(newBool2, elze, None) val erec = rec(newBool2, elze, None)
iff(and(pathVar, cond), newBool1) storeGuarded(pathVar, Equals(condVar, crec))
iff(and(pathVar, not(cond)), newBool2) iff(and(pathVar, condVar), newBool1)
iff(and(pathVar, not(condVar)), newBool2)
storeGuarded(newBool1, Equals(newExpr, trec)) storeGuarded(newBool1, Equals(newExpr, trec))
storeGuarded(newBool2, Equals(newExpr, erec)) storeGuarded(newBool2, Equals(newExpr, erec))
......
...@@ -59,7 +59,7 @@ trait Templates extends TemplateGenerator ...@@ -59,7 +59,7 @@ trait Templates extends TemplateGenerator
def canUnroll: Boolean = managers.exists(_.unrollGeneration.isDefined) def canUnroll: Boolean = managers.exists(_.unrollGeneration.isDefined)
def unroll: Clauses = { def unroll: Clauses = {
assert(canUnroll, "Impossible to unroll further") assert(canUnroll, "Impossible to unroll further")
val generation = managers.flatMap(_.unrollGeneration).min val generation = managers.flatMap(_.unrollGeneration).min + 1
if (generation > currentGen) { if (generation > currentGen) {
currentGen = generation currentGen = generation
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment