Search in sources :

Example 11 with Thread

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

the class RelExt method getMaxTupleSet.

@Override
public TupleSet getMaxTupleSet() {
    if (maxTupleSet == null) {
        maxTupleSet = new TupleSet();
        List<Thread> threads = task.getProgram().getThreads();
        for (int i = 0; i < threads.size(); i++) {
            Thread t1 = threads.get(i);
            for (int j = i + 1; j < threads.size(); j++) {
                Thread t2 = threads.get(j);
                for (Event e1 : t1.getCache().getEvents(FilterBasic.get(Tag.VISIBLE))) {
                    for (Event e2 : t2.getCache().getEvents(FilterBasic.get(Tag.VISIBLE))) {
                        maxTupleSet.add(new Tuple(e1, e2));
                        maxTupleSet.add(new Tuple(e2, e1));
                    }
                }
            }
        }
    }
    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 12 with Thread

use of com.dat3m.dartagnan.program.Thread 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 13 with Thread

use of com.dat3m.dartagnan.program.Thread 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 14 with Thread

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

the class ExceptionsTest method RegisterAlreadyExist.

@Test(expected = MalformedProgramException.class)
public void RegisterAlreadyExist() throws Exception {
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
    pb.initThread(0);
    Thread t = pb.build().getThreads().get(0);
    t.newRegister("r1", -1);
    // Adding same register a second time
    t.newRegister("r1", -1);
}
Also used : ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) Thread(com.dat3m.dartagnan.program.Thread) Test(org.junit.Test)

Example 15 with Thread

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

the class LoopUnrolling method run.

@Override
public void run(Program program) {
    if (program.isUnrolled()) {
        logger.warn("Skipped unrolling: Program is already unrolled.");
        return;
    }
    int nextId = 0;
    for (Thread thread : program.getThreads()) {
        nextId = unrollThreadAndUpdate(thread, bound, nextId);
    }
    program.clearCache(false);
    program.markAsUnrolled(bound);
    logger.info("Program unrolled {} times", bound);
    if (print) {
        System.out.println("===== Program after unrolling =====");
        System.out.println(new Printer().print(program));
        System.out.println("===================================");
    }
}
Also used : Printer(com.dat3m.dartagnan.utils.printer.Printer) Thread(com.dat3m.dartagnan.program.Thread)

Aggregations

Thread (com.dat3m.dartagnan.program.Thread)48 Event (com.dat3m.dartagnan.program.event.core.Event)27 Tuple (com.dat3m.dartagnan.wmm.utils.Tuple)13 TupleSet (com.dat3m.dartagnan.wmm.utils.TupleSet)11 LogManager (org.apache.logging.log4j.LogManager)10 Logger (org.apache.logging.log4j.Logger)10 BooleanFormula (org.sosy_lab.java_smt.api.BooleanFormula)9 BooleanFormulaManager (org.sosy_lab.java_smt.api.BooleanFormulaManager)9 Program (com.dat3m.dartagnan.program.Program)8 Tag (com.dat3m.dartagnan.program.event.Tag)8 Configuration (org.sosy_lab.common.configuration.Configuration)8 InvalidConfigurationException (org.sosy_lab.common.configuration.InvalidConfigurationException)8 MemEvent (com.dat3m.dartagnan.program.event.core.MemEvent)7 Collectors (java.util.stream.Collectors)7 Context (com.dat3m.dartagnan.verification.Context)6 Preconditions (com.google.common.base.Preconditions)6 FilterBasic (com.dat3m.dartagnan.program.filter.FilterBasic)5 Options (org.sosy_lab.common.configuration.Options)5 Utils.generalEqual (com.dat3m.dartagnan.expression.utils.Utils.generalEqual)4 RegWriter (com.dat3m.dartagnan.program.event.core.utils.RegWriter)4