mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 19:05:51 +00:00
reworking cancellation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
981f8226fe
commit
baee4225a7
145 changed files with 172 additions and 958 deletions
|
@ -35,12 +35,10 @@ class ctx_solver_simplify_tactic : public tactic {
|
|||
func_decl_ref m_fn;
|
||||
obj_map<sort, func_decl*> m_fns;
|
||||
unsigned m_num_steps;
|
||||
volatile bool m_cancel;
|
||||
public:
|
||||
ctx_solver_simplify_tactic(ast_manager & m, params_ref const & p = params_ref()):
|
||||
m(m), m_params(p), m_solver(m, m_front_p),
|
||||
m_arith(m), m_mk_app(m), m_fn(m), m_num_steps(0),
|
||||
m_cancel(false) {
|
||||
m_arith(m), m_mk_app(m), m_fn(m), m_num_steps(0) {
|
||||
sort* i_sort = m_arith.mk_int();
|
||||
m_fn = m.mk_func_decl(symbol(0xbeef101), i_sort, m.mk_bool_sort());
|
||||
}
|
||||
|
@ -86,15 +84,10 @@ public:
|
|||
virtual void cleanup() {
|
||||
reset_statistics();
|
||||
m_solver.reset();
|
||||
m_cancel = false;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual void set_cancel(bool f) {
|
||||
m_solver.set_cancel(f);
|
||||
m_cancel = false;
|
||||
}
|
||||
|
||||
void reduce(goal& g) {
|
||||
SASSERT(g.is_well_sorted());
|
||||
|
@ -177,7 +170,7 @@ protected:
|
|||
names.push_back(n);
|
||||
m_solver.push();
|
||||
|
||||
while (!todo.empty() && !m_cancel) {
|
||||
while (!todo.empty() && !m.canceled()) {
|
||||
expr_ref res(m);
|
||||
args.reset();
|
||||
expr* e = todo.back().m_expr;
|
||||
|
@ -249,7 +242,7 @@ protected:
|
|||
names.pop_back();
|
||||
m_solver.pop(1);
|
||||
}
|
||||
if (!m_cancel) {
|
||||
if (!m.canceled()) {
|
||||
VERIFY(cache.find(fml, path_r));
|
||||
result = path_r.m_expr;
|
||||
}
|
||||
|
|
|
@ -132,10 +132,6 @@ public:
|
|||
smt_params_helper::collect_param_descrs(r);
|
||||
}
|
||||
|
||||
virtual void set_cancel(bool f) {
|
||||
if (m_ctx)
|
||||
m_ctx->set_cancel(f);
|
||||
}
|
||||
|
||||
virtual void collect_statistics(statistics & st) const {
|
||||
if (m_ctx)
|
||||
|
|
|
@ -22,7 +22,6 @@ struct unit_subsumption_tactic : public tactic {
|
|||
ast_manager& m;
|
||||
params_ref m_params;
|
||||
smt_params m_fparams;
|
||||
volatile bool m_cancel;
|
||||
smt::context m_context;
|
||||
expr_ref_vector m_clauses;
|
||||
unsigned m_clause_count;
|
||||
|
@ -34,19 +33,11 @@ struct unit_subsumption_tactic : public tactic {
|
|||
params_ref const& p):
|
||||
m(m),
|
||||
m_params(p),
|
||||
m_cancel(false),
|
||||
m_context(m, m_fparams, p),
|
||||
m_clauses(m) {
|
||||
}
|
||||
|
||||
void set_cancel(bool f) {
|
||||
m_cancel = f;
|
||||
m_context.set_cancel_flag(f);
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
set_cancel(false);
|
||||
}
|
||||
void cleanup() {}
|
||||
|
||||
virtual void operator()(/* in */ goal_ref const & in,
|
||||
/* out */ goal_ref_buffer & result,
|
||||
|
@ -66,7 +57,7 @@ struct unit_subsumption_tactic : public tactic {
|
|||
}
|
||||
|
||||
void checkpoint() {
|
||||
if (m_cancel) {
|
||||
if (m.canceled()) {
|
||||
throw tactic_exception(TACTIC_CANCELED_MSG);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue