3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-25 21:57:00 +00:00

extract logging into separate function

This commit is contained in:
nilsbecker 2019-07-11 17:22:03 +02:00
parent 1d859a98e5
commit 335072eda2

View file

@ -570,23 +570,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg {
}
}
void log_enodes_for_new_terms(expr *term) {
map<expr *, unsigned, ptr_hash<expr>, ptr_eq<expr>> reference_map;
count_down_subterm_references(term, reference_map);
// Any term that was newly introduced by the rewrite step is only referenced within / reachable from the result term.
for (auto kv : reference_map) {
if (kv.m_value == 0) {
m().trace_stream() << "[attach-enode] #" << kv.m_key->get_id() << " 0\n";
}
}
}
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
result_pr = nullptr;
br_status st = reduce_app_core(f, num, args, result);
if (st != BR_FAILED && m().has_trace_stream()) {
void log_rewrite_axiom_instantiation(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
family_id fid = f->get_family_id();
if (fid == m_b_rw.get_fid()) {
decl_kind k = f->get_decl_kind();
@ -610,7 +594,16 @@ struct th_rewriter_cfg : public default_rewriter_cfg {
// Make sure that both the result term and equality were newly introduced.
if (tmp->get_ref_count() == 1) {
if (result->get_ref_count() == 1) {
log_enodes_for_new_terms(result);
map<expr *, unsigned, ptr_hash<expr>, ptr_eq<expr>> reference_map;
count_down_subterm_references(result, reference_map);
// Any term that was newly introduced by the rewrite step is only referenced within / reachable from the result term.
for (auto kv : reference_map) {
if (kv.m_value == 0) {
m().trace_stream() << "[attach-enode] #" << kv.m_key->get_id() << " 0\n";
}
}
m().trace_stream() << "[attach-enode] #" << result->get_id() << " 0\n";
}
m().trace_stream() << "[attach-enode] #" << tmp->get_id() << " 0\n";
@ -619,6 +612,14 @@ struct th_rewriter_cfg : public default_rewriter_cfg {
m().trace_stream().flush();
}
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
result_pr = nullptr;
br_status st = reduce_app_core(f, num, args, result);
if (st != BR_FAILED && m().has_trace_stream()) {
log_rewrite_axiom_instantiation(f, num, args, result, result_pr);
}
if (st != BR_DONE && st != BR_FAILED) {
CTRACE("th_rewriter_step", st != BR_FAILED,
tout << f->get_name() << "\n";