3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-13 11:10:19 +00:00

build fixes, add lazy push/pop state to avoid overhead on unused theories

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-08-17 00:13:46 -07:00
parent ca3ec22b7a
commit 558233dd8e
8 changed files with 61 additions and 2 deletions

View file

@ -39,6 +39,30 @@ namespace smt {
m_var2enode_lim.shrink(new_lvl);
}
bool theory::lazy_push() {
if (m_is_lazy) {
++m_lazy_scopes;
}
return m_is_lazy;
}
bool theory::lazy_pop(unsigned num_scopes) {
if (m_is_lazy) {
SASSERT(m_lazy_scopes >= num_scopes);
m_lazy_scopes -= num_scopes;
}
return m_is_lazy;
}
void theory::force_push() {
if (m_is_lazy) {
m_is_lazy = false;
for (unsigned i = m_lazy_scopes; i-- > 0; ) {
push_scope_eh();
}
}
}
void theory::display_var2enode(std::ostream & out) const {
unsigned sz = m_var2enode.size();
for (unsigned v = 0; v < sz; v++) {
@ -138,7 +162,9 @@ namespace smt {
theory::theory(context& ctx, family_id fid):
m_id(fid),
ctx(ctx),
m(ctx.get_manager()) {
m(ctx.get_manager()),
m_is_lazy(true),
m_lazy_scopes(0) {
}
theory::~theory() {