use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.
the class FenceGraph method getPreviousFence.
public EventData getPreviousFence(EventData e) {
List<EventData> fences = threadFencesMap.get(e.getThread());
if (fences.isEmpty()) {
return null;
}
EventData closestFence = null;
for (EventData fence : fences) {
if (fence.getLocalId() < e.getLocalId()) {
closestFence = fence;
} else {
break;
}
}
return closestFence;
}
use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.
the class FenceGraph method repopulate.
@Override
public void repopulate() {
threadFencesMap = new HashMap<>();
for (Thread t : model.getThreads()) {
threadFencesMap.put(t, new ArrayList<>());
}
Set<EventData> fenceEvents = model.getFenceMap().get(fenceName);
if (fenceEvents == null) {
return;
}
for (EventData fence : fenceEvents) {
threadFencesMap.get(fence.getThread()).add(fence);
}
for (List<EventData> fenceList : threadFencesMap.values()) {
fenceList.sort(Comparator.comparingInt(EventData::getLocalId));
}
super.autoComputeSize();
}
use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.
the class FenceGraph method containsById.
@Override
public boolean containsById(int id1, int id2) {
EventData a = getEvent(id1);
EventData b = getEvent(id2);
if (a.getThread() != b.getThread() || a.getLocalId() >= b.getLocalId() || !a.isMemoryEvent() || !b.isMemoryEvent()) {
return false;
}
// TODO: We might want to employ binary search instead of linear search
return threadFencesMap.get(a.getThread()).stream().anyMatch(fence -> a.getLocalId() < fence.getLocalId() && fence.getLocalId() < b.getLocalId());
}
use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.
the class LocationGraph method containsById.
@Override
public boolean containsById(int id1, int id2) {
EventData a = getEvent(id1);
EventData b = getEvent(id2);
return a.isMemoryEvent() && b.isMemoryEvent() && a.getAccessedAddress().equals(b.getAccessedAddress());
}
use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.
the class ProgramOrderGraph method edgeStream.
@Override
public Stream<Edge> edgeStream(int id, EdgeDirection dir) {
EventData e = getEvent(id);
List<EventData> threadEvents = model.getThreadEventsMap().get(e.getThread());
if (dir == EdgeDirection.OUTGOING) {
return threadEvents.subList(e.getLocalId() + 1, threadEvents.size()).stream().map(x -> new Edge(id, x.getId()));
} else {
return threadEvents.subList(0, e.getLocalId()).stream().map(x -> new Edge(x.getId(), id));
}
}
Aggregations