Search in sources :

Example 1 with BranchEquivalence

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

the class EndAtomic method runLocalAnalysis.

@Override
public void runLocalAnalysis(Program program, Context context) {
    // ===== Temporary fix to rematch atomic blocks correctly =====
    BranchEquivalence eq = context.requires(BranchEquivalence.class);
    List<Event> begins = this.thread.getEvents().stream().filter(x -> x instanceof BeginAtomic && eq.isReachableFrom(x, this)).collect(Collectors.toList());
    this.begin = (BeginAtomic) begins.get(begins.size() - 1);
    // =======================================================
    findEnclosedEvents(eq);
}
Also used : SVCOMPATOMIC(com.dat3m.dartagnan.program.event.Tag.SVCOMP.SVCOMPATOMIC) BranchEquivalence(com.dat3m.dartagnan.program.analysis.BranchEquivalence) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) RMW(com.dat3m.dartagnan.program.event.Tag.RMW) Context(com.dat3m.dartagnan.verification.Context) List(java.util.List) Logger(org.apache.logging.log4j.Logger) EventVisitor(com.dat3m.dartagnan.program.event.visitors.EventVisitor) ImmutableList(com.google.common.collect.ImmutableList) Map(java.util.Map) Program(com.dat3m.dartagnan.program.Program) Event(com.dat3m.dartagnan.program.event.core.Event) Preconditions(com.google.common.base.Preconditions) Comparator(java.util.Comparator) LogManager(org.apache.logging.log4j.LogManager) BranchEquivalence(com.dat3m.dartagnan.program.analysis.BranchEquivalence) Event(com.dat3m.dartagnan.program.event.core.Event)

Example 2 with BranchEquivalence

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

the class EndAtomic method findEnclosedEvents.

private void findEnclosedEvents(BranchEquivalence eq) {
    enclosedEvents = new ArrayList<>();
    BranchEquivalence.Class startClass = eq.getEquivalenceClass(begin);
    BranchEquivalence.Class endClass = eq.getEquivalenceClass(this);
    if (!startClass.getReachableClasses().contains(endClass)) {
        logger.warn("BeginAtomic" + begin.getCId() + "can't reach EndAtomic " + this.getCId());
    }
    for (BranchEquivalence.Class c : startClass.getReachableClasses()) {
        for (Event e : c) {
            if (begin.getCId() <= e.getCId() && e.getCId() <= this.getCId()) {
                if (!eq.isImplied(e, begin)) {
                    logger.warn(e + " is inside atomic block but can be reached from the outside");
                }
                enclosedEvents.add(e);
                e.addFilters(RMW);
            }
        }
    }
    enclosedEvents.sort(Comparator.naturalOrder());
    enclosedEvents = ImmutableList.copyOf(enclosedEvents);
}
Also used : BranchEquivalence(com.dat3m.dartagnan.program.analysis.BranchEquivalence) Event(com.dat3m.dartagnan.program.event.core.Event)

Aggregations

BranchEquivalence (com.dat3m.dartagnan.program.analysis.BranchEquivalence)2 Event (com.dat3m.dartagnan.program.event.core.Event)2 Program (com.dat3m.dartagnan.program.Program)1 RMW (com.dat3m.dartagnan.program.event.Tag.RMW)1 SVCOMPATOMIC (com.dat3m.dartagnan.program.event.Tag.SVCOMP.SVCOMPATOMIC)1 EventVisitor (com.dat3m.dartagnan.program.event.visitors.EventVisitor)1 Context (com.dat3m.dartagnan.verification.Context)1 Preconditions (com.google.common.base.Preconditions)1 ImmutableList (com.google.common.collect.ImmutableList)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1