summaryrefslogtreecommitdiff
path: root/Test/og/parallel2.bpl
diff options
context:
space:
mode:
authorGravatar qadeer <unknown>2014-05-03 10:06:13 -0700
committerGravatar qadeer <unknown>2014-05-03 10:06:13 -0700
commit36e016acf963b7c19d59640b11b4a40f2072943e (patch)
tree31a45e868059d0ffe54fc3d212261245ff97886a /Test/og/parallel2.bpl
parent121071b9f87d23eaeba176897b9655cd540fb694 (diff)
checkpoint
Diffstat (limited to 'Test/og/parallel2.bpl')
-rw-r--r--Test/og/parallel2.bpl29
1 files changed, 17 insertions, 12 deletions
diff --git a/Test/og/parallel2.bpl b/Test/og/parallel2.bpl
index 07864511..4a3c1849 100644
--- a/Test/og/parallel2.bpl
+++ b/Test/og/parallel2.bpl
@@ -1,4 +1,4 @@
-var a:[int]int;
+var {:phase 1} a:[int]int;
function {:builtin "MapConst"} MapConstBool(bool) : [int]bool;
function {:inline} {:linear "tid"} TidCollector(x: int) : [int]bool
@@ -8,7 +8,10 @@ function {:inline} {:linear "tid"} TidCollector(x: int) : [int]bool
procedure Allocate() returns ({:linear "tid"} xls: int);
-procedure {:entrypoint} {:yields} main()
+procedure {:yields} {:phase 0,1} Write(idx: int, val: int);
+ensures {:atomic} |{A: a[idx] := val; return true; }|;
+
+procedure {:yields} {:phase 1} main()
{
var {:linear "tid"} i: int;
var {:linear "tid"} j: int;
@@ -18,29 +21,31 @@ procedure {:entrypoint} {:yields} main()
par i := u(i) | j := u(j);
}
-procedure {:yields} {:stable} t({:linear "tid"} i': int) returns ({:linear "tid"} i: int)
+procedure {:yields} {:phase 1} t({:linear "tid"} i': int) returns ({:linear "tid"} i: int)
{
i := i';
- a[i] := 42;
+ yield;
+ call Write(i, 42);
call i := Yield(i);
- assert a[i] == 42;
+ assert {:phase 1} a[i] == 42;
}
-procedure {:yields} {:stable} u({:linear "tid"} i': int) returns ({:linear "tid"} i: int)
+procedure {:yields} {:phase 1} u({:linear "tid"} i': int) returns ({:linear "tid"} i: int)
{
i := i';
- a[i] := 42;
yield;
- assert a[i] == 42;
+ call Write(i, 42);
+ yield;
+ assert {:phase 1} a[i] == 42;
}
-procedure {:yields} Yield({:linear "tid"} i': int) returns ({:linear "tid"} i: int)
-ensures i == i';
-ensures old(a)[i] == a[i];
+procedure {:yields} {:phase 1} Yield({:linear "tid"} i': int) returns ({:linear "tid"} i: int)
+ensures {:phase 1} i == i';
+ensures {:phase 1} old(a)[i] == a[i];
{
i := i';
yield;
- assert old(a)[i] == a[i];
+ assert {:phase 1} old(a)[i] == a[i];
} \ No newline at end of file