mirror of
https://github.com/Z3Prover/z3
synced 2025-06-23 06:13:40 +00:00
add missing scoped_push
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
c4da5caf69
commit
3fca59ac84
2 changed files with 13 additions and 3 deletions
|
@ -83,13 +83,14 @@ namespace dd {
|
||||||
bdd_manager::BDD bdd_manager::apply(BDD arg1, BDD arg2, bdd_op op) {
|
bdd_manager::BDD bdd_manager::apply(BDD arg1, BDD arg2, bdd_op op) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
SASSERT(well_formed());
|
SASSERT(well_formed());
|
||||||
|
scoped_push _sp(*this);
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
return apply_rec(arg1, arg2, op);
|
return apply_rec(arg1, arg2, op);
|
||||||
}
|
}
|
||||||
catch (const mem_out &) {
|
catch (const mem_out &) {
|
||||||
try_reorder();
|
|
||||||
if (!first) throw;
|
if (!first) throw;
|
||||||
|
try_reorder();
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -542,13 +543,14 @@ namespace dd {
|
||||||
|
|
||||||
bdd bdd_manager::mk_not(bdd b) {
|
bdd bdd_manager::mk_not(bdd b) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
scoped_push _sp(*this);
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
return bdd(mk_not_rec(b.root), this);
|
return bdd(mk_not_rec(b.root), this);
|
||||||
}
|
}
|
||||||
catch (const mem_out &) {
|
catch (const mem_out &) {
|
||||||
try_reorder();
|
|
||||||
if (!first) throw;
|
if (!first) throw;
|
||||||
|
try_reorder();
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -571,13 +573,14 @@ namespace dd {
|
||||||
|
|
||||||
bdd bdd_manager::mk_ite(bdd const& c, bdd const& t, bdd const& e) {
|
bdd bdd_manager::mk_ite(bdd const& c, bdd const& t, bdd const& e) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
scoped_push _sp(*this);
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
return bdd(mk_ite_rec(c.root, t.root, e.root), this);
|
return bdd(mk_ite_rec(c.root, t.root, e.root), this);
|
||||||
}
|
}
|
||||||
catch (const mem_out &) {
|
catch (const mem_out &) {
|
||||||
try_reorder();
|
|
||||||
if (!first) throw;
|
if (!first) throw;
|
||||||
|
try_reorder();
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,6 +193,13 @@ namespace dd {
|
||||||
void reserve_var(unsigned v);
|
void reserve_var(unsigned v);
|
||||||
bool well_formed();
|
bool well_formed();
|
||||||
|
|
||||||
|
struct scoped_push {
|
||||||
|
bdd_manager& m;
|
||||||
|
unsigned m_size;
|
||||||
|
scoped_push(bdd_manager& m) :m(m), m_size(m.m_bdd_stack.size()) {}
|
||||||
|
~scoped_push() { m.m_bdd_stack.shrink(m_size); }
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct mem_out {};
|
struct mem_out {};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue