Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
335 changes: 10 additions & 325 deletions Source/Concurrency/InductiveSequentialization.cs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can enum InductiveSequentializationRule be removed now too?

Large diffs are not rendered by default.

24 changes: 1 addition & 23 deletions Source/Concurrency/MoverCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ where first.IsRightMover || second.IsLeftMover
* obviates the need to generate it.
*/

foreach (var sequentialization in civlTypeChecker.Sequentializations.Where(x => x.rule == InductiveSequentializationRule.ISL))
foreach (var sequentialization in civlTypeChecker.Sequentializations)
{
foreach (var leftMover in sequentialization.EliminatedActions)
{
Expand Down Expand Up @@ -114,28 +114,6 @@ where first.IsRightMover || second.IsLeftMover
}
}
}

foreach (var sequentialization in civlTypeChecker.Sequentializations.Where(x => x.rule == InductiveSequentializationRule.ISR))
{
foreach (var rightMover in sequentialization.EliminatedActions.Append(sequentialization.TargetAction))
{
foreach (var action in civlTypeChecker.MoverActions.Where(x => x.LayerRange.Contains(sequentialization.Layer)))
{
var moverCheckContext1 = new MoverCheckContext
{
layer = sequentialization.Layer,
extraAssumptions = sequentialization.GenerateRightMoverCheckAssumptions(rightMover, rightMover.FirstImpl.InParams)
};
var moverCheckContext2 = new MoverCheckContext
{
layer = sequentialization.Layer,
extraAssumptions = sequentialization.GenerateRightMoverCheckAssumptions(rightMover, rightMover.SecondImpl.InParams)
};
moverChecking.CreateCommutativityChecker(rightMover, action, moverCheckContext1);
moverChecking.CreateGatePreservationChecker(action, rightMover, moverCheckContext2);
}
}
}
}

private IEnumerable<Requires> DisjointnessAndWellFormedRequires(IEnumerable<Variable> paramVars, HashSet<Variable> frame)
Expand Down
54 changes: 19 additions & 35 deletions Source/Core/AST/Commands/CallCmd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,49 +323,33 @@ void CheckModifies(IEnumerable<Variable> modifiedVars)
{
tc.Error(this, "caller must not be a mover procedure");
}
if (!IsAsync)
if (IsAsync)
{
// check there is no application of IS_RIGHT in the entire chain of refined actions
var calleeRefinedAction = calleeDecl.RefinedAction;
while (calleeRefinedAction != null)
if (isSynchronized)
{
if (calleeRefinedAction.HasAttribute(CivlAttributes.IS_RIGHT))
// check that entire chain of refined actions all the way to highestRefinedAction is comprised of left movers
var calleeRefinedAction = calleeDecl.RefinedAction;
while (calleeRefinedAction != null)
{
tc.Error(this, "this must be an async call");
break;
var calleeActionDecl = calleeRefinedAction.ActionDecl;
if (!calleeActionDecl.IsLeftMover)
{
tc.Error(this,
$"callee abstraction in synchronized call must be a left mover: {calleeActionDecl.Name}");
break;
}
if (calleeActionDecl == highestRefinedActionDecl)
{
break;
}
calleeRefinedAction = calleeActionDecl.RefinedAction;
}
var calleeActionDecl = calleeRefinedAction.ActionDecl;
if (calleeActionDecl == highestRefinedActionDecl)
{
break;
}
calleeRefinedAction = calleeActionDecl.RefinedAction;
}
}
else if (isSynchronized)
{
// check that entire chain of refined actions all the way to highestRefinedAction is comprised of left movers
var calleeRefinedAction = calleeDecl.RefinedAction;
while (calleeRefinedAction != null)
else if (callerDecl.HasMoverType)
{
var calleeActionDecl = calleeRefinedAction.ActionDecl;
if (!calleeActionDecl.IsLeftMover)
{
tc.Error(this,
$"callee abstraction in synchronized call must be a left mover: {calleeActionDecl.Name}");
break;
}
if (calleeActionDecl == highestRefinedActionDecl)
{
break;
}
calleeRefinedAction = calleeActionDecl.RefinedAction;
tc.Error(this, "async call must be synchronized in mover procedure");
}
}
else if (callerDecl.HasMoverType)
{
tc.Error(this, "async call must be synchronized");
}
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions Source/Core/CivlAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ public static class CivlAttributes
public const string HIDE = "hide";
public const string PENDING_ASYNC = "pending_async";
public const string SYNC = "sync";
public const string IS_RIGHT = "IS_right";
public const string IS_LEFT = "IS_left";

private static string[] CIVL_ATTRIBUTES = { LAYER, YIELDS, MARK, HIDE, PENDING_ASYNC, SYNC, IS_LEFT, IS_RIGHT };
private static string[] CIVL_ATTRIBUTES = { LAYER, YIELDS, MARK, HIDE, PENDING_ASYNC, SYNC };

public const string LINEAR = "linear";
public const string LINEAR_IN = "linear_in";
Expand Down
2 changes: 1 addition & 1 deletion Test/civl/inductive-sequentialization/ChangRoberts.bpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %parallel-boogie "%s" > "%t"
// RUN: %parallel-boogie -timeLimit:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"

const N: int; // size of the ring
Expand Down
2 changes: 1 addition & 1 deletion Test/civl/regression-tests/issue-1005.bpl.expect
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
issue-1005.bpl(14,10): Error: async call must be synchronized
issue-1005.bpl(14,10): Error: async call must be synchronized in mover procedure
1 type checking errors detected in issue-1005.bpl
36 changes: 0 additions & 36 deletions Test/civl/regression-tests/only-async-call-ISR.bpl

This file was deleted.

2 changes: 0 additions & 2 deletions Test/civl/regression-tests/only-async-call-ISR.bpl.expect

This file was deleted.

Loading