Search in sources :

Example 6 with Location

use of dartagnan.program.Location in project Dat3M by hernanponcedeleon.

the class Encodings method encodeReachedState.

public static BoolExpr encodeReachedState(Program p, Model model, Context ctx) {
    Set<Location> locs = p.getEvents().stream().filter(e -> e instanceof MemEvent).map(e -> e.getLoc()).collect(Collectors.toSet());
    BoolExpr reachedState = ctx.mkTrue();
    for (Location loc : locs) {
        reachedState = ctx.mkAnd(reachedState, ctx.mkEq(lastValueLoc(loc, ctx), model.getConstInterp(lastValueLoc(loc, ctx))));
    }
    Set<Event> executedEvents = p.getEvents().stream().filter(e -> model.getConstInterp(e.executes(ctx)).isTrue()).collect(Collectors.toSet());
    Set<Register> regs = executedEvents.stream().filter(e -> e instanceof Local | e instanceof Load).map(e -> e.getReg()).collect(Collectors.toSet());
    for (Register reg : regs) {
        reachedState = ctx.mkAnd(reachedState, ctx.mkEq(lastValueReg(reg, ctx), model.getConstInterp(lastValueReg(reg, ctx))));
    }
    return reachedState;
}
Also used : HighLocation(dartagnan.program.HighLocation) Utils.lastValueReg(dartagnan.utils.Utils.lastValueReg) Utils.uniqueValue(dartagnan.utils.Utils.uniqueValue) com.microsoft.z3(com.microsoft.z3) Event(dartagnan.program.Event) Set(java.util.Set) If(dartagnan.program.If) Collectors(java.util.stream.Collectors) Utils.initValue(dartagnan.utils.Utils.initValue) Init(dartagnan.program.Init) Register(dartagnan.program.Register) Utils.initValue2(dartagnan.utils.Utils.initValue2) Local(dartagnan.program.Local) Load(dartagnan.program.Load) MemEvent(dartagnan.program.MemEvent) Utils.ssaReg(dartagnan.utils.Utils.ssaReg) Program(dartagnan.program.Program) Utils.edge(dartagnan.utils.Utils.edge) Utils.lastValueLoc(dartagnan.utils.Utils.lastValueLoc) Store(dartagnan.program.Store) MapSSA(dartagnan.utils.MapSSA) Location(dartagnan.program.Location) Load(dartagnan.program.Load) Register(dartagnan.program.Register) MemEvent(dartagnan.program.MemEvent) Event(dartagnan.program.Event) MemEvent(dartagnan.program.MemEvent) Local(dartagnan.program.Local) HighLocation(dartagnan.program.HighLocation) Location(dartagnan.program.Location)

Example 7 with Location

use of dartagnan.program.Location in project Dat3M by hernanponcedeleon.

the class MapSSA method clone.

public MapSSA clone() {
    MapSSA map = new MapSSA();
    map.locMap = new ConcurrentHashMap<Location, Integer>();
    map.regMap = new ConcurrentHashMap<Register, Integer>();
    for (Register reg : regMap.keySet()) {
        map.put(reg, this.get(reg));
    }
    for (Location loc : locMap.keySet()) {
        map.put(loc, this.get(loc));
    }
    return map;
}
Also used : Register(dartagnan.program.Register) Location(dartagnan.program.Location)

Aggregations

Location (dartagnan.program.Location)7 Register (dartagnan.program.Register)7 Event (dartagnan.program.Event)6 Load (dartagnan.program.Load)6 Local (dartagnan.program.Local)6 MemEvent (dartagnan.program.MemEvent)6 com.microsoft.z3 (com.microsoft.z3)5 Init (dartagnan.program.Init)5 Program (dartagnan.program.Program)5 Store (dartagnan.program.Store)5 Set (java.util.Set)5 Collectors (java.util.stream.Collectors)5 HighLocation (dartagnan.program.HighLocation)3 Utils.edge (dartagnan.utils.Utils.edge)3 Utils.lastValueLoc (dartagnan.utils.Utils.lastValueLoc)3 Utils.lastValueReg (dartagnan.utils.Utils.lastValueReg)3 Utils.ssaReg (dartagnan.utils.Utils.ssaReg)3 HashSet (java.util.HashSet)3 Assert (dartagnan.expression.Assert)2 If (dartagnan.program.If)2