use of com.dat3m.dartagnan.verification.VerificationTask in project Dat3M by hernanponcedeleon.
the class ReachabilityResult method run.
private void run() {
if (validate()) {
ShutdownManager sdm = ShutdownManager.create();
Thread t = new Thread(() -> {
try {
if (options.getTimeout() > 0) {
// Converts timeout from secs to millisecs
Thread.sleep(1000L * options.getTimeout());
sdm.requestShutdown("Shutdown Request");
}
} catch (InterruptedException e) {
// Verification ended, nothing to be done.
}
});
try {
Result result = Result.UNKNOWN;
Arch arch = program.getArch() != null ? program.getArch() : options.getTarget();
VerificationTask task = VerificationTask.builder().withBound(options.getBound()).withSolverTimeout(options.getTimeout()).withTarget(arch).build(program, wmm, EnumSet.of(Property.getDefault()));
t.start();
Configuration config = Configuration.builder().setOption(PHANTOM_REFERENCES, "true").build();
try (SolverContext ctx = SolverContextFactory.createSolverContext(config, BasicLogManager.create(config), sdm.getNotifier(), options.getSolver());
ProverEnvironment prover = ctx.newProverEnvironment(ProverOptions.GENERATE_MODELS)) {
switch(options.getMethod()) {
case INCREMENTAL:
result = IncrementalSolver.run(ctx, prover, task);
break;
case ASSUME:
result = AssumeSolver.run(ctx, prover, task);
break;
case TWO:
try (ProverEnvironment prover2 = ctx.newProverEnvironment(ProverOptions.GENERATE_MODELS)) {
result = TwoSolvers.run(ctx, prover, prover2, task);
}
break;
case CAAT:
result = RefinementSolver.run(ctx, prover, RefinementTask.fromVerificationTaskWithDefaultBaselineWMM(task));
break;
}
// Verification ended, we can interrupt the timeout Thread
t.interrupt();
buildVerdict(result);
}
} catch (InterruptedException e) {
verdict = "TIMEOUT";
} catch (Exception e) {
verdict = "ERROR: " + e.getMessage();
}
}
}
Aggregations