Skip to content

Commit

Permalink
inherit and reset rlimit counter on children limits
Browse files Browse the repository at this point in the history
addresses rlimit leak reported by @mtzguido
  • Loading branch information
NikolajBjorner committed Apr 5, 2023
1 parent f8242c5 commit 84b9204
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/ast/ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2322,6 +2322,14 @@ func_decl * ast_manager::mk_fresh_func_decl(symbol const & prefix, symbol const
return d;
}

bool ast_manager::is_parametric_function(func_decl* f, func_decl *& g) const {
// is-as-array
// is-map
// is-transitive-closure
return false;
}


sort * ast_manager::mk_fresh_sort(char const * prefix) {
string_buffer<32> buffer;
buffer << prefix << "!" << m_fresh_id;
Expand Down
2 changes: 2 additions & 0 deletions src/ast/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,8 @@ class ast_manager {
return mk_fresh_func_decl(symbol(prefix), symbol::null, arity, domain, range, skolem);
}

bool is_parametric_function(func_decl* f, func_decl *& g) const;

app * mk_fresh_const(char const * prefix, sort * s, bool skolem = true) {
return mk_const(mk_fresh_func_decl(prefix, 0, nullptr, s, skolem));
}
Expand Down
4 changes: 2 additions & 2 deletions src/ast/rewriter/seq_eq_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ namespace seq {
expr_ref digit = m_ax.sk().mk_digit2int(u);
add_consequence(m_ax.mk_ge(digit, 1));
}
expr_ref y(seq.str.mk_concat(es, es[0]->get_sort()), m);
ctx.add_solution(seq.str.mk_itos(n), y);
expr_ref y(seq.str.mk_concat(es, es[0]->get_sort()), m);
ctx.add_solution(seq.str.mk_itos(n), y);
return true;
}

Expand Down
6 changes: 6 additions & 0 deletions src/ast/special_relations_decl_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ class special_relations_util {
bool is_to(expr const * e) const { return is_app_of(e, fid(), OP_SPECIAL_RELATION_TO); }
bool is_tc(expr const * e) const { return is_app_of(e, fid(), OP_SPECIAL_RELATION_TC); }

bool is_lo(func_decl const * e) const { return is_decl_of(e, fid(), OP_SPECIAL_RELATION_LO); }
bool is_po(func_decl const * e) const { return is_decl_of(e, fid(), OP_SPECIAL_RELATION_PO); }
bool is_plo(func_decl const * e) const { return is_decl_of(e, fid(), OP_SPECIAL_RELATION_PLO); }
bool is_to(func_decl const * e) const { return is_decl_of(e, fid(), OP_SPECIAL_RELATION_TO); }
bool is_tc(func_decl const * e) const { return is_decl_of(e, fid(), OP_SPECIAL_RELATION_TC); }

app * mk_lo (expr * arg1, expr * arg2) { return m.mk_app( fid(), OP_SPECIAL_RELATION_LO, arg1, arg2); }
app * mk_po (expr * arg1, expr * arg2) { return m.mk_app( fid(), OP_SPECIAL_RELATION_PO, arg1, arg2); }
app * mk_plo(expr * arg1, expr * arg2) { return m.mk_app( fid(), OP_SPECIAL_RELATION_PLO, arg1, arg2); }
Expand Down
2 changes: 2 additions & 0 deletions src/util/rlimit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ void reslimit::push_child(reslimit* r) {

void reslimit::pop_child() {
lock_guard lock(*g_rlimit_mux);
m_count += m_children.back()->m_count;
m_children.back()->m_count = 0;
m_children.pop_back();
}

Expand Down

0 comments on commit 84b9204

Please sign in to comment.