3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-04 14:25:46 +00:00

reworking cancellation

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2015-12-11 16:21:24 -08:00
parent 981f8226fe
commit baee4225a7
145 changed files with 172 additions and 958 deletions

View file

@ -352,16 +352,15 @@ cmd_context::~cmd_context() {
}
void cmd_context::set_cancel(bool f) {
if (m_solver) {
if (has_manager()) {
m().set_cancel(f);
if (f) {
m_solver->cancel();
m().limit().cancel();
}
else {
m_solver->reset_cancel();
m().limit().reset_cancel();
}
}
if (has_manager())
m().set_cancel(f);
}
opt_wrapper* cmd_context::get_opt() {
@ -1453,7 +1452,7 @@ void cmd_context::check_sat(unsigned num_assumptions, expr * const * assumptions
else if (m_solver) {
m_check_sat_result = m_solver.get(); // solver itself stores the result.
m_solver->set_progress_callback(this);
cancel_eh<solver> eh(*m_solver);
cancel_eh<reslimit> eh(m().limit());
scoped_ctrl_c ctrlc(eh);
scoped_timer timer(timeout, &eh);
scoped_rlimit _rlimit(m().limit(), rlimit);
@ -1612,7 +1611,7 @@ void cmd_context::validate_model() {
model_evaluator evaluator(*(md.get()), p);
contains_array_op_proc contains_array(m());
{
cancel_eh<model_evaluator> eh(evaluator);
cancel_eh<reslimit> eh(m().limit());
expr_ref r(m());
scoped_ctrl_c ctrlc(eh);
ptr_vector<expr>::const_iterator it = begin_assertions();

View file

@ -64,7 +64,7 @@ public:
expr_ref r(ctx.m());
unsigned timeout = m_params.get_uint("timeout", UINT_MAX);
model_evaluator ev(*(md.get()), m_params);
cancel_eh<model_evaluator> eh(ev);
cancel_eh<reslimit> eh(ctx.m().limit());
{
scoped_ctrl_c ctrlc(eh);
scoped_timer timer(timeout, &eh);

View file

@ -33,7 +33,7 @@ Notes:
static void to_poly(cmd_context & ctx, expr * t) {
polynomial::numeral_manager nm;
polynomial::manager pm(nm);
polynomial::manager pm(ctx.m().limit(), nm);
default_expr2polynomial expr2poly(ctx.m(), pm);
polynomial::polynomial_ref p(pm);
polynomial::scoped_numeral d(nm);
@ -52,7 +52,7 @@ static void to_poly(cmd_context & ctx, expr * t) {
static void factor(cmd_context & ctx, expr * t, polynomial::factor_params const & ps) {
polynomial::numeral_manager nm;
polynomial::manager pm(nm);
polynomial::manager pm(ctx.m().limit(), nm);
default_expr2polynomial expr2poly(ctx.m(), pm);
polynomial::polynomial_ref p(pm);
polynomial::scoped_numeral d(nm);
@ -95,7 +95,7 @@ class poly_isolate_roots_cmd : public cmd {
context(ast_manager & m):
m_util(m),
m_pm(m_qm),
m_pm(m.limit(), m_qm),
m_am(m_lim, m_qm),
m_p(m_pm),
m_expr2poly(m, m_pm),

View file

@ -199,7 +199,7 @@ public:
ctx.set_check_sat_result(result.get());
{
tactic & t = *tref;
cancel_eh<tactic> eh(t);
cancel_eh<reslimit> eh(m.limit());
{
scoped_ctrl_c ctrlc(eh);
scoped_timer timer(timeout, &eh);
@ -310,7 +310,7 @@ public:
std::string reason_unknown;
bool failed = false;
cancel_eh<tactic> eh(t);
cancel_eh<reslimit> eh(m.limit());
{
scoped_ctrl_c ctrlc(eh);
scoped_timer timer(timeout, &eh);