mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
use lazy scopes to avoid push/pop overhead
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
558233dd8e
commit
f0308436b5
6 changed files with 51 additions and 12 deletions
|
@ -35,7 +35,7 @@ reslimit::reslimit():
|
|||
m_cancel(0),
|
||||
m_suspend(false),
|
||||
m_count(0),
|
||||
m_limit(0) {
|
||||
m_limit(std::numeric_limits<uint64_t>::max()) {
|
||||
}
|
||||
|
||||
uint64_t reslimit::count() const {
|
||||
|
@ -55,15 +55,15 @@ bool reslimit::inc(unsigned offset) {
|
|||
void reslimit::push(unsigned delta_limit) {
|
||||
uint64_t new_limit = delta_limit + m_count;
|
||||
if (new_limit <= m_count) {
|
||||
new_limit = 0;
|
||||
new_limit = std::numeric_limits<uint64_t>::max();
|
||||
}
|
||||
m_limits.push_back(m_limit);
|
||||
m_limit = m_limit==0 ? new_limit : std::min(new_limit, m_limit);
|
||||
m_limit = std::min(new_limit, m_limit);
|
||||
m_cancel = 0;
|
||||
}
|
||||
|
||||
void reslimit::pop() {
|
||||
if (m_count > m_limit && m_limit > 0) {
|
||||
if (m_count > m_limit) {
|
||||
m_count = m_limit;
|
||||
}
|
||||
m_limit = m_limits.back();
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
uint64_t count() const;
|
||||
|
||||
bool suspended() const { return m_suspend; }
|
||||
inline bool not_canceled() const { return (m_cancel == 0 && (m_limit == 0 || m_count <= m_limit)) || m_suspend; }
|
||||
inline bool not_canceled() const { return (m_cancel == 0 && m_count <= m_limit) || m_suspend; }
|
||||
inline bool is_canceled() const { return !not_canceled(); }
|
||||
char const* get_cancel_msg() const;
|
||||
void cancel();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue