use of com.dat3m.dartagnan.program.analysis.BranchEquivalence in project Dat3M by hernanponcedeleon.
the class EndAtomic method runLocalAnalysis.
@Override
public void runLocalAnalysis(Program program, Context context) {
// ===== Temporary fix to rematch atomic blocks correctly =====
BranchEquivalence eq = context.requires(BranchEquivalence.class);
List<Event> begins = this.thread.getEvents().stream().filter(x -> x instanceof BeginAtomic && eq.isReachableFrom(x, this)).collect(Collectors.toList());
this.begin = (BeginAtomic) begins.get(begins.size() - 1);
// =======================================================
findEnclosedEvents(eq);
}
use of com.dat3m.dartagnan.program.analysis.BranchEquivalence in project Dat3M by hernanponcedeleon.
the class EndAtomic method findEnclosedEvents.
private void findEnclosedEvents(BranchEquivalence eq) {
enclosedEvents = new ArrayList<>();
BranchEquivalence.Class startClass = eq.getEquivalenceClass(begin);
BranchEquivalence.Class endClass = eq.getEquivalenceClass(this);
if (!startClass.getReachableClasses().contains(endClass)) {
logger.warn("BeginAtomic" + begin.getCId() + "can't reach EndAtomic " + this.getCId());
}
for (BranchEquivalence.Class c : startClass.getReachableClasses()) {
for (Event e : c) {
if (begin.getCId() <= e.getCId() && e.getCId() <= this.getCId()) {
if (!eq.isImplied(e, begin)) {
logger.warn(e + " is inside atomic block but can be reached from the outside");
}
enclosedEvents.add(e);
e.addFilters(RMW);
}
}
}
enclosedEvents.sort(Comparator.naturalOrder());
enclosedEvents = ImmutableList.copyOf(enclosedEvents);
}
Aggregations