Search in sources :

Example 91 with Event

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

the class RelCartesian method getMaxTupleSet.

@Override
public TupleSet getMaxTupleSet() {
    if (maxTupleSet == null) {
        maxTupleSet = new TupleSet();
        List<Event> l1 = task.getProgram().getCache().getEvents(filter1);
        List<Event> l2 = task.getProgram().getCache().getEvents(filter2);
        ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class);
        for (Event e1 : l1) {
            for (Event e2 : l2) {
                if (!exec.areMutuallyExclusive(e1, e2)) {
                    maxTupleSet.add(new Tuple(e1, e2));
                }
            }
        }
    }
    return maxTupleSet;
}
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)

Example 92 with Event

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

the class RelCtrlDirect method getMaxTupleSet.

@Override
public TupleSet getMaxTupleSet() {
    if (maxTupleSet == null) {
        maxTupleSet = new TupleSet();
        // NOTE: If's (under Linux) have different notion of ctrl dependency than conditional jumps!
        for (Thread thread : task.getProgram().getThreads()) {
            for (Event e1 : thread.getCache().getEvents(FilterBasic.get(Tag.CMP))) {
                for (Event e2 : ((IfAsJump) e1).getBranchesEvents()) {
                    maxTupleSet.add(new Tuple(e1, e2));
                }
            }
            // Relates jumps (except those implementing Ifs and their internal jump to end) with all later events
            List<Event> condJumps = thread.getCache().getEvents(FilterMinus.get(FilterBasic.get(Tag.JUMP), FilterUnion.get(FilterBasic.get(Tag.CMP), FilterBasic.get(Tag.IFI))));
            if (!condJumps.isEmpty()) {
                for (Event e2 : thread.getCache().getEvents(FilterBasic.get(Tag.ANY))) {
                    for (Event e1 : condJumps) {
                        if (e1.getCId() < e2.getCId()) {
                            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) IfAsJump(com.dat3m.dartagnan.program.event.core.IfAsJump) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple) Thread(com.dat3m.dartagnan.program.Thread)

Example 93 with Event

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

the class RelRangeIdentity method encodeApprox.

@Override
protected BooleanFormula encodeApprox(SolverContext ctx) {
    BooleanFormulaManager bmgr = ctx.getFormulaManager().getBooleanFormulaManager();
    BooleanFormula enc = bmgr.makeTrue();
    // TODO: Optimize using minSets (but no CAT uses this anyway)
    for (Tuple tuple1 : encodeTupleSet) {
        Event e = tuple1.getFirst();
        BooleanFormula opt = bmgr.makeFalse();
        for (Tuple tuple2 : r1.getMaxTupleSet().getBySecond(e)) {
            opt = bmgr.or(r1.getSMTVar(tuple2.getFirst(), e, ctx));
        }
        enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(e, e, ctx), opt));
    }
    return enc;
}
Also used : BooleanFormulaManager(org.sosy_lab.java_smt.api.BooleanFormulaManager) Event(com.dat3m.dartagnan.program.event.core.Event) BooleanFormula(org.sosy_lab.java_smt.api.BooleanFormula) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple)

Example 94 with Event

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

the class RelTrans method getMaxTupleSet.

@Override
public TupleSet getMaxTupleSet() {
    if (maxTupleSet == null) {
        transitiveReachabilityMap = r1.getMaxTupleSet().transMap();
        maxTupleSet = new TupleSet();
        for (Event e1 : transitiveReachabilityMap.keySet()) {
            for (Event e2 : transitiveReachabilityMap.get(e1)) {
                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)

Example 95 with Event

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

the class RelTrans method encodeApprox.

@Override
protected BooleanFormula encodeApprox(SolverContext ctx) {
    BooleanFormulaManager bmgr = ctx.getFormulaManager().getBooleanFormulaManager();
    BooleanFormula enc = bmgr.makeTrue();
    TupleSet minSet = getMinTupleSet();
    TupleSet r1Max = r1.getMaxTupleSet();
    for (Tuple tuple : fullEncodeTupleSet) {
        if (minSet.contains(tuple)) {
            if (Relation.PostFixApprox) {
                enc = bmgr.and(enc, bmgr.implication(getExecPair(tuple, ctx), this.getSMTVar(tuple, ctx)));
            } else {
                enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(tuple, ctx), getExecPair(tuple, ctx)));
            }
            continue;
        }
        BooleanFormula orClause = bmgr.makeFalse();
        Event e1 = tuple.getFirst();
        Event e2 = tuple.getSecond();
        if (r1Max.contains(tuple)) {
            orClause = bmgr.or(orClause, r1.getSMTVar(tuple, ctx));
        }
        for (Tuple t : r1Max.getByFirst(e1)) {
            Event e3 = t.getSecond();
            if (e3.getCId() != e1.getCId() && e3.getCId() != e2.getCId() && transitiveReachabilityMap.get(e3).contains(e2)) {
                BooleanFormula tVar = minSet.contains(t) ? this.getSMTVar(t, ctx) : r1.getSMTVar(t, ctx);
                orClause = bmgr.or(orClause, bmgr.and(tVar, this.getSMTVar(e3, e2, ctx)));
            }
        }
        if (Relation.PostFixApprox) {
            enc = bmgr.and(enc, bmgr.implication(orClause, this.getSMTVar(tuple, ctx)));
        } else {
            enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(tuple, ctx), orClause));
        }
    }
    return enc;
}
Also used : TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) BooleanFormulaManager(org.sosy_lab.java_smt.api.BooleanFormulaManager) Event(com.dat3m.dartagnan.program.event.core.Event) BooleanFormula(org.sosy_lab.java_smt.api.BooleanFormula) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple)

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