3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-01 12:55:52 +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

@ -78,7 +78,7 @@ namespace {
public:
unsigned char operator()(func_decl * lbl) {
unsigned lbl_id = lbl->get_decl_id();
unsigned lbl_id = lbl->get_small_id();
if (lbl_id >= m_lbl2hash.size())
m_lbl2hash.resize(lbl_id + 1, -1);
if (m_lbl2hash[lbl_id] == -1) {
@ -2906,7 +2906,7 @@ namespace {
SASSERT(first_idx < mp->get_num_args());
app * p = to_app(mp->get_arg(first_idx));
func_decl * lbl = p->get_decl();
unsigned lbl_id = lbl->get_decl_id();
unsigned lbl_id = lbl->get_small_id();
m_trees.reserve(lbl_id+1, nullptr);
if (m_trees[lbl_id] == nullptr) {
m_trees[lbl_id] = m_compiler.mk_tree(qa, mp, first_idx, false);
@ -2935,7 +2935,7 @@ namespace {
}
code_tree * get_code_tree_for(func_decl * lbl) const {
unsigned lbl_id = lbl->get_decl_id();
unsigned lbl_id = lbl->get_small_id();
if (lbl_id < m_trees.size())
return m_trees[lbl_id];
else
@ -3165,11 +3165,11 @@ namespace {
}
bool is_plbl(func_decl * lbl) const {
unsigned lbl_id = lbl->get_decl_id();
unsigned lbl_id = lbl->get_small_id();
return lbl_id < m_is_plbl.size() && m_is_plbl[lbl_id];
}
bool is_clbl(func_decl * lbl) const {
unsigned lbl_id = lbl->get_decl_id();
unsigned lbl_id = lbl->get_small_id();
return lbl_id < m_is_clbl.size() && m_is_clbl[lbl_id];
}
@ -3182,7 +3182,7 @@ namespace {
}
void update_clbls(func_decl * lbl) {
unsigned lbl_id = lbl->get_decl_id();
unsigned lbl_id = lbl->get_small_id();
m_is_clbl.reserve(lbl_id+1, false);
TRACE("trigger_bug", tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";);
TRACE("mam_bug", tout << "update_clbls: " << lbl->get_name() << " is already clbl: " << m_is_clbl[lbl_id] << "\n";);
@ -3222,7 +3222,7 @@ namespace {
}
void update_plbls(func_decl * lbl) {
unsigned lbl_id = lbl->get_decl_id();
unsigned lbl_id = lbl->get_small_id();
m_is_plbl.reserve(lbl_id+1, false);
TRACE("trigger_bug", tout << "update_plbls: " << lbl->get_name() << " is already plbl: " << m_is_plbl[lbl_id] << ", lbl_id: " << lbl_id << "\n";
tout << "mam: " << this << "\n";);
@ -3744,7 +3744,7 @@ namespace {
app * p = to_app(mp->get_arg(0));
func_decl * lbl = p->get_decl();
if (m_context.get_num_enodes_of(lbl) > 0) {
unsigned lbl_id = lbl->get_decl_id();
unsigned lbl_id = lbl->get_small_id();
m_tmp_trees.reserve(lbl_id+1, 0);
if (m_tmp_trees[lbl_id] == 0) {
m_tmp_trees[lbl_id] = m_compiler.mk_tree(qa, mp, 0, false);
@ -3757,7 +3757,7 @@ namespace {
}
for (func_decl * lbl : m_tmp_trees_to_delete) {
unsigned lbl_id = lbl->get_decl_id();
unsigned lbl_id = lbl->get_small_id();
code_tree * tmp_tree = m_tmp_trees[lbl_id];
SASSERT(tmp_tree != 0);
SASSERT(m_context.get_num_enodes_of(lbl) > 0);
@ -3963,7 +3963,7 @@ namespace {
unsigned h = m_lbl_hasher(lbl);
TRACE("trigger_bug", tout << "lbl: " << lbl->get_name() << " is_clbl(lbl): " << is_clbl(lbl)
<< ", is_plbl(lbl): " << is_plbl(lbl) << ", h: " << h << "\n";
tout << "lbl_id: " << lbl->get_decl_id() << "\n";);
tout << "lbl_id: " << lbl->get_small_id() << "\n";);
if (is_clbl(lbl))
update_lbls(n, h);
if (is_plbl(lbl))