mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
adding threads to smt core
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
d4a24aff1e
commit
5f2720562b
11 changed files with 68 additions and 22 deletions
|
@ -151,7 +151,6 @@ bool mpn_manager::div(mpn_digit const * numer, size_t const lnum,
|
|||
mpn_digit const * denom, size_t const lden,
|
||||
mpn_digit * quot,
|
||||
mpn_digit * rem) {
|
||||
MPN_BEGIN_CRITICAL();
|
||||
trace(numer, lnum, denom, lden, "/");
|
||||
bool res = false;
|
||||
|
||||
|
@ -160,7 +159,6 @@ bool mpn_manager::div(mpn_digit const * numer, size_t const lnum,
|
|||
quot[i] = 0;
|
||||
for (size_t i = 0; i < lden; i++)
|
||||
rem[i] = (i < lnum) ? numer[i] : 0;
|
||||
MPN_END_CRITICAL();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -170,7 +168,6 @@ bool mpn_manager::div(mpn_digit const * numer, size_t const lnum,
|
|||
|
||||
if (all_zero) {
|
||||
UNREACHABLE();
|
||||
MPN_END_CRITICAL();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -186,6 +183,7 @@ bool mpn_manager::div(mpn_digit const * numer, size_t const lnum,
|
|||
rem[i] = (i < lnum) ? numer[i] : 0;
|
||||
}
|
||||
else {
|
||||
mpn_sbuffer u, v, t_ms, t_ab;
|
||||
size_t d = div_normalize(numer, lnum, denom, lden, u, v);
|
||||
if (lden == 1)
|
||||
res = div_1(u, v[0], quot);
|
||||
|
@ -214,7 +212,6 @@ bool mpn_manager::div(mpn_digit const * numer, size_t const lnum,
|
|||
SASSERT(ok);
|
||||
#endif
|
||||
|
||||
MPN_END_CRITICAL();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ private:
|
|||
#endif
|
||||
|
||||
static const mpn_digit zero;
|
||||
mpn_sbuffer u, v, t_ms, t_ab;
|
||||
// mpn_sbuffer u, v, t_ms, t_ab;
|
||||
void display_raw(std::ostream & out, mpn_digit const * a, size_t lng) const;
|
||||
|
||||
size_t div_normalize(mpn_digit const * numer, size_t lnum,
|
||||
|
|
|
@ -187,9 +187,16 @@ mpz_manager<SYNCH>::~mpz_manager() {
|
|||
template<bool SYNCH>
|
||||
mpz_cell * mpz_manager<SYNCH>::allocate(unsigned capacity) {
|
||||
SASSERT(capacity >= m_init_cell_capacity);
|
||||
MPZ_BEGIN_CRITICAL();
|
||||
mpz_cell * cell = reinterpret_cast<mpz_cell *>(m_allocator.allocate(cell_size(capacity)));
|
||||
MPZ_END_CRITICAL();
|
||||
#ifdef SINGLE_THREAD
|
||||
mpz_cell * cell = reinterpret_cast<mpz_cell*>(m_allocator.allocate(cell_size(capacity)));
|
||||
#else
|
||||
#if SYNC
|
||||
mpz_cell * cell = reinterpret_cast<mpz_cell*>(m_allocator.allocate(cell_size(capacity)));
|
||||
#else
|
||||
mpz_cell * cell = reinterpret_cast<mpz_cell*>(memory::allocate(cell_size(capacity)));
|
||||
|
||||
#endif
|
||||
#endif
|
||||
cell->m_capacity = capacity;
|
||||
return cell;
|
||||
}
|
||||
|
@ -197,9 +204,15 @@ mpz_cell * mpz_manager<SYNCH>::allocate(unsigned capacity) {
|
|||
template<bool SYNCH>
|
||||
void mpz_manager<SYNCH>::deallocate(bool is_heap, mpz_cell * ptr) {
|
||||
if (is_heap) {
|
||||
MPZ_BEGIN_CRITICAL();
|
||||
#ifdef SINGLE_THREAD
|
||||
m_allocator.deallocate(cell_size(ptr->m_capacity), ptr);
|
||||
MPZ_END_CRITICAL();
|
||||
#else
|
||||
#if SYNC
|
||||
m_allocator.deallocate(cell_size(ptr->m_capacity), ptr);
|
||||
#else
|
||||
memory::deallocate(ptr);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -196,9 +196,15 @@ class mpz_manager {
|
|||
mutable mpz_t m_int64_min;
|
||||
|
||||
mpz_t * allocate() {
|
||||
MPZ_BEGIN_CRITICAL();
|
||||
mpz_t * cell = reinterpret_cast<mpz_t*>(m_allocator.allocate(sizeof(mpz_t)));
|
||||
MPZ_END_CRITICAL();
|
||||
#ifdef SINGLE_THREAD
|
||||
mpz_t * cell = reinterpret_cast<mpz_t*>(m_allocator.allocate(sizeof(mpz_t)));
|
||||
#else
|
||||
#if SYNC
|
||||
mpz_t * cell = reinterpret_cast<mpz_t*>(memory::allocate(sizeof(mpz_t)));
|
||||
#else
|
||||
mpz_t * cell = reinterpret_cast<mpz_t*>(m_allocator.allocate(sizeof(mpz_t)));
|
||||
#endif
|
||||
#endif
|
||||
mpz_init(*cell);
|
||||
return cell;
|
||||
}
|
||||
|
@ -206,9 +212,15 @@ class mpz_manager {
|
|||
void deallocate(bool is_heap, mpz_t * ptr) {
|
||||
mpz_clear(*ptr);
|
||||
if (is_heap) {
|
||||
MPZ_BEGIN_CRITICAL();
|
||||
#ifdef SINGLE_THREAD
|
||||
m_allocator.deallocate(sizeof(mpz_t), ptr);
|
||||
MPZ_END_CRITICAL();
|
||||
#else
|
||||
#if SYNC
|
||||
memory::deallocate(ptr);
|
||||
#else
|
||||
m_allocator.deallocate(sizeof(mpz_t), ptr);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue