Skip to content

Commit 2af8e63

Browse files
authored
[Civl] Remove ISR code (#1007)
1 parent 475cc43 commit 2af8e63

File tree

8 files changed

+33
-426
lines changed

8 files changed

+33
-426
lines changed

Source/Concurrency/InductiveSequentialization.cs

Lines changed: 10 additions & 325 deletions
Large diffs are not rendered by default.

Source/Concurrency/MoverCheck.cs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ where first.IsRightMover || second.IsLeftMover
8181
* obviates the need to generate it.
8282
*/
8383

84-
foreach (var sequentialization in civlTypeChecker.Sequentializations.Where(x => x.rule == InductiveSequentializationRule.ISL))
84+
foreach (var sequentialization in civlTypeChecker.Sequentializations)
8585
{
8686
foreach (var leftMover in sequentialization.EliminatedActions)
8787
{
@@ -114,28 +114,6 @@ where first.IsRightMover || second.IsLeftMover
114114
}
115115
}
116116
}
117-
118-
foreach (var sequentialization in civlTypeChecker.Sequentializations.Where(x => x.rule == InductiveSequentializationRule.ISR))
119-
{
120-
foreach (var rightMover in sequentialization.EliminatedActions.Append(sequentialization.TargetAction))
121-
{
122-
foreach (var action in civlTypeChecker.MoverActions.Where(x => x.LayerRange.Contains(sequentialization.Layer)))
123-
{
124-
var moverCheckContext1 = new MoverCheckContext
125-
{
126-
layer = sequentialization.Layer,
127-
extraAssumptions = sequentialization.GenerateRightMoverCheckAssumptions(rightMover, rightMover.FirstImpl.InParams)
128-
};
129-
var moverCheckContext2 = new MoverCheckContext
130-
{
131-
layer = sequentialization.Layer,
132-
extraAssumptions = sequentialization.GenerateRightMoverCheckAssumptions(rightMover, rightMover.SecondImpl.InParams)
133-
};
134-
moverChecking.CreateCommutativityChecker(rightMover, action, moverCheckContext1);
135-
moverChecking.CreateGatePreservationChecker(action, rightMover, moverCheckContext2);
136-
}
137-
}
138-
}
139117
}
140118

141119
private IEnumerable<Requires> DisjointnessAndWellFormedRequires(IEnumerable<Variable> paramVars, HashSet<Variable> frame)

Source/Core/AST/Commands/CallCmd.cs

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -323,49 +323,33 @@ void CheckModifies(IEnumerable<Variable> modifiedVars)
323323
{
324324
tc.Error(this, "caller must not be a mover procedure");
325325
}
326-
if (!IsAsync)
326+
if (IsAsync)
327327
{
328-
// check there is no application of IS_RIGHT in the entire chain of refined actions
329-
var calleeRefinedAction = calleeDecl.RefinedAction;
330-
while (calleeRefinedAction != null)
328+
if (isSynchronized)
331329
{
332-
if (calleeRefinedAction.HasAttribute(CivlAttributes.IS_RIGHT))
330+
// check that entire chain of refined actions all the way to highestRefinedAction is comprised of left movers
331+
var calleeRefinedAction = calleeDecl.RefinedAction;
332+
while (calleeRefinedAction != null)
333333
{
334-
tc.Error(this, "this must be an async call");
335-
break;
334+
var calleeActionDecl = calleeRefinedAction.ActionDecl;
335+
if (!calleeActionDecl.IsLeftMover)
336+
{
337+
tc.Error(this,
338+
$"callee abstraction in synchronized call must be a left mover: {calleeActionDecl.Name}");
339+
break;
340+
}
341+
if (calleeActionDecl == highestRefinedActionDecl)
342+
{
343+
break;
344+
}
345+
calleeRefinedAction = calleeActionDecl.RefinedAction;
336346
}
337-
var calleeActionDecl = calleeRefinedAction.ActionDecl;
338-
if (calleeActionDecl == highestRefinedActionDecl)
339-
{
340-
break;
341-
}
342-
calleeRefinedAction = calleeActionDecl.RefinedAction;
343347
}
344-
}
345-
else if (isSynchronized)
346-
{
347-
// check that entire chain of refined actions all the way to highestRefinedAction is comprised of left movers
348-
var calleeRefinedAction = calleeDecl.RefinedAction;
349-
while (calleeRefinedAction != null)
348+
else if (callerDecl.HasMoverType)
350349
{
351-
var calleeActionDecl = calleeRefinedAction.ActionDecl;
352-
if (!calleeActionDecl.IsLeftMover)
353-
{
354-
tc.Error(this,
355-
$"callee abstraction in synchronized call must be a left mover: {calleeActionDecl.Name}");
356-
break;
357-
}
358-
if (calleeActionDecl == highestRefinedActionDecl)
359-
{
360-
break;
361-
}
362-
calleeRefinedAction = calleeActionDecl.RefinedAction;
350+
tc.Error(this, "async call must be synchronized in mover procedure");
363351
}
364352
}
365-
else if (callerDecl.HasMoverType)
366-
{
367-
tc.Error(this, "async call must be synchronized");
368-
}
369353
}
370354
}
371355
}

Source/Core/CivlAttributes.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,8 @@ public static class CivlAttributes
8686
public const string HIDE = "hide";
8787
public const string PENDING_ASYNC = "pending_async";
8888
public const string SYNC = "sync";
89-
public const string IS_RIGHT = "IS_right";
90-
public const string IS_LEFT = "IS_left";
9189

92-
private static string[] CIVL_ATTRIBUTES = { LAYER, YIELDS, MARK, HIDE, PENDING_ASYNC, SYNC, IS_LEFT, IS_RIGHT };
90+
private static string[] CIVL_ATTRIBUTES = { LAYER, YIELDS, MARK, HIDE, PENDING_ASYNC, SYNC };
9391

9492
public const string LINEAR = "linear";
9593
public const string LINEAR_IN = "linear_in";

Test/civl/inductive-sequentialization/ChangRoberts.bpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %parallel-boogie "%s" > "%t"
1+
// RUN: %parallel-boogie -timeLimit:0 "%s" > "%t"
22
// RUN: %diff "%s.expect" "%t"
33

44
const N: int; // size of the ring
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
issue-1005.bpl(14,10): Error: async call must be synchronized
1+
issue-1005.bpl(14,10): Error: async call must be synchronized in mover procedure
22
1 type checking errors detected in issue-1005.bpl

Test/civl/regression-tests/only-async-call-ISR.bpl

Lines changed: 0 additions & 36 deletions
This file was deleted.

Test/civl/regression-tests/only-async-call-ISR.bpl.expect

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)