3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-09-03 08:38:06 +00:00

moving to resource managed cancellation

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2015-12-11 13:13:11 -08:00
parent 61dbb6168e
commit 32b6b2da44
41 changed files with 55 additions and 280 deletions

View file

@ -749,16 +749,6 @@ namespace datalog {
m_background.push_back(e);
}
#if 0
void context::cancel() {
m_cancel = true;
m_last_status = CANCELED;
m_transf.cancel();
if (m_engine) m_engine->cancel();
}
#endif
void context::cleanup() {
m_last_status = OK;
if (m_engine) m_engine->cleanup();

View file

@ -209,7 +209,6 @@ namespace datalog {
execution_result m_last_status;
expr_ref m_last_answer;
DL_ENGINE m_engine_type;
volatile bool m_cancel;

View file

@ -483,7 +483,7 @@ namespace datalog {
}
proof_ref get_proof(model_ref& md, func_decl* pred, app* prop, unsigned level) {
if (b.m_cancel) {
if (!m.limit().inc()) {
return proof_ref(0, m);
}
TRACE("bmc", tout << "Predicate: " << pred->get_name() << "\n";);
@ -1172,7 +1172,7 @@ namespace datalog {
private:
void get_model(unsigned level) {
if (b.m_cancel) {
if (!m.limit().inc()) {
return;
}
rule_manager& rm = b.m_ctx.get_rule_manager();
@ -1426,8 +1426,7 @@ namespace datalog {
m_solver(m, m_fparams),
m_rules(ctx),
m_query_pred(m),
m_answer(m),
m_cancel(false) {
m_answer(m) {
}
bmc::~bmc() {}
@ -1510,21 +1509,11 @@ namespace datalog {
}
void bmc::checkpoint() {
if (m_cancel) {
if (!m.limit().inc()) {
throw default_exception("bmc canceled");
}
}
void bmc::cancel() {
m_cancel = true;
m_solver.cancel();
}
void bmc::cleanup() {
m_cancel = false;
m_solver.reset();
}
void bmc::display_certificate(std::ostream& out) const {
out << mk_pp(m_answer, m) << "\n";
}

View file

@ -38,7 +38,6 @@ namespace datalog {
rule_set m_rules;
func_decl_ref m_query_pred;
expr_ref m_answer;
volatile bool m_cancel;
void checkpoint();
@ -59,10 +58,6 @@ namespace datalog {
lbool query(expr* query);
void cancel();
void cleanup();
void display_certificate(std::ostream& out) const;
void collect_statistics(statistics& st) const;

View file

@ -84,17 +84,7 @@ namespace datalog {
m_goals.push_back(to_app(head));
return search(20, 0);
}
void cancel() {
m_cancel = true;
m_solver.cancel();
}
void cleanup() {
m_cancel = false;
m_goals.reset();
m_solver.reset_cancel();
}
void reset_statistics() {
m_stats.reset();
@ -223,12 +213,7 @@ namespace datalog {
lbool clp::query(expr* query) {
return m_imp->query(query);
}
void clp::cancel() {
m_imp->cancel();
}
void clp::cleanup() {
m_imp->cleanup();
}
void clp::reset_statistics() {
m_imp->reset_statistics();
}

View file

@ -34,8 +34,6 @@ namespace datalog {
clp(context& ctx);
~clp();
virtual lbool query(expr* query);
virtual void cancel();
virtual void cleanup();
virtual void reset_statistics();
virtual void collect_statistics(statistics& st) const;
virtual void display_certificate(std::ostream& out) const;

View file

@ -1453,8 +1453,7 @@ namespace pdr {
m_search(m_params.pdr_bfs_model_search()),
m_last_result(l_undef),
m_inductive_lvl(0),
m_expanded_lvl(0),
m_cancel(false)
m_expanded_lvl(0)
{
}
@ -1465,7 +1464,6 @@ namespace pdr {
void context::reset() {
TRACE("pdr", tout << "\n";);
cleanup();
decl2rel::iterator it = m_rels.begin(), end = m_rels.end();
for (; it != end; ++it) {
dealloc(it->m_value);
@ -1912,16 +1910,8 @@ namespace pdr {
return l_undef;
}
void context::cancel() {
m_cancel = true;
}
void context::cleanup() {
m_cancel = false;
}
void context::checkpoint() {
if (m_cancel) {
if (!m.limit().inc()) {
throw default_exception("pdr canceled");
}
}

View file

@ -336,7 +336,6 @@ namespace pdr {
unsigned m_expanded_lvl;
ptr_vector<core_generalizer> m_core_generalizers;
stats m_stats;
volatile bool m_cancel;
model_converter_ref m_mc;
proof_converter_ref m_pc;
@ -411,9 +410,6 @@ namespace pdr {
lbool solve();
void cancel();
void cleanup();
void reset();

View file

@ -206,13 +206,7 @@ expr_ref dl_interface::get_answer() {
return m_context->get_answer();
}
void dl_interface::cancel() {
m_context->cancel();
}
void dl_interface::cleanup() {
m_context->cleanup();
}
void dl_interface::updt_params() {
dealloc(m_context);

View file

@ -51,10 +51,6 @@ namespace pdr {
virtual lbool query(expr* query);
virtual void cancel();
virtual void cleanup();
virtual void display_certificate(std::ostream& out) const;
virtual void collect_statistics(statistics& st) const;

View file

@ -498,9 +498,6 @@ namespace datalog {
return dynamic_cast<karr_relation const&>(r);
}
void karr_relation_plugin::set_cancel(bool f) {
}
relation_base * karr_relation_plugin::mk_empty(const relation_signature & s) {
return alloc(karr_relation, *this, 0, s, true);
}

View file

@ -51,8 +51,6 @@ namespace datalog {
static symbol get_name() { return symbol("karr_relation"); }
virtual void set_cancel(bool f);
virtual relation_base * mk_empty(const relation_signature & s);
virtual relation_base * mk_full(func_decl* p, const relation_signature & s);