3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 03:15:50 +00:00

update topological sort to use arrays instead of hash tables, expose Context over Z3Object for programmability

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2022-06-08 06:28:24 -07:00
parent 0e6c64510a
commit 51ed13f96a
17 changed files with 103 additions and 96 deletions

View file

@ -30,7 +30,7 @@ namespace euf {
m_nodes.push_back(n);
m_exprs.push_back(f);
if (is_app(f) && num_args > 0) {
unsigned id = to_app(f)->get_decl()->get_decl_id();
unsigned id = to_app(f)->get_decl()->get_small_id();
m_decl2enodes.reserve(id+1);
m_decl2enodes[id].push_back(n);
}
@ -60,7 +60,7 @@ namespace euf {
enode_vector const& egraph::enodes_of(func_decl* f) {
unsigned id = f->get_decl_id();
unsigned id = f->get_small_id();
if (id < m_decl2enodes.size())
return m_decl2enodes[id];
return m_empty_enodes;
@ -341,7 +341,7 @@ namespace euf {
m_expr2enode[e->get_id()] = nullptr;
n->~enode();
if (is_app(e) && n->num_args() > 0)
m_decl2enodes[to_app(e)->get_decl()->get_decl_id()].pop_back();
m_decl2enodes[to_app(e)->get_decl()->get_small_id()].pop_back();
m_nodes.pop_back();
m_exprs.pop_back();
};

View file

@ -162,7 +162,7 @@ namespace euf {
bool merge_tf() const { return merge_enabled() && (class_size() > 1 || num_parents() > 0 || num_args() > 0); }
enode* get_arg(unsigned i) const { SASSERT(i < num_args()); return m_args[i]; }
unsigned hash() const { return m_expr->hash(); }
unsigned hash() const { return m_expr->get_id(); }
unsigned get_table_id() const { return m_table_id; }
void set_table_id(unsigned t) { m_table_id = t; }
@ -204,6 +204,8 @@ namespace euf {
app* get_app() const { return to_app(m_expr); }
func_decl* get_decl() const { return is_app(m_expr) ? to_app(m_expr)->get_decl() : nullptr; }
unsigned get_expr_id() const { return m_expr->get_id(); }
unsigned get_id() const { return m_expr->get_id(); }
unsigned get_small_id() const { return m_expr->get_small_id(); }
unsigned get_root_id() const { return m_root->m_expr->get_id(); }
bool children_are_roots() const;
enode* get_next() const { return m_next; }