summaryrefslogtreecommitdiff
path: root/Test
diff options
context:
space:
mode:
authorGravatar qadeer <unknown>2015-02-11 17:29:22 -0800
committerGravatar qadeer <unknown>2015-02-11 17:29:22 -0800
commit882a965c3d212a2d79825e0d06200758ce3b9db4 (patch)
treeec187e8f7b7860f87d210a0703119178ab0d41c3 /Test
parenta7843fac5cfc4b5d755a10fc61dce896cc881d9e (diff)
moved some things around
Diffstat (limited to 'Test')
-rw-r--r--Test/og/Program4.bpl41
-rw-r--r--Test/og/Program5.bpl36
2 files changed, 41 insertions, 36 deletions
diff --git a/Test/og/Program4.bpl b/Test/og/Program4.bpl
index 7767e179..7f2f9c44 100644
--- a/Test/og/Program4.bpl
+++ b/Test/og/Program4.bpl
@@ -1,27 +1,8 @@
// RUN: %boogie -noinfer -typeEncoding:m -useArrayTheory "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
type Tid;
-function {:builtin "MapConst"} MapConstBool(bool): [Tid]bool;
-function {:builtin "MapOr"} MapOr([Tid]bool, [Tid]bool) : [Tid]bool;
-
-function {:inline} {:linear "tid"} TidCollector(x: Tid) : [Tid]bool
-{
- MapConstBool(false)[x := true]
-}
-function {:inline} {:linear "tid"} TidSetCollector(x: [Tid]bool) : [Tid]bool
-{
- x
-}
-
var {:layer 0,1} a:[Tid]int;
-procedure {:yields} {:layer 1} Allocate() returns ({:linear "tid"} tid: Tid)
-{
- yield;
- call tid := AllocateLow();
- yield;
-}
-
procedure {:yields} {:layer 1} main() {
var {:linear "tid"} tid:Tid;
@@ -49,6 +30,13 @@ ensures {:layer 1} a[tid] == old(a)[tid] + 1;
assert {:layer 1} a[tid] == t + 1;
}
+procedure {:yields} {:layer 1} Allocate() returns ({:linear "tid"} tid: Tid)
+{
+ yield;
+ call tid := AllocateLow();
+ yield;
+}
+
procedure {:yields} {:layer 0,1} Read({:linear "tid"} tid: Tid) returns (val: int);
ensures {:atomic}
|{A:
@@ -63,3 +51,18 @@ ensures {:atomic}
procedure {:yields} {:layer 0,1} AllocateLow() returns ({:linear "tid"} tid: Tid);
ensures {:atomic} |{ A: return true; }|;
+
+
+
+function {:builtin "MapConst"} MapConstBool(bool): [Tid]bool;
+function {:builtin "MapOr"} MapOr([Tid]bool, [Tid]bool) : [Tid]bool;
+
+function {:inline} {:linear "tid"} TidCollector(x: Tid) : [Tid]bool
+{
+ MapConstBool(false)[x := true]
+}
+function {:inline} {:linear "tid"} TidSetCollector(x: [Tid]bool) : [Tid]bool
+{
+ x
+}
+
diff --git a/Test/og/Program5.bpl b/Test/og/Program5.bpl
index 55e4219f..7ede3124 100644
--- a/Test/og/Program5.bpl
+++ b/Test/og/Program5.bpl
@@ -2,20 +2,6 @@
// RUN: %diff "%s.expect" "%t"
type Tid;
const unique nil: Tid;
-function {:builtin "MapConst"} MapConstBool(bool): [Tid]bool;
-function {:builtin "MapOr"} MapOr([Tid]bool, [Tid]bool) : [Tid]bool;
-
-var {:layer 0} Color:int;
-var {:layer 0} lock:Tid;
-
-function {:inline} {:linear "tid"} TidCollector(x: Tid) : [Tid]bool
-{
- MapConstBool(false)[x := true]
-}
-function {:inline} {:linear "tid"} TidSetCollector(x: [Tid]bool) : [Tid]bool
-{
- x
-}
function {:inline} UNALLOC():int { 0 }
function {:inline} WHITE():int { 1 }
@@ -33,7 +19,7 @@ ensures {:layer 2} Color >= old(Color);
assert {:layer 2} Color >= old(Color);
}
-procedure {:yields} {:layer 2,3} TopWriteBarrier({:linear "tid"} tid:Tid)
+procedure {:yields} {:layer 2,3} WriteBarrier({:linear "tid"} tid:Tid)
ensures {:atomic} |{ A: assert tid != nil; goto B, C;
B: assume White(Color); Color := GRAY(); return true;
C: return true;}|;
@@ -42,11 +28,11 @@ ensures {:atomic} |{ A: assert tid != nil; goto B, C;
yield;
call colorLocal := GetColorNoLock();
call YieldColorOnlyGetsDarker();
- if (White(colorLocal)) { call MidWriteBarrier(tid); }
+ if (White(colorLocal)) { call WriteBarrierSlow(tid); }
yield;
}
-procedure {:yields} {:layer 1,2} MidWriteBarrier({:linear "tid"} tid:Tid)
+procedure {:yields} {:layer 1,2} WriteBarrierSlow({:linear "tid"} tid:Tid)
ensures {:atomic} |{ A: assert tid != nil; goto B, C;
B: assume White(Color); Color := GRAY(); return true;
C: return true; }|;
@@ -75,3 +61,19 @@ procedure {:yields} {:layer 0,1} GetColorLocked({:linear "tid"} tid:Tid) returns
procedure {:yields} {:layer 0,2} GetColorNoLock() returns (col:int);
ensures {:atomic} |{A: col := Color; return true;}|;
+
+
+function {:builtin "MapConst"} MapConstBool(bool): [Tid]bool;
+function {:builtin "MapOr"} MapOr([Tid]bool, [Tid]bool) : [Tid]bool;
+
+var {:layer 0} Color:int;
+var {:layer 0} lock:Tid;
+
+function {:inline} {:linear "tid"} TidCollector(x: Tid) : [Tid]bool
+{
+ MapConstBool(false)[x := true]
+}
+function {:inline} {:linear "tid"} TidSetCollector(x: [Tid]bool) : [Tid]bool
+{
+ x
+}