Search in sources :

Example 26 with Event

use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.

the class RelTrans method getFullEncodeTupleSet.

private TupleSet getFullEncodeTupleSet(TupleSet tuples) {
    TupleSet processNow = new TupleSet(Sets.intersection(tuples, getMaxTupleSet()));
    TupleSet result = new TupleSet();
    while (!processNow.isEmpty()) {
        TupleSet processNext = new TupleSet();
        result.addAll(processNow);
        for (Tuple tuple : processNow) {
            Event e1 = tuple.getFirst();
            Event e2 = tuple.getSecond();
            for (Tuple t : r1.getMaxTupleSet().getByFirst(e1)) {
                Event e3 = t.getSecond();
                if (e3.getCId() != e1.getCId() && e3.getCId() != e2.getCId() && transitiveReachabilityMap.get(e3).contains(e2)) {
                    result.add(new Tuple(e1, e3));
                    processNext.add(new Tuple(e3, e2));
                }
            }
        }
        processNext.removeAll(result);
        processNow = processNext;
    }
    return result;
}
Also used : TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) Event(com.dat3m.dartagnan.program.event.core.Event) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple)

Example 27 with Event

use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.

the class RelInt method getMaxTupleSet.

@Override
public TupleSet getMaxTupleSet() {
    if (maxTupleSet == null) {
        maxTupleSet = new TupleSet();
        for (Thread t : task.getProgram().getThreads()) {
            List<Event> events = t.getCache().getEvents(FilterBasic.get(Tag.VISIBLE));
            for (Event e1 : events) {
                for (Event e2 : events) {
                    maxTupleSet.add(new Tuple(e1, e2));
                }
            }
        }
        removeMutuallyExclusiveTuples(maxTupleSet);
    }
    return maxTupleSet;
}
Also used : TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) Event(com.dat3m.dartagnan.program.event.core.Event) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple) Thread(com.dat3m.dartagnan.program.Thread)

Example 28 with Event

use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.

the class RelPo method getMaxTupleSet.

@Override
public TupleSet getMaxTupleSet() {
    if (maxTupleSet == null) {
        maxTupleSet = new TupleSet();
        for (Thread t : task.getProgram().getThreads()) {
            List<Event> events = t.getCache().getEvents(filter);
            for (int i = 0; i < events.size(); i++) {
                Event e1 = events.get(i);
                for (int j = i + 1; j < events.size(); j++) {
                    Event e2 = events.get(j);
                    maxTupleSet.add(new Tuple(e1, e2));
                }
            }
        }
        removeMutuallyExclusiveTuples(maxTupleSet);
    }
    return maxTupleSet;
}
Also used : TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) Event(com.dat3m.dartagnan.program.event.core.Event) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple) Thread(com.dat3m.dartagnan.program.Thread)

Example 29 with Event

use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.

the class TupleSet method preComposition.

// TODO: Make clear through which tuple set is iterated first/second
// This can make a big difference because getByFirst/Second needs to be recomputed
// if the corresponding tuple set is changed (e.g. by repeated composition)
public TupleSet preComposition(TupleSet tuples) {
    TupleSet result = new TupleSet();
    for (Tuple t1 : tuples) {
        Event e1 = t1.getFirst();
        Event e2 = t1.getSecond();
        for (Tuple t2 : this.getByFirst(e2)) {
            Event e3 = t2.getSecond();
            result.add(new Tuple(e1, e3));
        }
    }
    return result;
}
Also used : Event(com.dat3m.dartagnan.program.event.core.Event)

Example 30 with Event

use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.

the class TupleSet method approximateTransitiveMustReduction.

// =============== Static utility functions =================
public static TupleSet approximateTransitiveMustReduction(ExecutionAnalysis exec, TupleSet minSet) {
    // Approximative must-transitive reduction of minSet:
    TupleSet reduct = new TupleSet();
    Iterable<Event> codomain = Iterables.transform(minSet, Tuple::getSecond);
    DependencyGraph<Event> depGraph = DependencyGraph.from(codomain, e -> Iterables.transform(minSet.getBySecond(e), Tuple::getFirst));
    for (DependencyGraph<Event>.Node start : depGraph.getNodes()) {
        Event e1 = start.getContent();
        List<DependencyGraph<Event>.Node> deps = start.getDependents();
        for (int i = deps.size() - 1; i >= 0; i--) {
            DependencyGraph<Event>.Node end = deps.get(i);
            Event e3 = end.getContent();
            boolean redundant = false;
            for (DependencyGraph<Event>.Node mid : deps.subList(0, i)) {
                Event e2 = mid.getContent();
                if (exec.isImplied(e1, e2) || exec.isImplied(e3, e2)) {
                    if (minSet.contains(new Tuple(e2, e3))) {
                        redundant = true;
                        break;
                    }
                }
            }
            if (!redundant) {
                reduct.add(new Tuple(e1, e3));
            }
        }
    }
    return reduct;
}
Also used : Event(com.dat3m.dartagnan.program.event.core.Event) DependencyGraph(com.dat3m.dartagnan.utils.dependable.DependencyGraph)

Aggregations

Event (com.dat3m.dartagnan.program.event.core.Event)104 Tuple (com.dat3m.dartagnan.wmm.utils.Tuple)34 Thread (com.dat3m.dartagnan.program.Thread)32 Register (com.dat3m.dartagnan.program.Register)25 TupleSet (com.dat3m.dartagnan.wmm.utils.TupleSet)25 MemEvent (com.dat3m.dartagnan.program.event.core.MemEvent)20 Tag (com.dat3m.dartagnan.program.event.Tag)16 Label (com.dat3m.dartagnan.program.event.core.Label)16 Collectors (java.util.stream.Collectors)16 BooleanFormula (org.sosy_lab.java_smt.api.BooleanFormula)16 BooleanFormulaManager (org.sosy_lab.java_smt.api.BooleanFormulaManager)16 LogManager (org.apache.logging.log4j.LogManager)15 Logger (org.apache.logging.log4j.Logger)15 Program (com.dat3m.dartagnan.program.Program)12 ExecutionAnalysis (com.dat3m.dartagnan.program.analysis.ExecutionAnalysis)12 RegWriter (com.dat3m.dartagnan.program.event.core.utils.RegWriter)12 java.util (java.util)12 SolverContext (org.sosy_lab.java_smt.api.SolverContext)12 FilterBasic (com.dat3m.dartagnan.program.filter.FilterBasic)11 CondJump (com.dat3m.dartagnan.program.event.core.CondJump)10