Search in sources :

Example 1 with ThreadSymmetry

use of com.dat3m.dartagnan.program.analysis.ThreadSymmetry 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)1 Thread (com.dat3m.dartagnan.program.Thread)1 ThreadSymmetry (com.dat3m.dartagnan.program.analysis.ThreadSymmetry)1 Tag (com.dat3m.dartagnan.program.event.Tag)1 Event (com.dat3m.dartagnan.program.event.core.Event)1 EquivalenceClass (com.dat3m.dartagnan.utils.equivalence.EquivalenceClass)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 Configuration (org.sosy_lab.common.configuration.Configuration)1 InvalidConfigurationException (org.sosy_lab.common.configuration.InvalidConfigurationException)1