Search in sources :

Example 31 with Label

use of com.dat3m.dartagnan.program.event.core.Label in project Dat3M by hernanponcedeleon.

the class VisitorBase method visitUnlock.

@Override
public List<Event> visitUnlock(Unlock e) {
    Register resultRegister = e.getResultRegister();
    IExpr address = e.getAddress();
    String mo = e.getMo();
    List<Event> events = eventSequence(newLoad(resultRegister, address, mo), newJump(new Atom(resultRegister, NEQ, IValue.ONE), (Label) e.getThread().getExit()), newStore(address, IValue.ZERO, mo));
    for (Event child : events) {
        child.addFilters(C11.LOCK, RMW);
    }
    return events;
}
Also used : Register(com.dat3m.dartagnan.program.Register) Label(com.dat3m.dartagnan.program.event.core.Label) Event(com.dat3m.dartagnan.program.event.core.Event) IExpr(com.dat3m.dartagnan.expression.IExpr) Atom(com.dat3m.dartagnan.expression.Atom)

Example 32 with Label

use of com.dat3m.dartagnan.program.event.core.Label in project Dat3M by hernanponcedeleon.

the class UnrollExceptionsTest method RMWStoreCon.

@Test(expected = ProgramProcessingException.class)
public void RMWStoreCon() throws Exception {
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
    pb.initThread(0);
    MemoryObject object = pb.getOrNewObject("X");
    Label start = pb.getOrCreateLabel("loopStart");
    pb.addChild(0, start);
    RMWReadCond load = Linux.newRMWReadCondCmp(pb.getOrCreateRegister(0, "r1", 32), BConst.TRUE, object, null);
    pb.addChild(0, Linux.newRMWStoreCond(load, object, IValue.ONE, null));
    pb.addChild(0, EventFactory.newGoto(start));
    LoopUnrolling processor = LoopUnrolling.newInstance();
    processor.setUnrollingBound(2);
    processor.run(pb.build());
}
Also used : RMWReadCond(com.dat3m.dartagnan.program.event.lang.linux.cond.RMWReadCond) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) MemoryObject(com.dat3m.dartagnan.program.memory.MemoryObject) Label(com.dat3m.dartagnan.program.event.core.Label) LoopUnrolling(com.dat3m.dartagnan.program.processing.LoopUnrolling) Test(org.junit.Test)

Example 33 with Label

use of com.dat3m.dartagnan.program.event.core.Label in project Dat3M by hernanponcedeleon.

the class UnrollExceptionsTest method ExecutionStatus.

@Test(expected = ProgramProcessingException.class)
public void ExecutionStatus() throws Exception {
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
    pb.initThread(0);
    Label start = pb.getOrCreateLabel("loopStart");
    pb.addChild(0, start);
    MemoryObject object = pb.getOrNewObject("X");
    RMWStoreExclusive store = newRMWStoreExclusive(object, IValue.ONE, null);
    pb.addChild(0, EventFactory.newExecutionStatus(pb.getOrCreateRegister(0, "r1", 32), store));
    pb.addChild(0, EventFactory.newGoto(start));
    LoopUnrolling processor = LoopUnrolling.newInstance();
    processor.setUnrollingBound(2);
    processor.run(pb.build());
}
Also used : ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) Label(com.dat3m.dartagnan.program.event.core.Label) MemoryObject(com.dat3m.dartagnan.program.memory.MemoryObject) RMWStoreExclusive(com.dat3m.dartagnan.program.event.core.rmw.RMWStoreExclusive) EventFactory.newRMWStoreExclusive(com.dat3m.dartagnan.program.event.EventFactory.newRMWStoreExclusive) LoopUnrolling(com.dat3m.dartagnan.program.processing.LoopUnrolling) Test(org.junit.Test)

Aggregations

Label (com.dat3m.dartagnan.program.event.core.Label)33 Event (com.dat3m.dartagnan.program.event.core.Event)15 Register (com.dat3m.dartagnan.program.Register)11 CondJump (com.dat3m.dartagnan.program.event.core.CondJump)9 Atom (com.dat3m.dartagnan.expression.Atom)7 MemoryObject (com.dat3m.dartagnan.program.memory.MemoryObject)7 ProgramBuilder (com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder)6 Test (org.junit.Test)6 LoopUnrolling (com.dat3m.dartagnan.program.processing.LoopUnrolling)5 ParsingException (com.dat3m.dartagnan.exception.ParsingException)4 Program (com.dat3m.dartagnan.program.Program)4 Thread (com.dat3m.dartagnan.program.Thread)4 Preconditions (com.google.common.base.Preconditions)4 HashMap (java.util.HashMap)4 LogManager (org.apache.logging.log4j.LogManager)4 Logger (org.apache.logging.log4j.Logger)4 Tag (com.dat3m.dartagnan.program.event.Tag)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Map (java.util.Map)3