3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2021-04-03 17:26:54 -07:00
parent 31baab49c8
commit c2b213c049
3 changed files with 130 additions and 66 deletions

View file

@ -107,11 +107,8 @@ private:
}
void unmark_todo() {
typename ptr_vector<dependency>::iterator it = m_todo.begin();
typename ptr_vector<dependency>::iterator end = m_todo.end();
for (; it != end; ++it) {
(*it)->unmark();
}
for (auto* d : m_todo)
d->unmark();
m_todo.reset();
}
@ -193,30 +190,47 @@ public:
return false;
}
void linearize(dependency * d, vector<value, false> & vs) {
if (d) {
m_todo.reset();
d->mark();
m_todo.push_back(d);
unsigned qhead = 0;
while (qhead < m_todo.size()) {
d = m_todo[qhead];
qhead++;
if (d->is_leaf()) {
vs.push_back(to_leaf(d)->m_value);
}
else {
for (unsigned i = 0; i < 2; i++) {
dependency * child = to_join(d)->m_children[i];
if (!child->is_marked()) {
m_todo.push_back(child);
child->mark();
}
void linearize(vector<value, false>& vs) {
unsigned qhead = 0;
while (qhead < m_todo.size()) {
dependency * d = m_todo[qhead];
qhead++;
if (d->is_leaf()) {
vs.push_back(to_leaf(d)->m_value);
}
else {
for (unsigned i = 0; i < 2; i++) {
dependency * child = to_join(d)->m_children[i];
if (!child->is_marked()) {
m_todo.push_back(child);
child->mark();
}
}
}
unmark_todo();
}
unmark_todo();
}
void linearize(dependency * d, vector<value, false> & vs) {
if (!d)
return;
m_todo.reset();
d->mark();
m_todo.push_back(d);
linearize(vs);
}
void linearize(ptr_vector<dependency>& deps, vector<value, false> & vs) {
if (deps.empty())
return;
m_todo.reset();
for (auto* d : deps) {
if (d && !d->is_marked()) {
d->mark();
m_todo.push_back(d);
}
}
linearize(vs);
}
};
@ -303,6 +317,10 @@ public:
void linearize(dependency * d, vector<value, false> & vs) {
return m_dep_manager.linearize(d, vs);
}
void linearize(ptr_vector<dependency>& d, vector<value, false> & vs) {
return m_dep_manager.linearize(d, vs);
}
void reset() {
m_allocator.reset();