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

Merge latest changes from rework #498

Merged
merged 140 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
3403f77
Added all prototype code.
ThomasHaas May 12, 2023
3db9825
Merge branch 'development' into llvm_rework
ThomasHaas May 13, 2023
f9664d3
Disabled logging in unit tests
ThomasHaas May 16, 2023
687b063
Moved prototype code into separate package
ThomasHaas May 16, 2023
505aa98
Updated maven.yml
ThomasHaas May 16, 2023
e4e527d
Merge pull request #444 from hernanponcedeleon/initial_prototype
ThomasHaas May 16, 2023
814bfcc
Added some Metadata classes (partially unused)
ThomasHaas May 13, 2023
0eb1815
Replaced all history-tracking Ids (oId, uId, cId) with new Metadata c…
ThomasHaas May 16, 2023
e3e4d38
Removed unnecessary comments
ThomasHaas May 17, 2023
bb836c9
Merge pull request #445 from hernanponcedeleon/metadata
ThomasHaas May 17, 2023
7bcf52c
Renamed Event.filters to Event.tags.
ThomasHaas May 19, 2023
9acc647
Renamed FilterAbstract and co.
ThomasHaas May 19, 2023
3ca1ed8
Renamed EventData.is to EventData.hasTag
ThomasHaas May 19, 2023
14fa871
Disabled logs.
ThomasHaas May 19, 2023
a4bdcd7
Merge pull request #447 from hernanponcedeleon/tags
ThomasHaas May 21, 2023
cbb71bd
Add Type
xeren May 26, 2023
80dc5bd
Add ExprInterface.getType()
xeren May 11, 2023
4d02db9
Encoding uses ExprInterface.getType()
xeren May 26, 2023
85c6e08
Add IValue(Type,BigInteger)
xeren May 26, 2023
8a7087b
Replace Register(String,int,int) with Register(String,int,IntegerType)
xeren May 26, 2023
9e2dfd6
Replace INonDet(INonDetTypes,int) with INonDet(int,IntegerType,boolea…
xeren May 3, 2023
0b51d7c
Replace IExpr() with IExpr(Type)
xeren May 26, 2023
c4f8164
fixup! Encoding uses ExprInterface.getType()
xeren May 26, 2023
c5e055c
fixup! Replace IExpr() with IExpr(Type)
xeren May 26, 2023
07bf04d
Refactor IValue(IntegerType,BigInteger) to IValue(BigInteger,IntegerT…
xeren May 26, 2023
981d924
Refactor
xeren May 27, 2023
0a0f2f4
Merge pull request #448 from hernanponcedeleon/types0
ThomasHaas May 27, 2023
b546501
Add Program.getConstants()
xeren Jun 1, 2023
22b8bfa
Register reads (rework) (#450)
ThomasHaas Jun 2, 2023
3280019
Event as interface (rework) (#452)
ThomasHaas Jun 2, 2023
37e2909
Merge development_rework into types1
xeren Jun 5, 2023
e6d0199
Refactor
xeren Jun 5, 2023
07c45f9
Merge pull request #453 from hernanponcedeleon/types1
ThomasHaas Jun 5, 2023
7d1ffc4
MemoryEvent as interface (#455)
ThomasHaas Jun 5, 2023
eb1bfd5
Introduced MemoryAccess class
ThomasHaas Jun 5, 2023
7d77c20
Minor refactor + comments
ThomasHaas Jun 6, 2023
a6465ee
Added more TODOs
ThomasHaas Jun 6, 2023
903db70
Replaced check against SingleAddressMemoryEvent
ThomasHaas Jun 6, 2023
94f2b07
Replace IOpUn.SEXT*, .ZEXT*, .TRUNC*, X2Y with SIGNED_CAST and UNSIGN…
xeren May 24, 2023
586ebc5
Removed setMo and setMemValue from MemoryEvent
ThomasHaas Jun 6, 2023
ca94c2e
Removed MemoryEvent.getMemValue()
ThomasHaas Jun 6, 2023
c125987
Removed remaining "instanceof AbstractEvent" checks.
ThomasHaas Jun 6, 2023
2b1578b
Made Init inherit from Store and simplified some code to uniformly ha…
ThomasHaas Jun 7, 2023
ab9f9a8
Add ExpressionFactory
xeren May 9, 2023
f4a64ae
CondJump.getGuard() returns ExprInterface
xeren May 30, 2023
ee41011
Merge Reducible into ExprInterface
xeren Jun 6, 2023
7e43c25
Use ExpressionFactory
xeren May 30, 2023
540a2f3
Remove deprecated methods
xeren Jun 7, 2023
a0d8caa
Rename ExprInterface to Expression
xeren Jun 7, 2023
2547815
LlvmUnary accepts all types
xeren Jun 8, 2023
f3e27e6
Fix 1 -> 0 in VisitorArm8
xeren Jun 8, 2023
a242415
Fix GTE in makeGreaterOrEqual
xeren Jun 9, 2023
4ee0a6d
Fix VisitorC11.visitStart(Start)
xeren Jun 9, 2023
080e42c
Rename methods in ExpressionFactory
xeren Jun 9, 2023
a8e1449
Reworked core memory events in the prototype
ThomasHaas Jun 9, 2023
cf1bc8e
Fix bitvector casts in ExpressionEncoder
xeren Jun 9, 2023
6fceeb7
Add IntegerType.applySign(BigInteger,boolean)
xeren Jun 9, 2023
cc37d14
Merge ExpressionFactory.makeInteger(Expression,IntegerType) into .mak…
xeren Jun 12, 2023
6df8223
Add support for fixed-size arch type
xeren Jun 12, 2023
32dc564
fixup! Encoding uses ExprInterface.getType()
xeren Jun 12, 2023
606142d
Merge pull request #460 from hernanponcedeleon/memEventPrototype
ThomasHaas Jun 12, 2023
ca9d64a
Merge branch 'development_rework' into memoryAccess
ThomasHaas Jun 12, 2023
abaabb5
Added MemoryOrder as metadata (for core events)
ThomasHaas Jun 12, 2023
1b16c19
Added event/common package that contains commonly shared code in the …
ThomasHaas Jun 12, 2023
222d28a
Merge pull request #457 from hernanponcedeleon/types2
ThomasHaas Jun 12, 2023
ff67fd4
Added "withMo" methods to EventFactory to construct core events with …
ThomasHaas Jun 12, 2023
61005bb
Replaced MemoryEvent by MemoryCoreEvent in all internal use-cases
ThomasHaas Jun 12, 2023
dcf23a8
Renaming of SingleAddressMemoryEvent to SingleAccessMemoryEvent
ThomasHaas Jun 13, 2023
772a987
Merge branch 'development_rework' into memoryAccess
ThomasHaas Jun 13, 2023
191073b
Fixup!
ThomasHaas Jun 13, 2023
0889492
Cleaned up compilation schemes (removed mo for Power and some RISCV c…
ThomasHaas Jun 13, 2023
d1a9b82
Removed more mo's from PPC and X86
ThomasHaas Jun 13, 2023
0bfdf46
Disabled printing flag.
ThomasHaas Jun 13, 2023
b1417f5
Made SRCU a core event (temporarily)
ThomasHaas Jun 13, 2023
2fc8484
Implemented Feedback
ThomasHaas Jun 15, 2023
8e6158d
Merge pull request #456 from hernanponcedeleon/memoryAccess
ThomasHaas Jun 18, 2023
565156e
Added abstract "defaultString" method to events.
ThomasHaas Jun 13, 2023
472cb7d
Cleaned up EventVisitor
ThomasHaas Jun 14, 2023
e61654c
Added GenericMemoryEvent as a core class.
ThomasHaas Jun 14, 2023
6fe1983
Replaced SrcuSync by GenericMemoryEvent
ThomasHaas Jun 15, 2023
b5767b1
Added CoreCodeVerification pass to raise an error when encountering n…
ThomasHaas Jun 15, 2023
48af79c
Added FenceBase event
ThomasHaas Jun 15, 2023
76b7b8e
Made LLVMFence, LKMMFence and AtomicFence subclasses of FenceBase.
ThomasHaas Jun 15, 2023
387b7d0
Made SourceLocation a record.
ThomasHaas Jun 19, 2023
31f12cc
Disable printing and CoreCodeVerification pass
ThomasHaas Jun 19, 2023
f456e42
Made LKMMLoad and LKMMStore non-core.
ThomasHaas Jun 19, 2023
3de4fb3
FenceBase adds the provided mo as tag
ThomasHaas Jun 19, 2023
010cfbc
Made C11 AtomicLoad/Store and LLVM LlvmLoad/Store inherit from LoadBa…
ThomasHaas Jun 19, 2023
7f410e8
Removed LKMMLockRead and LKMMLockWrite events
ThomasHaas Jun 19, 2023
2cc36ca
Improved printing of core-level RMWStores (to distinguish them from s…
ThomasHaas Jun 19, 2023
4ff91bd
Fixed LlvmStore having value and address swapped.
ThomasHaas Jun 19, 2023
e2264d1
Added SVCOMP atomic blocks to allowed core events
ThomasHaas Jun 19, 2023
6132740
Added "excl" prefix to printing of RMWStoreExclusive
ThomasHaas Jun 20, 2023
73774be
Removed custom printing from LKMM events.
ThomasHaas Jun 20, 2023
62b24c7
Added EventUser interface
ThomasHaas Jun 20, 2023
b427850
Added missing Event.registerUser calls to EventUsers.
ThomasHaas Jun 20, 2023
6e13c0c
Moved Event.updateReferences into EventUser.
ThomasHaas Jun 20, 2023
55514bf
Implemented Feedback
ThomasHaas Jun 20, 2023
8fe4c67
Merge pull request #462 from hernanponcedeleon/eventPrinter&reducedCore
ThomasHaas Jun 20, 2023
08a5d03
Added Event.detach and Event.tryDelete
ThomasHaas Jun 20, 2023
1a9255a
Merge branch 'development_rework' into eventUser
ThomasHaas Jun 20, 2023
9ed4fee
Added Thread.toString
ThomasHaas Jun 20, 2023
8cd7717
Fixed and simplified implementations of EventUser.updateReferences vi…
ThomasHaas Jun 21, 2023
abf11a4
Simplified Event.setSuccessor/getSuccessor: These should ONLY be used…
ThomasHaas Jun 21, 2023
f785a15
Replaced remaining usages of Event.forceDelete with Event.tryDelete.
ThomasHaas Jun 21, 2023
f5bd595
Cleanup
ThomasHaas Jun 21, 2023
a331d02
Merge pull request #464 from hernanponcedeleon/eventUser
ThomasHaas Jun 21, 2023
1d46464
Merge branch 'development' into merge
ThomasHaas Jun 22, 2023
2db8ef7
Fixup after merge with development
ThomasHaas Jun 22, 2023
0e10cdd
Merge pull request #468 from hernanponcedeleon/merge
ThomasHaas Jun 22, 2023
e21ad42
Added 4 new RMW base classes
ThomasHaas Jun 24, 2023
f6c5260
Cleaned up C11 atomics
ThomasHaas Jun 24, 2023
9d0b12a
Cleaned up LKMM atomics
ThomasHaas Jun 24, 2023
3ff5e2a
Refactor & renaming of LKMM atomics.
ThomasHaas Jun 24, 2023
b44f299
Renamed LKMMOp to LKMMOpNoReturn
ThomasHaas Jun 25, 2023
9e502b3
Cleaned up LLVM RMW atomics
ThomasHaas Jun 25, 2023
8b266bd
Cleaned up TSO atomics (Xchg)
ThomasHaas Jun 25, 2023
5d9b4c1
Cleaned up LISA atomics (RMW)
ThomasHaas Jun 25, 2023
7e5607b
Cleaned up PTX atomics
ThomasHaas Jun 25, 2023
2dde2f9
Deleted now-unused RMWAbstract
ThomasHaas Jun 25, 2023
c9b9da1
Updated naming of EventVisitor.visitX methods to align with the updat…
ThomasHaas Jun 25, 2023
6a254a7
Merge pull request #475 from hernanponcedeleon/rmwBase
ThomasHaas Jun 25, 2023
ff5221b
Merge branch 'development' into test_merge
ThomasHaas Jun 25, 2023
e81e154
Generic Registers (Rework) (#471)
xeren Jun 28, 2023
f6cd58a
Functions (Part 1) (#470)
ThomasHaas Jun 29, 2023
7278dd2
Parsing & thread creation (#479)
ThomasHaas Jul 4, 2023
753837c
Type Safety (rework) (#478)
xeren Jul 4, 2023
5f9027a
Added 4 new C programs related to thread creation and inlining. (#481)
ThomasHaas Jul 5, 2023
0dd7003
Inlining & Threading (rework) (#483)
xeren Jul 11, 2023
037ba25
Inlining of nondet_int (#485)
xeren Jul 13, 2023
a201493
Merge branch 'development' into development_rework
ThomasHaas Jul 15, 2023
0f327ea
Various fixes/cleanup (#487)
ThomasHaas Jul 15, 2023
b9db99c
Merge branch 'development' into development_rework
ThomasHaas Jul 27, 2023
1b1dc70
Function passes & Thread creation after unrolling (#492)
ThomasHaas Jul 28, 2023
7b07232
Merge branch 'development' into development_rework
ThomasHaas Aug 3, 2023
16d4e0e
Thread cf & must edges (#494)
ThomasHaas Aug 3, 2023
a89dd7e
Dynamic Pthread join (#496)
ThomasHaas Aug 8, 2023
5378937
Remove prototype folder
hernan-poncedeleon Aug 8, 2023
c5300f0
Remove LLVM grammar and parser
hernan-poncedeleon Aug 8, 2023
1aa9033
Fix mavel.yml
hernan-poncedeleon Aug 8, 2023
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
2 changes: 2 additions & 0 deletions benchmarks/c/miscellaneous/nondet_loop.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include <stdint.h>
#include <assert.h>
#include <dat3m.h>

int main()
{
int x = 0;
__VERIFIER_loop_bound(3);
while (x != 5) {
if (__VERIFIER_nondet_int() == 0) {
x += 2;
Expand Down
12 changes: 9 additions & 3 deletions benchmarks/c/miscellaneous/propagatableSideEffects.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
#include <stdlib.h>
#include <assert.h>
#include <dat3m.h>

// This test makes sure that we do not accidentally cut of side-effect-full loops
// This test makes sure that we do not accidentally cut off side-effect-full loops
// whose side-effects were propagated by constant propagation
// Expected result: FAIL with B >= 3, UNKNOWN otherwise

volatile int bound = 2; // To stop the compiler from optimising away our loop
#ifndef B
#define B 3
#endif

volatile int bound = B - 1; // To stop the compiler from optimising away our loop

int main()
{
int cnt = 0;
__VERIFIER_loop_bound(B);
while (cnt++ < bound) { }
assert (0); // FAIL, unless we cut of the loop too early
assert (0); // FAIL, unless we cut off the loop too early

return 0;
}
1 change: 0 additions & 1 deletion benchmarks/c/miscellaneous/thread_chaining.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
The test shows chaining of thread creations + parameter passing, i.e, the spawned thread
spawns another thread and passes its argument to that one.
Expected result: PASS
Current result: PASS
*/

atomic_int data;
Expand Down
3 changes: 0 additions & 3 deletions benchmarks/c/miscellaneous/thread_inlining.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
/*
The test checks if inlining of thread-creating functions works properly.
Expected result: PASS
Current result:
- development: FAIL
- rework: Parsing error (matching between pthread_join and pthread_create fails)
*/

atomic_int data;
Expand Down
3 changes: 0 additions & 3 deletions benchmarks/c/miscellaneous/thread_inlining_complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
/*
The test checks if inlining of thread-creating functions + reassigning pthread_t variables works properly.
Expected result: PASS
Current result:
- development: PASS
- rework: Parsing error (matching between pthread_join and pthread_create fails)
*/

atomic_int data;
Expand Down
3 changes: 0 additions & 3 deletions benchmarks/c/miscellaneous/thread_inlining_complex_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
/*
The test checks if inlining of thread-creating/joining functions + reassigning pthread_t variables works properly.
Expected result: PASS
Current result:
- development: PASS
- rework: Parsing error (matching between pthread_join and pthread_create fails)
*/

atomic_int data;
Expand Down
33 changes: 33 additions & 0 deletions benchmarks/c/miscellaneous/thread_loop.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <pthread.h>
#include <stdatomic.h>
#include <dat3m.h>

/*
The test shows thread creation inside loops
Expected result: FAIL
*/

#ifndef N
#define N 5
#endif

atomic_int data;

void *worker(void *arg)
{
atomic_fetch_add(&data, 1);
}

int main()
{
pthread_t t[N];
int bound = __VERIFIER_nondet_int();
__VERIFIER_assume(0 <= bound && bound < N);

__VERIFIER_loop_bound(N + 1);
for (int i = 0; i < bound; i++) {
pthread_create(&t[i], NULL, worker, NULL);
}

assert(data != N - 1);
}
8 changes: 4 additions & 4 deletions dartagnan/src/main/java/com/dat3m/dartagnan/Dartagnan.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import static com.dat3m.dartagnan.GlobalSettings.LogGlobalSettings;
import static com.dat3m.dartagnan.configuration.OptionInfo.collectOptions;
import static com.dat3m.dartagnan.configuration.OptionNames.PHANTOM_REFERENCES;
import static com.dat3m.dartagnan.configuration.OptionNames.TARGET;;
import static com.dat3m.dartagnan.configuration.OptionNames.TARGET;
import static com.dat3m.dartagnan.configuration.Property.*;
import static com.dat3m.dartagnan.program.analysis.SyntacticContextAnalysis.*;
import static com.dat3m.dartagnan.utils.GitInfo.CreateGitInfo;
Expand Down Expand Up @@ -249,7 +249,7 @@ public static String generateResultSummary(VerificationTask task, ProverEnvironm
printWarningIfThreadStartFailed(p, encCtx, prover);
if (props.contains(PROGRAM_SPEC) && FALSE.equals(model.evaluate(PROGRAM_SPEC.getSMTVariable(encCtx)))) {
summary.append("===== Program specification violation found =====\n");
for(Event e : p.getEvents(Local.class)) {
for(Event e : p.getThreadEvents(Local.class)) {
if(e.hasTag(Tag.ASSERTION) && TRUE.equals(model.evaluate(encCtx.execution(e)))) {
final String callStack = makeContextString(
synContext.getContextInfo(e).getContextOfType(CallContext.class), " -> ");
Expand All @@ -265,7 +265,7 @@ public static String generateResultSummary(VerificationTask task, ProverEnvironm
}
if (props.contains(LIVENESS) && FALSE.equals(model.evaluate(LIVENESS.getSMTVariable(encCtx)))) {
summary.append("============ Liveness violation found ============\n");
for(CondJump e : p.getEvents(CondJump.class)) {
for(CondJump e : p.getThreadEvents(CondJump.class)) {
if(e.hasTag(Tag.SPINLOOP) && TRUE.equals(model.evaluate(encCtx.execution(e)))
&& TRUE.equals(model.evaluate(encCtx.jumpCondition(e)))) {
final String callStack = makeContextString(
Expand Down Expand Up @@ -350,7 +350,7 @@ public static String generateResultSummary(VerificationTask task, ProverEnvironm
}

private static void printWarningIfThreadStartFailed(Program p, EncodingContext encoder, ProverEnvironment prover) throws SolverException {
for (Event e : p.getEvents()) {
for (Event e : p.getThreadEvents()) {
if (e.hasTag(Tag.STARTLOAD) && BigInteger.ZERO.equals(prover.getModel().evaluate(encoder.value((Load) e)))) {
// This msg should be displayed even if the logging is off
System.out.printf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,11 @@ private void initialize() {
}
}
} else {
for (Event e : verificationTask.getProgram().getEvents()) {
for (Event e : verificationTask.getProgram().getThreadEvents()) {
controlFlowVariables.put(e, booleanFormulaManager.makeVariable("cf " + e.getGlobalId()));
}
}
for (Event e : verificationTask.getProgram().getEvents()) {
for (Event e : verificationTask.getProgram().getThreadEvents()) {
if (!e.cfImpliesExec()) {
executionVariables.put(e, booleanFormulaManager.makeVariable("exec " + e.getGlobalId()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public Formula visit(INonDet iNonDet) {
@Override
public Formula visit(Register reg) {
String name = event == null ?
reg.getName() + "_" + reg.getFunctionId() + "_final" :
reg.getName() + "_" + reg.getFunction().getId() + "_final" :
reg.getName() + "(" + event.getGlobalId() + ")";
Type type = reg.getType();
return context.makeVariable(name, type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.dat3m.dartagnan.program.event.core.CondJump;
import com.dat3m.dartagnan.program.event.core.Event;
import com.dat3m.dartagnan.program.event.core.Label;
import com.dat3m.dartagnan.program.event.core.threading.ThreadStart;
import com.dat3m.dartagnan.program.event.core.utils.RegWriter;
import com.dat3m.dartagnan.program.memory.Memory;
import com.google.common.base.Preconditions;
Expand All @@ -21,7 +22,9 @@
import org.sosy_lab.java_smt.api.*;
import org.sosy_lab.java_smt.api.NumeralFormula.IntegerFormula;

import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import static com.dat3m.dartagnan.GlobalSettings.getArchPrecision;
import static com.dat3m.dartagnan.configuration.OptionNames.INITIALIZE_REGISTERS;
Expand Down Expand Up @@ -109,23 +112,30 @@ public BooleanFormula encodeControlFlow() {

private BooleanFormula encodeThreadCF(Thread thread) {
final BooleanFormulaManager bmgr = context.getBooleanFormulaManager();

Map<Label, Set<CondJump>> labelJumpMap = new HashMap<>();
Event pred = null;
final ThreadStart startEvent = thread.getEntry();
final List<BooleanFormula> enc = new ArrayList<>();
for(Event e : thread.getEntry().getSuccessors()) {

final BooleanFormula cfStart = context.controlFlow(startEvent);
if (startEvent.getCreator() == null) {
enc.add(cfStart);
} else if (startEvent.mayFailSpuriously()) {
enc.add(bmgr.implication(cfStart, context.execution(startEvent.getCreator())));
} else {
enc.add(bmgr.equivalence(cfStart, context.execution(startEvent.getCreator())));
}
enc.add(startEvent.encodeExec(context));

Event pred = startEvent;
for(Event e : startEvent.getSuccessor().getSuccessors()) {
// Immediate control flow
BooleanFormula cfCond = pred == null ? bmgr.makeTrue() : context.controlFlow(pred);
BooleanFormula cfCond = context.controlFlow(pred);
if (pred instanceof CondJump jump) {
cfCond = bmgr.and(cfCond, bmgr.not(context.jumpCondition(jump)));
// NOTE: we need to register the actual jumps here, because the
// listener sets of labels is too large (it contains old copies)
labelJumpMap.computeIfAbsent(jump.getLabel(), key -> new HashSet<>()).add(jump);
}

// Control flow via jumps
if (e instanceof Label) {
for (CondJump jump : labelJumpMap.getOrDefault(e, Collections.emptySet())) {
if (e instanceof Label label) {
for (CondJump jump : label.getJumpSet()) {
cfCond = bmgr.or(cfCond, bmgr.and(context.controlFlow(jump), context.jumpCondition(jump)));
}
}
Expand All @@ -145,7 +155,7 @@ public BooleanFormula encodeMemory() {
// For all objects, their 'final' value fetched here represents their constant value.
BooleanFormula[] addrExprs;
if(getArchPrecision() > -1) {
final BitvectorFormulaManager bvmgr = fmgr.getBitvectorFormulaManager();
final BitvectorFormulaManager bvmgr = fmgr.getBitvectorFormulaManager();
addrExprs = memory.getObjects().stream()
.map(addr -> bvmgr.equal((BitvectorFormula) context.encodeFinalExpression(addr),
bvmgr.makeBitvector(getArchPrecision(), addr.getValue().intValue())))
Expand All @@ -154,7 +164,7 @@ public BooleanFormula encodeMemory() {
final IntegerFormulaManager imgr = fmgr.getIntegerFormulaManager();
addrExprs = memory.getObjects().stream()
.map(addr -> imgr.equal((IntegerFormula) context.encodeFinalExpression(addr),
imgr.makeNumber(addr.getValue().intValue())))
imgr.makeNumber(addr.getValue().intValue())))
.toArray(BooleanFormula[]::new);
}
return fmgr.getBooleanFormulaManager().and(addrExprs);
Expand Down Expand Up @@ -209,9 +219,9 @@ public BooleanFormula encodeDependencies() {
}

public BooleanFormula encodeFilter() {
return context.getTask().getProgram().getFilterSpecification() != null ?
return context.getTask().getProgram().getFilterSpecification() != null ?
context.getTask().getProgram().getFilterSpecification().encode(context) :
context.getBooleanFormulaManager().makeTrue();
context.getBooleanFormulaManager().makeTrue();
}

public BooleanFormula encodeFinalRegisterValues() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static PropertyEncoder withContext(EncodingContext context) throws Invali
public BooleanFormula encodeBoundEventExec() {
logger.info("Encoding bound events execution");
final BooleanFormulaManager bmgr = context.getBooleanFormulaManager();
return program.getEvents()
return program.getThreadEvents()
.stream().filter(e -> e.hasTag(Tag.BOUND)).map(context::execution).reduce(bmgr.makeFalse(), bmgr::or);
}

Expand Down Expand Up @@ -163,7 +163,7 @@ private BooleanFormula encodeLastCoConstraints() {
final BooleanFormulaManager bmgr = context.getBooleanFormulaManager();
final EncodingContext.EdgeEncoder coEncoder = context.edge(co);
final RelationAnalysis.Knowledge knowledge = ra.getKnowledge(co);
final List<Init> initEvents = program.getEvents(Init.class);
final List<Init> initEvents = program.getThreadEvents(Init.class);
final boolean doEncodeFinalAddressValues = program.getFormat() == LITMUS;
// Find transitively implied coherences. We can use these to reduce the encoding.
final Set<Tuple> transCo = ra.findTransitivelyImpliedCo(co);
Expand All @@ -175,7 +175,7 @@ private BooleanFormula encodeLastCoConstraints() {
// ---- Construct encoding ----
List<BooleanFormula> enc = new ArrayList<>();
final Function<Event, Collection<Tuple>> out = knowledge.getMayOut();
for (Store w1 : program.getEvents(Store.class)) {
for (Store w1 : program.getThreadEvents(Store.class)) {
if (dominatedWrites.contains(w1)) {
enc.add(bmgr.not(lastCoVar(w1)));
continue;
Expand Down Expand Up @@ -212,12 +212,12 @@ private BooleanFormula encodeLastCoConstraints() {
// but the final value of a location should always match that of some coLast event.
// lastCo(w) => (lastVal(w.address) = w.val)
// \/ (exists w2 : lastCo(w2) /\ lastVal(w.address) = w2.val))
for (Init init : program.getEvents(Init.class)) {
for (Init init : program.getThreadEvents(Init.class)) {
BooleanFormula lastValueEnc = bmgr.makeFalse();
BooleanFormula lastStoreExistsEnc = bmgr.makeFalse();
Formula v2 = ExpressionEncoder.getLastMemValueExpr(init.getBase(), init.getOffset(), fmgr);
BooleanFormula readFromInit = context.equal(context.value(init), v2);
for (Store w : program.getEvents(Store.class)) {
for (Store w : program.getThreadEvents(Store.class)) {
if (!alias.mayAlias(w, init)) {
continue;
}
Expand Down Expand Up @@ -485,22 +485,22 @@ private BooleanFormula generateStucknessEncoding(List<SpinIteration> loops, Enco
}

private List<SpinIteration> findSpinLoopsInThread(Thread thread, LoopAnalysis loopAnalysis) {
final List<LoopAnalysis.LoopInfo> loops = loopAnalysis.getLoopsOfThread(thread);
final List<LoopAnalysis.LoopInfo> loops = loopAnalysis.getLoopsOfFunction(thread);
final List<SpinIteration> spinIterations = new ArrayList<>();

for (LoopAnalysis.LoopInfo loop : loops) {
for (LoopAnalysis.LoopIterationInfo iter : loop.getIterations()) {
for (LoopAnalysis.LoopIterationInfo iter : loop.iterations()) {
final List<Event> iterBody = iter.computeBody();
final List<CondJump> spinningJumps = iterBody.stream()
.filter(e -> e instanceof CondJump && e.hasTag(Tag.SPINLOOP))
.map(CondJump.class::cast)
.collect(Collectors.toList());
.toList();

if (!spinningJumps.isEmpty()) {
final List<Load> loads = iterBody.stream()
.filter(Load.class::isInstance)
.map(Load.class::cast)
.collect(Collectors.toList());
.toList();

final SpinIteration spinIter = new SpinIteration();
spinIter.spinningJumps.addAll(spinningJumps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public Void visitInverse(Relation rel, Relation r1) {
@Override
public Void visitFences(Relation rel, Filter fenceSet) {
final RelationAnalysis.Knowledge k = ra.getKnowledge(rel);
List<Event> fences = program.getEvents().stream().filter(fenceSet::apply).collect(toList());
List<Event> fences = program.getThreadEvents().stream().filter(fenceSet::apply).collect(toList());
EncodingContext.EdgeEncoder encoder = context.edge(rel);
for (Tuple tuple : encodeSets.get(rel)) {
Event e1 = tuple.getFirst();
Expand Down Expand Up @@ -434,7 +434,7 @@ public Void visitReadModifyWrites(Relation rmw) {
final Function<Event, Collection<Tuple>> mayOut = k.getMayOut();

// ---------- Encode matching for LL/SC-type RMWs ----------
for (RMWStoreExclusive store : program.getEvents(RMWStoreExclusive.class)) {
for (RMWStoreExclusive store : program.getThreadEvents(RMWStoreExclusive.class)) {
BooleanFormula storeExec = bmgr.makeFalse();
for (Tuple t : mayIn.apply(store)) {
MemoryCoreEvent load = (MemoryCoreEvent) t.getFirst();
Expand Down Expand Up @@ -548,7 +548,7 @@ public Void visitReadFrom(Relation rf) {
@Override
public Void visitCoherence(Relation co) {
boolean idl = !context.useSATEncoding;
List<MemoryCoreEvent> allWrites = program.getEvents(MemoryCoreEvent.class).stream()
List<MemoryCoreEvent> allWrites = program.getThreadEvents(MemoryCoreEvent.class).stream()
.filter(e -> e.hasTag(WRITE))
.sorted(Comparator.comparingInt(Event::getGlobalId))
.toList();
Expand Down Expand Up @@ -638,7 +638,7 @@ public Void visitSyncBarrier(Relation rel) {
@Override
public Void visitSyncFence(Relation syncFence) {
boolean idl = !context.useSATEncoding;
List<Fence> allFenceSC = program.getEvents(Fence.class).stream()
List<Fence> allFenceSC = program.getThreadEvents(Fence.class).stream()
.filter(e -> e.hasTag(Tag.PTX.SC))
.sorted(Comparator.comparingInt(Event::getGlobalId))
.toList();
Expand Down
Loading
Loading