Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable marking if commands as {:allow_split} or not #970

Merged
merged 41 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f01b081
Revert "Revert isolation (#966)"
keyboardDrummer Oct 18, 2024
160b0f7
Fix problems with isolate each assertion and isolating jumps
keyboardDrummer Oct 18, 2024
f27d1eb
Update expect file
keyboardDrummer Oct 18, 2024
4cbed7f
Refactoring to make code more robust
keyboardDrummer Oct 21, 2024
6b0621b
Renames and automated refactorings
keyboardDrummer Oct 8, 2024
c19096e
Fix concurrency issue
keyboardDrummer Oct 8, 2024
1cf4a9d
Use IList<Block> instead of List<Block> for Implementation
keyboardDrummer Oct 8, 2024
dee6335
{:allow_splits} and fixes to isolation of jumps
keyboardDrummer Oct 16, 2024
43096dd
Add token persistent to empty block removal
keyboardDrummer Oct 16, 2024
1c139ea
Fixes
keyboardDrummer Oct 16, 2024
4308450
Fixes
keyboardDrummer Oct 17, 2024
0bc885b
Updates
keyboardDrummer Oct 18, 2024
32f3c4a
Update focus expect file
keyboardDrummer Oct 18, 2024
86a59b3
Fixes
keyboardDrummer Oct 18, 2024
aa40bb1
Tests pass but did not add back else if
keyboardDrummer Oct 18, 2024
39284bf
Update expect files
keyboardDrummer Oct 18, 2024
ee36000
Small fixes
keyboardDrummer Oct 21, 2024
59cec03
Update expect files
keyboardDrummer Oct 21, 2024
0cf0b77
Remove woops
keyboardDrummer Oct 21, 2024
92544a5
Fix test expect file
keyboardDrummer Oct 22, 2024
ed1abc9
Introduce KindName
keyboardDrummer Oct 22, 2024
d3a224e
Update expect files
keyboardDrummer Oct 22, 2024
7c1e356
Draft support for isolating non-return jumps
keyboardDrummer Oct 22, 2024
db8b463
Update parser
keyboardDrummer Oct 22, 2024
e47fa02
Merge remote-tracking branch 'fork/rerevert' into isolatePathsTake3
keyboardDrummer Oct 22, 2024
14934ec
Fixes
keyboardDrummer Oct 22, 2024
ca07b3f
Tests pass now
keyboardDrummer Oct 22, 2024
98916ad
Merge branch 'rerevert' into isolatePathRefactorings
keyboardDrummer Oct 22, 2024
242fa7b
Merge commit '7ea138fa8a3f0' into isolatePathRefactorings
keyboardDrummer Oct 22, 2024
b08c6b1
Merge branch 'isolatePathRefactorings' into isolatePathsTake3
keyboardDrummer Oct 22, 2024
edc46ea
Merge commit '7e957c183~1' into isolatePathsTake3
keyboardDrummer Oct 22, 2024
1e5cd52
Merge commit '7e957c183' into isolatePathsTake3
keyboardDrummer Oct 22, 2024
b40821a
Fix for focus.dfy
keyboardDrummer Oct 23, 2024
593340f
Fix test
keyboardDrummer Oct 23, 2024
d760739
Update
keyboardDrummer Oct 23, 2024
34d896f
Revert "Fix test"
keyboardDrummer Oct 23, 2024
20319f0
Fix expect file
keyboardDrummer Oct 23, 2024
5dc52d8
Add missing optimize
keyboardDrummer Oct 23, 2024
357e4da
Add documentation
keyboardDrummer Oct 23, 2024
a6e894b
Improve split naming
keyboardDrummer Oct 24, 2024
f1d4015
Merge branch 'master' into isolatePathsTake3
keyboardDrummer Oct 24, 2024
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
8 changes: 2 additions & 6 deletions Source/Concurrency/YieldingProcInstrumentation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,7 @@ private void DesugarConcurrency(Implementation impl, List<Cmd> preconditions)
impl.Blocks.Add(unchangedCheckerBlock);
impl.Blocks.Add(returnCheckerBlock);
impl.Blocks.Add(returnBlock);
foreach (var block in implRefinementCheckingBlocks) {
impl.Blocks.Add(block);
}
impl.Blocks.AddRange(implRefinementCheckingBlocks);
impl.Blocks.Insert(0, CreateInitialBlock(impl, preconditions));
}

Expand Down Expand Up @@ -600,9 +598,7 @@ private void SplitBlocks(Implementation impl)
b.TransferCmd = currTransferCmd;
}

foreach (var newBlock in newBlocks) {
impl.Blocks.Add(newBlock);
}
impl.Blocks.AddRange(newBlocks);
}

private Block CreateNoninterferenceCheckerBlock()
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/AST/Absy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2490,7 +2490,7 @@ public String ErrorMessage

public bool CanAlwaysAssume ()
{
return Free && this.Attributes.FindBoolAttribute("always_assume");
return Free && Attributes.FindBoolAttribute("always_assume");
}

public Ensures(IToken token, bool free, Expr condition, string comment, QKeyValue kv)
Expand Down
23 changes: 1 addition & 22 deletions Source/Core/AST/Commands/AbsyCmd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics.Contracts;
using Set = Microsoft.Boogie.GSet<object>;

