3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-18 03:46:17 +00:00
This commit is contained in:
Nikolaj Bjorner 2018-06-27 11:25:04 -07:00
commit 91ef84b8c9
6 changed files with 49 additions and 71 deletions

View file

@ -66,7 +66,7 @@ public:
TRACE("qe_verbose", TRACE("qe_verbose",
tout << mk_pp(fml, m) << "\n"; tout << mk_pp(fml, m) << "\n";
tout << mk_pp(result, m) << "\n";); tout << mk_pp(result, m) << "\n";);
fml = result; fml = std::move(result);
} }
void extract_quantifier(quantifier* q, app_ref_vector& vars, expr_ref& result, bool use_fresh) { void extract_quantifier(quantifier* q, app_ref_vector& vars, expr_ref& result, bool use_fresh) {

View file

@ -448,7 +448,7 @@ void rewriter_tpl<Config>::process_app(app * t, frame & fr) {
m_r = result_stack().back(); m_r = result_stack().back();
if (!is_ground(m_r)) { if (!is_ground(m_r)) {
m_inv_shifter(m_r, num_args, tmp); m_inv_shifter(m_r, num_args, tmp);
m_r = tmp; m_r = std::move(tmp);
} }
result_stack().shrink(fr.m_spos); result_stack().shrink(fr.m_spos);
result_stack().push_back(m_r); result_stack().push_back(m_r);

View file

@ -776,7 +776,7 @@ void th_rewriter::reset() {
void th_rewriter::operator()(expr_ref & term) { void th_rewriter::operator()(expr_ref & term) {
expr_ref result(term.get_manager()); expr_ref result(term.get_manager());
m_imp->operator()(term, result); m_imp->operator()(term, result);
term = result; term = std::move(result);
} }
void th_rewriter::operator()(expr * t, expr_ref & result) { void th_rewriter::operator()(expr * t, expr_ref & result) {

View file

@ -2297,14 +2297,14 @@ public:
vars.resize(j); vars.resize(j);
} }
else { else {
fml = tmp; fml = std::move(tmp);
} }
} }
void operator()(expr_ref& fml, proof_ref& pr) { void operator()(expr_ref& fml, proof_ref& pr) {
expr_ref tmp(m); expr_ref tmp(m);
m_elim_star(fml, tmp, pr); m_elim_star(fml, tmp, pr);
fml = tmp; fml = std::move(tmp);
} }
void operator()(uint_set const& index_set, bool index_of_bound, expr_ref& fml) { void operator()(uint_set const& index_set, bool index_of_bound, expr_ref& fml) {

View file

@ -21,18 +21,28 @@ Notes:
#include "tactic/ufbv/ufbv_rewriter_tactic.h" #include "tactic/ufbv/ufbv_rewriter_tactic.h"
class ufbv_rewriter_tactic : public tactic { class ufbv_rewriter_tactic : public tactic {
struct imp {
ast_manager & m_manager; ast_manager & m_manager;
params_ref m_params;
imp(ast_manager & m, params_ref const & p) : m_manager(m) { public:
updt_params(p); ufbv_rewriter_tactic(ast_manager & m, params_ref const & p):
m_manager(m), m_params(p) {}
tactic * translate(ast_manager & m) override {
return alloc(ufbv_rewriter_tactic, m, m_params);
} }
ast_manager & m() const { return m_manager; } void updt_params(params_ref const & p) override {
m_params = p;
}
void operator()(goal_ref const & g, void collect_param_descrs(param_descrs & r) override {
goal_ref_buffer & result) { insert_max_memory(r);
insert_produce_models(r);
insert_produce_proofs(r);
}
void operator()(goal_ref const & g, goal_ref_buffer & result) override {
SASSERT(g->is_well_sorted()); SASSERT(g->is_well_sorted());
tactic_report report("ufbv-rewriter", *g); tactic_report report("ufbv-rewriter", *g);
fail_if_unsat_core_generation("ufbv-rewriter", g); fail_if_unsat_core_generation("ufbv-rewriter", g);
@ -65,48 +75,7 @@ class ufbv_rewriter_tactic : public tactic {
SASSERT(g->is_well_sorted()); SASSERT(g->is_well_sorted());
} }
void updt_params(params_ref const & p) { void cleanup() override {}
}
};
imp * m_imp;
params_ref m_params;
public:
ufbv_rewriter_tactic(ast_manager & m, params_ref const & p):
m_params(p) {
m_imp = alloc(imp, m, p);
}
tactic * translate(ast_manager & m) override {
return alloc(ufbv_rewriter_tactic, m, m_params);
}
~ufbv_rewriter_tactic() override {
dealloc(m_imp);
}
void updt_params(params_ref const & p) override {
m_params = p;
m_imp->updt_params(p);
}
void collect_param_descrs(param_descrs & r) override {
insert_max_memory(r);
insert_produce_models(r);
insert_produce_proofs(r);
}
void operator()(goal_ref const & in, goal_ref_buffer & result) override {
(*m_imp)(in, result);
}
void cleanup() override {
ast_manager & m = m_imp->m();
imp * d = alloc(imp, m, m_params);
std::swap(d, m_imp);
dealloc(d);
}
}; };

View file

@ -92,6 +92,15 @@ public:
return *this; return *this;
} }
obj_ref & operator=(obj_ref && n) {
SASSERT(&m_manager == &n.m_manager);
if (this != &n) {
std::swap(m_obj, n.m_obj);
n.reset();
}
return *this;
}
void reset() { void reset() {
dec_ref(); dec_ref();
m_obj = nullptr; m_obj = nullptr;