Search in sources :

Example 31 with Program

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

the class PrinterTest method PrintLinux3.

@Test()
public void PrintLinux3() throws Exception {
    Program p = new ProgramParser().parse(new File(ResourceHelper.LITMUS_RESOURCE_PATH + "litmus/C/manual/atomic/C-atomic-01.litmus"));
    assertNotNull(new Printer().print(p));
    assertNotNull(p.getAss().toString());
}
Also used : Program(com.dat3m.dartagnan.program.Program) ProgramParser(com.dat3m.dartagnan.parsers.program.ProgramParser) Printer(com.dat3m.dartagnan.utils.printer.Printer) File(java.io.File) Test(org.junit.Test)

Example 32 with Program

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

the class PrinterTest method PrintLinux.

@Test()
public void PrintLinux() throws Exception {
    Program p = new ProgramParser().parse(new File(ResourceHelper.TEST_RESOURCE_PATH + "litmus/C-rcu-link-after.litmus"));
    assertNotNull(new Printer().print(p));
    assertNotNull(p.getAss().toString());
}
Also used : Program(com.dat3m.dartagnan.program.Program) ProgramParser(com.dat3m.dartagnan.parsers.program.ProgramParser) Printer(com.dat3m.dartagnan.utils.printer.Printer) File(java.io.File) Test(org.junit.Test)

Example 33 with Program

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

the class PrinterTest method PrintBpl1.

// Test to call toString() of most events
@Test()
public void PrintBpl1() throws Exception {
    Program p = new ProgramParser().parse(new File(ResourceHelper.TEST_RESOURCE_PATH + "boogie/concurrency/fib_bench-1-O0.bpl"));
    assertNotNull(new Printer().print(p));
    LoopUnrolling.newInstance().run(p);
    Compilation.newInstance().run(p);
    assertNotNull(new Printer().print(p));
}
Also used : Program(com.dat3m.dartagnan.program.Program) ProgramParser(com.dat3m.dartagnan.parsers.program.ProgramParser) Printer(com.dat3m.dartagnan.utils.printer.Printer) File(java.io.File) Test(org.junit.Test)

Example 34 with Program

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

the class PrinterTest method PrintAARCH64.

@Test()
public void PrintAARCH64() throws Exception {
    Program p = new ProgramParser().parse(new File(ResourceHelper.TEST_RESOURCE_PATH + "litmus/MP+popl+poap.litmus"));
    assertNotNull(new Printer().print(p));
    assertNotNull(p.getAss().toString());
}
Also used : Program(com.dat3m.dartagnan.program.Program) ProgramParser(com.dat3m.dartagnan.parsers.program.ProgramParser) Printer(com.dat3m.dartagnan.utils.printer.Printer) File(java.io.File) Test(org.junit.Test)

Example 35 with Program

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

the class SymmetryReduction method run.

public void run(Program program) {
    ThreadSymmetry symm = ThreadSymmetry.withoutMappings(program);
    Set<? extends EquivalenceClass<Thread>> symmClasses = symm.getNonTrivialClasses();
    if (symmClasses.isEmpty()) {
        return;
    }
    for (EquivalenceClass<Thread> c : symmClasses) {
        Thread rep = c.getRepresentative();
        if (rep.getEvents().stream().noneMatch(x -> x.is(Tag.ASSERTION))) {
            continue;
        }
        rep.setName(rep.getName() + "__symm_unique");
        for (Thread t : c.stream().filter(x -> x != rep).collect(Collectors.toList())) {
            for (Event e : t.getEvents()) {
                if (e.is(Tag.ASSERTION)) {
                    e.getSuccessor().delete();
                    e.delete();
                }
            }
            t.clearCache();
        }
    }
    logger.info("Reduced symmetry of {} many symmetry classes", symmClasses.size());
}
Also used : Tag(com.dat3m.dartagnan.program.event.Tag) EquivalenceClass(com.dat3m.dartagnan.utils.equivalence.EquivalenceClass) ThreadSymmetry(com.dat3m.dartagnan.program.analysis.ThreadSymmetry) Logger(org.apache.logging.log4j.Logger) Configuration(org.sosy_lab.common.configuration.Configuration) Program(com.dat3m.dartagnan.program.Program) Event(com.dat3m.dartagnan.program.event.core.Event) Set(java.util.Set) Thread(com.dat3m.dartagnan.program.Thread) LogManager(org.apache.logging.log4j.LogManager) Collectors(java.util.stream.Collectors) InvalidConfigurationException(org.sosy_lab.common.configuration.InvalidConfigurationException) Event(com.dat3m.dartagnan.program.event.core.Event) ThreadSymmetry(com.dat3m.dartagnan.program.analysis.ThreadSymmetry) Thread(com.dat3m.dartagnan.program.Thread)

Aggregations

Program (com.dat3m.dartagnan.program.Program)41 Test (org.junit.Test)22 File (java.io.File)21 ProgramParser (com.dat3m.dartagnan.parsers.program.ProgramParser)20 ProgramBuilder (com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder)10 Printer (com.dat3m.dartagnan.utils.printer.Printer)8 VerificationTask (com.dat3m.dartagnan.verification.VerificationTask)6 Configuration (org.sosy_lab.common.configuration.Configuration)6 ParserErrorListener (com.dat3m.dartagnan.exception.ParserErrorListener)5 Compilation (com.dat3m.dartagnan.program.processing.compilation.Compilation)5 Collectors (java.util.stream.Collectors)5 SolverContext (org.sosy_lab.java_smt.api.SolverContext)5 ParserCat (com.dat3m.dartagnan.parsers.cat.ParserCat)4 Tag (com.dat3m.dartagnan.program.event.Tag)4 Event (com.dat3m.dartagnan.program.event.core.Event)4 Result (com.dat3m.dartagnan.utils.Result)4 Wmm (com.dat3m.dartagnan.wmm.Wmm)4 InvalidConfigurationException (org.sosy_lab.common.configuration.InvalidConfigurationException)4 ProverEnvironment (org.sosy_lab.java_smt.api.ProverEnvironment)4 FilterBasic (com.dat3m.dartagnan.program.filter.FilterBasic)3