3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-08 17:01:55 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-10-25 10:29:02 -07:00
parent 34e0e26e3d
commit 1ee2ba2a9b
17 changed files with 132 additions and 80 deletions

View file

@ -25,44 +25,23 @@ Revision History:
#include "util/vector.h"
class region {
ptr_vector<char> m_chuncks;
ptr_vector<char> m_chunks;
unsigned_vector m_scopes;
public:
~region() {
reset();
}
void * allocate(size_t size) {
char * r = alloc_svect(char, size);
m_chuncks.push_back(r);
return r;
}
void reset() {
ptr_vector<char>::iterator it = m_chuncks.begin();
ptr_vector<char>::iterator end = m_chuncks.end();
for (; it != end; ++it) {
dealloc_svect(*it);
}
m_chuncks.reset();
m_scopes.reset();
}
void * allocate(size_t size);
void reset();
void push_scope() {
m_scopes.push_back(m_chuncks.size());
m_scopes.push_back(m_chunks.size());
}
void pop_scope() {
unsigned old_size = m_scopes.back();
m_scopes.pop_back();
ptr_vector<char>::iterator it = m_chuncks.begin() + old_size;
ptr_vector<char>::iterator end = m_chuncks.end();
for (; it != end; ++it) {
dealloc_svect(*it);
}
m_chuncks.shrink(old_size);
}
void pop_scope();
void pop_scope(unsigned num_scopes) {
for (unsigned i = 0; i < num_scopes; i++) {