use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.
the class RcuGraph method repopulate.
@Override
public void repopulate() {
this.lockUnlockMap = HashBiMap.create();
this.unlockLockMap = lockUnlockMap.inverse();
Stack<EventData> lastLocks = new Stack<>();
for (List<EventData> events : model.getThreadEventsMap().values()) {
for (EventData e : events) {
if (LOCK_FILTER.filter(e.getEvent())) {
lastLocks.push(e);
} else if (UNLOCK_FILTER.filter(e.getEvent())) {
if (!lastLocks.isEmpty()) {
lockUnlockMap.put(lastLocks.pop(), e);
} else {
throw new IllegalStateException("Unbalanced RCU-Locks: Unlock without preceding Lock");
}
}
}
if (!lastLocks.isEmpty()) {
throw new IllegalStateException("Unbalanced RCU-Locks: Lock without subsequent Unlock");
}
}
size = lockUnlockMap.size();
}
use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.
the class CoherenceGraph method edgeIterator.
@Override
public Iterator<Edge> edgeIterator(int id, EdgeDirection dir) {
EventData e = getEvent(id);
if (!e.isWrite()) {
return Collections.emptyIterator();
}
com.google.common.base.Function<EventData, Edge> mapping = dir == EdgeDirection.INGOING ? (event -> new Edge(event.getId(), id)) : (event -> new Edge(id, event.getId()));
return Iterators.transform(getCoSuccessorList(e, dir).iterator(), mapping);
}
use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.
the class CoherenceGraph method edgeStream.
@Override
public Stream<Edge> edgeStream(int id, EdgeDirection dir) {
EventData e = getEvent(id);
if (!e.isWrite()) {
return Stream.empty();
}
Function<EventData, Edge> mapping = dir == EdgeDirection.INGOING ? (event -> new Edge(event.getId(), id)) : (event -> new Edge(id, event.getId()));
return getCoSuccessorList(e, dir).stream().map(mapping);
}
use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.
the class ExternalGraph method containsById.
@Override
public boolean containsById(int id1, int id2) {
EventData a = getEvent(id1);
EventData b = getEvent(id2);
return a.getThread() != b.getThread();
}
use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.
the class FenceGraph method size.
@Override
public int size(int id, EdgeDirection dir) {
EventData e = getEvent(id);
if (!e.isMemoryEvent()) {
return 0;
}
int size = 0;
if (dir == EdgeDirection.OUTGOING) {
EventData closestFence = getNextFence(e);
if (closestFence == null) {
return 0;
}
List<EventData> eventsAfterFence = model.getThreadEventsMap().get(e.getThread());
eventsAfterFence = eventsAfterFence.subList(closestFence.getLocalId() + 1, eventsAfterFence.size());
return (int) eventsAfterFence.stream().filter(EventData::isMemoryEvent).count();
} else if (dir == EdgeDirection.INGOING) {
EventData closestFence = getPreviousFence(e);
if (closestFence == null) {
return 0;
}
List<EventData> eventsBeforeFence = model.getThreadEventsMap().get(e.getThread());
eventsBeforeFence = eventsBeforeFence.subList(0, closestFence.getLocalId());
return (int) eventsBeforeFence.stream().filter(EventData::isMemoryEvent).count();
}
return size;
}
Aggregations