namespace Microsoft.Boogie
{
//---------------------------------------------------------------------
// Commands
[ContractClassFor(typeof(Cmd))]
public abstract class CmdContracts : Cmd
{
Expand Down Expand Up @@ -2088,8 +2085,7 @@ public override Absy StdDispatch(StandardVisitor visitor)

public class ReturnExprCmd : ReturnCmd
{
public Expr /*!*/
Expr;
public Expr /*!*/ Expr;

[ContractInvariantMethod]
void ObjectInvariant()
Expand Down Expand Up @@ -2214,21 +2210,4 @@ public override Absy StdDispatch(StandardVisitor visitor)
return visitor.VisitHavocCmd(this);
}
}

//---------------------------------------------------------------------
// Transfer commands

[ContractClassFor(typeof(TransferCmd))]
public abstract class TransferCmdContracts : TransferCmd
{
public TransferCmdContracts() : base(null)
{
}

public override void Emit(TokenTextWriter stream, int level)
{
Contract.Requires(stream != null);
throw new NotImplementedException();
}
}
}
2 changes: 1 addition & 1 deletion Source/Core/AST/Commands/CallCmd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ protected override Cmd ComputeDesugaring(PrintOptions options)
Contract.Assert(a != null);
// These probably won't have IDs, but copy if they do.
if (callId is not null) {
(a as ICarriesAttributes).CopyIdWithModificationsFrom(tok, req,
a.CopyIdWithModificationsFrom(tok, req,
id => new TrackedCallRequiresAssumed(callId, id));
}

Expand Down
18 changes: 9 additions & 9 deletions Source/Core/AST/GotoBoogie/Block.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ namespace Microsoft.Boogie;

public sealed class Block : Absy
{
public string /*!*/ Label { get; set; } // Note, Label is mostly readonly, but it can change to the name of a nearby block during block coalescing and empty-block removal

public string Label { get; set; } // Note, Label is mostly readonly, but it can change to the name of a nearby block during block coalescing and empty-block removal

[Rep]
[ElementsPeer]
public List<Cmd> /*!*/ Cmds;
[Rep]
[ElementsPeer]
public List<Cmd> Cmds { get; set; }

public IEnumerable<Block> Exits()
{
Expand All @@ -23,8 +24,7 @@ public IEnumerable<Block> Exits()
}

[Rep] //PM: needed to verify Traverse.Visit
public TransferCmd
TransferCmd; // maybe null only because we allow deferred initialization (necessary for cyclic structures)
public TransferCmd TransferCmd; // maybe null only because we allow deferred initialization (necessary for cyclic structures)

public byte[] Checksum;

Expand Down Expand Up @@ -164,10 +164,10 @@ public override void Resolve(ResolutionContext rc)

public override void Typecheck(TypecheckingContext tc)
{
foreach (Cmd /*!*/ c in Cmds)
foreach (var /*!*/ cmd in Cmds)
{
Contract.Assert(c != null);
c.Typecheck(tc);
Contract.Assert(cmd != null);
cmd.Typecheck(tc);
}

Contract.Assume(this.TransferCmd != null);
Expand Down
17 changes: 9 additions & 8 deletions Source/Core/AST/GotoBoogie/GotoCmd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Microsoft.Boogie;

public class GotoCmd : TransferCmd
public class GotoCmd : TransferCmd, ICarriesAttributes
{
[Rep] public List<string> LabelNames;
[Rep] public List<Block> LabelTargets;
Expand Down Expand Up @@ -43,20 +43,20 @@ public GotoCmd(IToken /*!*/ tok, List<string> /*!*/ labels, List<Block> /*!*/ bl
this.LabelTargets = blocks;
}

public GotoCmd(IToken /*!*/ tok, List<Block> /*!*/ blockSeq)
public GotoCmd(IToken /*!*/ tok, List<Block> /*!*/ blocks)
: base(tok)
{
//requires (blockSeq[i] != null ==> blockSeq[i].Label != null);
Contract.Requires(tok != null);
Contract.Requires(blockSeq != null);
List<string> labelSeq = new List<string>();
for (int i = 0; i < blockSeq.Count; i++)
Contract.Requires(blocks != null);
var labels = new List<string>();
foreach (var block in blocks)
{
labelSeq.Add(cce.NonNull(blockSeq[i]).Label);
labels.Add(block.Label);
}

this.LabelNames = labelSeq;
this.LabelTargets = blockSeq;
this.LabelNames = labels;
this.LabelTargets = blocks;
}

public void RemoveTarget(Block b) {
Expand Down Expand Up @@ -91,6 +91,7 @@ public override void Emit(TokenTextWriter stream, int level)
//Contract.Requires(stream != null);
Contract.Assume(this.LabelNames != null);
stream.Write(this, level, "goto ");
Attributes?.Emit(stream);
if (stream.Options.PrintWithUniqueASTIds)
{
if (LabelTargets == null)
Expand Down
18 changes: 18 additions & 0 deletions Source/Core/AST/GotoBoogie/TransferCmdContracts.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Diagnostics.Contracts;

namespace Microsoft.Boogie;

[ContractClassFor(typeof(TransferCmd))]
public abstract class TransferCmdContracts : TransferCmd
{
public TransferCmdContracts() : base(null)
{
}

public override void Emit(TokenTextWriter stream, int level)
{
Contract.Requires(stream != null);
throw new NotImplementedException();
}
}
4 changes: 2 additions & 2 deletions Source/Core/AST/QKeyValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ void ObjectInvariant()
Contract.Invariant(cce.NonNullElements(this._params));
}

public QKeyValue(IToken tok, string key, IList<object /*!*/> /*!*/ parameters, QKeyValue next)
public QKeyValue(IToken tok, string key, IList<object /*!*/> /*!*/ parameters = null, QKeyValue next = null)
: base(tok)
{
Contract.Requires(key != null);
Contract.Requires(tok != null);
Contract.Requires(cce.NonNullElements(parameters));
Key = key;
this._params = new List<object>(parameters);
this._params = parameters == null ? new List<object>() : new List<object>(parameters);
Next = next;
}

Expand Down
Loading
Loading