Search in sources :

Example 11 with ExecutionAnalysis

use of com.dat3m.dartagnan.program.analysis.ExecutionAnalysis in project Dat3M by hernanponcedeleon.

the class Relation method removeMutuallyExclusiveTuples.

protected void removeMutuallyExclusiveTuples(Set<Tuple> tupleSet) {
    ExecutionAnalysis exec = analysisContext.requires(ExecutionAnalysis.class);
    tupleSet.removeIf(t -> exec.areMutuallyExclusive(t.getFirst(), t.getSecond()));
}
Also used : ExecutionAnalysis(com.dat3m.dartagnan.program.analysis.ExecutionAnalysis)

Example 12 with ExecutionAnalysis

use of com.dat3m.dartagnan.program.analysis.ExecutionAnalysis in project Dat3M by hernanponcedeleon.

the class RelFencerel method getMinTupleSet.

@Override
public TupleSet getMinTupleSet() {
    if (minTupleSet == null) {
        ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class);
        minTupleSet = new TupleSet();
        for (Thread t : task.getProgram().getThreads()) {
            List<Event> fences = t.getCache().getEvents(FilterBasic.get(fenceName));
            List<Event> memEvents = t.getCache().getEvents(FilterBasic.get(Tag.MEMORY));
            for (Event fence : fences) {
                int numEventsBeforeFence = (int) memEvents.stream().mapToInt(Event::getCId).filter(id -> id < fence.getCId()).count();
                List<Event> eventsBefore = memEvents.subList(0, numEventsBeforeFence);
                List<Event> eventsAfter = memEvents.subList(numEventsBeforeFence, memEvents.size());
                for (Event e1 : eventsBefore) {
                    boolean isImpliedByE1 = exec.isImplied(e1, fence);
                    for (Event e2 : eventsAfter) {
                        if (isImpliedByE1 || exec.isImplied(e2, fence)) {
                            minTupleSet.add(new Tuple(e1, e2));
                        }
                    }
                }
            }
        }
        removeMutuallyExclusiveTuples(minTupleSet);
    }
    return minTupleSet;
}
Also used : TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) ExecutionAnalysis(com.dat3m.dartagnan.program.analysis.ExecutionAnalysis) Event(com.dat3m.dartagnan.program.event.core.Event) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple) Thread(com.dat3m.dartagnan.program.Thread)

Example 13 with ExecutionAnalysis

use of com.dat3m.dartagnan.program.analysis.ExecutionAnalysis in project Dat3M by hernanponcedeleon.

the class RelComposition method getMinTupleSet.

@Override
public TupleSet getMinTupleSet() {
    if (minTupleSet == null) {
        ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class);
        minTupleSet = r1.getMinTupleSet().postComposition(r2.getMinTupleSet(), (t1, t2) -> exec.isImplied(t1.getFirst(), t1.getSecond()) || exec.isImplied(t2.getSecond(), t1.getSecond()));
        removeMutuallyExclusiveTuples(minTupleSet);
    }
    return minTupleSet;
}
Also used : BooleanFormulaManager(org.sosy_lab.java_smt.api.BooleanFormulaManager) HashSet(java.util.HashSet) TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) ExecutionAnalysis(com.dat3m.dartagnan.program.analysis.ExecutionAnalysis) SolverContext(org.sosy_lab.java_smt.api.SolverContext) Event(com.dat3m.dartagnan.program.event.core.Event) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple) BooleanFormula(org.sosy_lab.java_smt.api.BooleanFormula) Set(java.util.Set) Relation(com.dat3m.dartagnan.wmm.relation.Relation) Sets(com.google.common.collect.Sets) ExecutionAnalysis(com.dat3m.dartagnan.program.analysis.ExecutionAnalysis)

Example 14 with ExecutionAnalysis

use of com.dat3m.dartagnan.program.analysis.ExecutionAnalysis in project Dat3M by hernanponcedeleon.

the class RelComposition method getMaxTupleSetRecursive.

@Override
public TupleSet getMaxTupleSetRecursive() {
    if (recursiveGroupId > 0 && maxTupleSet != null) {
        ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class);
        maxTupleSet = r1.getMaxTupleSetRecursive().postComposition(r2.getMaxTupleSetRecursive(), (t1, t2) -> !exec.areMutuallyExclusive(t1.getFirst(), t2.getSecond()));
        return maxTupleSet;
    }
    return getMaxTupleSet();
}
Also used : BooleanFormulaManager(org.sosy_lab.java_smt.api.BooleanFormulaManager) HashSet(java.util.HashSet) TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) ExecutionAnalysis(com.dat3m.dartagnan.program.analysis.ExecutionAnalysis) SolverContext(org.sosy_lab.java_smt.api.SolverContext) Event(com.dat3m.dartagnan.program.event.core.Event) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple) BooleanFormula(org.sosy_lab.java_smt.api.BooleanFormula) Set(java.util.Set) Relation(com.dat3m.dartagnan.wmm.relation.Relation) Sets(com.google.common.collect.Sets) ExecutionAnalysis(com.dat3m.dartagnan.program.analysis.ExecutionAnalysis)

Aggregations

ExecutionAnalysis (com.dat3m.dartagnan.program.analysis.ExecutionAnalysis)14 Event (com.dat3m.dartagnan.program.event.core.Event)13 Tuple (com.dat3m.dartagnan.wmm.utils.Tuple)11 TupleSet (com.dat3m.dartagnan.wmm.utils.TupleSet)11 Relation (com.dat3m.dartagnan.wmm.relation.Relation)8 BooleanFormula (org.sosy_lab.java_smt.api.BooleanFormula)7 BooleanFormulaManager (org.sosy_lab.java_smt.api.BooleanFormulaManager)7 SolverContext (org.sosy_lab.java_smt.api.SolverContext)7 Sets (com.google.common.collect.Sets)6 Set (java.util.Set)5 HashSet (java.util.HashSet)3 Collectors (java.util.stream.Collectors)3 AliasAnalysis (com.dat3m.dartagnan.program.analysis.AliasAnalysis)2 Tag (com.dat3m.dartagnan.program.event.Tag)2 Load (com.dat3m.dartagnan.program.event.core.Load)2 MemEvent (com.dat3m.dartagnan.program.event.core.MemEvent)2 Store (com.dat3m.dartagnan.program.event.core.Store)2 EndAtomic (com.dat3m.dartagnan.program.event.lang.svcomp.EndAtomic)2 FilterAbstract (com.dat3m.dartagnan.program.filter.FilterAbstract)2 java.util (java.util)2