mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 20:18:18 +00:00
move allocator to memory_manager and std_vector to vector
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
c5cfd62e0a
commit
85db8163fa
|
@ -9,20 +9,9 @@
|
||||||
#include "math/lp/lp_settings.h"
|
#include "math/lp/lp_settings.h"
|
||||||
#include "util/uint_set.h"
|
#include "util/uint_set.h"
|
||||||
#include "math/lp/implied_bound.h"
|
#include "math/lp/implied_bound.h"
|
||||||
#include <vector>
|
#include "util/vector.h"
|
||||||
namespace lp {
|
namespace lp {
|
||||||
template <typename T>
|
|
||||||
struct my_allocator {
|
|
||||||
using value_type = T;
|
|
||||||
|
|
||||||
T* allocate(std::size_t n) {
|
|
||||||
return static_cast<T*>(memory::allocate(n * sizeof(T)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void deallocate(T* p, std::size_t n) {
|
|
||||||
memory::deallocate(p);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class lp_bound_propagator {
|
class lp_bound_propagator {
|
||||||
uint_set m_visited_rows;
|
uint_set m_visited_rows;
|
||||||
|
@ -31,7 +20,7 @@ class lp_bound_propagator {
|
||||||
u_map<unsigned> m_improved_upper_bounds;
|
u_map<unsigned> m_improved_upper_bounds;
|
||||||
|
|
||||||
T& m_imp;
|
T& m_imp;
|
||||||
std::vector<implied_bound, my_allocator<implied_bound>> m_ibounds;
|
std_vector<implied_bound> m_ibounds;
|
||||||
|
|
||||||
map<mpq, unsigned, obj_hash<mpq>, default_eq<mpq>> m_val2fixed_row;
|
map<mpq, unsigned, obj_hash<mpq>, default_eq<mpq>> m_val2fixed_row;
|
||||||
// works for rows of the form x + y + sum of fixed = 0
|
// works for rows of the form x + y + sum of fixed = 0
|
||||||
|
@ -122,7 +111,7 @@ private:
|
||||||
public:
|
public:
|
||||||
lp_bound_propagator(T& imp) : m_imp(imp) {}
|
lp_bound_propagator(T& imp) : m_imp(imp) {}
|
||||||
|
|
||||||
const std::vector<implied_bound, my_allocator<implied_bound>>& ibounds() const { return m_ibounds; }
|
const std_vector<implied_bound>& ibounds() const { return m_ibounds; }
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
m_improved_upper_bounds.reset();
|
m_improved_upper_bounds.reset();
|
||||||
|
|
|
@ -16,7 +16,7 @@ private:
|
||||||
void monotonicity_lemma(monic const& m);
|
void monotonicity_lemma(monic const& m);
|
||||||
void monotonicity_lemma_gt(const monic& m);
|
void monotonicity_lemma_gt(const monic& m);
|
||||||
void monotonicity_lemma_lt(const monic& m);
|
void monotonicity_lemma_lt(const monic& m);
|
||||||
std::vector<rational> get_sorted_key(const monic& rm) const;
|
// std_vector<rational> get_sorted_key(const monic& rm) const;
|
||||||
vector<std::pair<rational, lpvar>> get_sorted_key_with_rvars(const monic& a) const;
|
vector<std::pair<rational, lpvar>> get_sorted_key_with_rvars(const monic& a) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,6 +128,19 @@ void dealloc_svect(T * ptr) {
|
||||||
memory::deallocate(ptr);
|
memory::deallocate(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct std_allocator {
|
||||||
|
using value_type = T;
|
||||||
|
|
||||||
|
T* allocate(std::size_t n) {
|
||||||
|
return static_cast<T*>(memory::allocate(n * sizeof(T)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void deallocate(T* p, std::size_t n) {
|
||||||
|
memory::deallocate(p);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct mem_stat {
|
struct mem_stat {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ Revision History:
|
||||||
#include "util/memory_manager.h"
|
#include "util/memory_manager.h"
|
||||||
#include "util/hash.h"
|
#include "util/hash.h"
|
||||||
#include "util/z3_exception.h"
|
#include "util/z3_exception.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
// disable warning for constant 'if' expressions.
|
// disable warning for constant 'if' expressions.
|
||||||
// these are used heavily in templates.
|
// these are used heavily in templates.
|
||||||
|
@ -40,6 +41,8 @@ Revision History:
|
||||||
#pragma warning(disable:4127)
|
#pragma warning(disable:4127)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class std_vector : public std::vector<T, std_allocator<T>> {};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue