Search in sources :

Example 6 with EventData

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;
}
Also used : EventData(com.dat3m.dartagnan.verification.model.EventData)

Example 7 with EventData

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();
}
Also used : EventData(com.dat3m.dartagnan.verification.model.EventData) Thread(com.dat3m.dartagnan.program.Thread)

Example 8 with EventData

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());
}
Also used : EventData(com.dat3m.dartagnan.verification.model.EventData)

Example 9 with EventData

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());
}
Also used : EventData(com.dat3m.dartagnan.verification.model.EventData)

Example 10 with EventData

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));
    }
}
Also used : Edge(com.dat3m.dartagnan.solver.caat.predicates.relationGraphs.Edge) EventData(com.dat3m.dartagnan.verification.model.EventData)

Aggregations

EventData (com.dat3m.dartagnan.verification.model.EventData)28 Edge (com.dat3m.dartagnan.solver.caat.predicates.relationGraphs.Edge)10 EdgeDirection (com.dat3m.dartagnan.solver.caat.misc.EdgeDirection)6 Stream (java.util.stream.Stream)6 Function (java.util.function.Function)5 Thread (com.dat3m.dartagnan.program.Thread)4 BigInteger (java.math.BigInteger)4 java.util (java.util)4 List (java.util.List)3 Map (java.util.Map)3 Iterators (com.google.common.collect.Iterators)2 Spliterator (java.util.Spliterator)2 IntStream (java.util.stream.IntStream)2 StreamSupport (java.util.stream.StreamSupport)2 Register (com.dat3m.dartagnan.program.Register)1 MemEvent (com.dat3m.dartagnan.program.event.core.MemEvent)1 RMWStore (com.dat3m.dartagnan.program.event.core.rmw.RMWStore)1 EventDomain (com.dat3m.dartagnan.solver.caat4wmm.EventDomain)1 FenceGraph (com.dat3m.dartagnan.solver.caat4wmm.basePredicates.FenceGraph)1 ArrayList (java.util.ArrayList)1