Search in sources :

Example 1 with EventData

use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.

the class CoherenceGraph method containsById.

@Override
public boolean containsById(int id1, int id2) {
    EventData a = getEvent(id1);
    EventData b = getEvent(id2);
    return a.getCoherenceIndex() < b.getCoherenceIndex() && a.isWrite() && b.isWrite() && a.getAccessedAddress().equals(b.getAccessedAddress());
}
Also used : EventData(com.dat3m.dartagnan.verification.model.EventData)

Example 2 with EventData

use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.

the class CoherenceGraph method size.

@Override
public int size(int id, EdgeDirection dir) {
    EventData e = getEvent(id);
    if (!e.isWrite()) {
        return 0;
    }
    List<EventData> sameAddrWrites = coMap.get(e.getAccessedAddress());
    if (sameAddrWrites == null) {
        return 0;
    }
    int index = e.getCoherenceIndex();
    return dir == EdgeDirection.INGOING ? (index - 1) : (sameAddrWrites.size() - index - 1);
}
Also used : EventData(com.dat3m.dartagnan.verification.model.EventData)

Example 3 with EventData

use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.

the class ExecutionGraphVisualizer method addThreadPo.

private ExecutionGraphVisualizer addThreadPo(Thread thread, ExecutionModel model) {
    List<EventData> threadEvents = model.getThreadEventsMap().get(thread);
    if (threadEvents.size() <= 1) {
        return this;
    }
    // --- Subgraph start ---
    graphviz.beginSubgraph("T" + thread.getId());
    graphviz.setEdgeAttributes("weight=10");
    // --- Node list ---
    for (int i = 1; i < threadEvents.size(); i++) {
        EventData e1 = threadEvents.get(i - 1);
        EventData e2 = threadEvents.get(i);
        if (ignore(e1) || ignore(e2)) {
            continue;
        }
        if (e1.getEvent().getCLine() != e2.getEvent().getCLine()) {
            appendEdge(e1, e2, model, (String[]) null);
        }
    }
    // --- Subgraph end ---
    graphviz.end();
    return this;
}
Also used : EventData(com.dat3m.dartagnan.verification.model.EventData)

Example 4 with EventData

use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.

the class ExternalGraph method edgeStream.

@Override
public Stream<Edge> edgeStream(int id, EdgeDirection dir) {
    EventData e = getEvent(id);
    Function<EventData, Edge> edgeMapping = dir == EdgeDirection.OUTGOING ? (x -> new Edge(id, x.getId())) : (x -> new Edge(x.getId(), id));
    return threadEventsMap.entrySet().stream().filter(x -> x.getKey() != e.getThread()).flatMap(x -> x.getValue().stream()).map(edgeMapping);
}
Also used : IntStream(java.util.stream.IntStream) List(java.util.List) Stream(java.util.stream.Stream) EventData(com.dat3m.dartagnan.verification.model.EventData) Map(java.util.Map) Thread(com.dat3m.dartagnan.program.Thread) Function(java.util.function.Function) Edge(com.dat3m.dartagnan.solver.caat.predicates.relationGraphs.Edge) EdgeDirection(com.dat3m.dartagnan.solver.caat.misc.EdgeDirection) Edge(com.dat3m.dartagnan.solver.caat.predicates.relationGraphs.Edge) EventData(com.dat3m.dartagnan.verification.model.EventData)

Example 5 with EventData

use of com.dat3m.dartagnan.verification.model.EventData in project Dat3M by hernanponcedeleon.

the class FenceGraph method edgeStream.

@Override
public Stream<Edge> edgeStream(int id, EdgeDirection dir) {
    EventData e = getEvent(id);
    if (!e.isMemoryEvent()) {
        return Stream.empty();
    }
    List<EventData> threadEvents = model.getThreadEventsMap().get(e.getThread());
    if (dir == EdgeDirection.OUTGOING) {
        EventData fence = getNextFence(e);
        return fence == null ? Stream.empty() : threadEvents.subList(fence.getLocalId() + 1, threadEvents.size()).stream().filter(EventData::isMemoryEvent).map(x -> new Edge(id, x.getId()));
    } else {
        EventData fence = getPreviousFence(e);
        return fence == null ? Stream.empty() : threadEvents.subList(0, fence.getLocalId()).stream().filter(EventData::isMemoryEvent).map(x -> new Edge(x.getId(), id));
    }
}
Also used : java.util(java.util) Stream(java.util.stream.Stream) EventData(com.dat3m.dartagnan.verification.model.EventData) Thread(com.dat3m.dartagnan.program.Thread) Edge(com.dat3m.dartagnan.solver.caat.predicates.relationGraphs.Edge) EdgeDirection(com.dat3m.dartagnan.solver.caat.misc.EdgeDirection) 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