mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 19:35:50 +00:00
Fix PDD factor cache in case GC happens while factoring (#5170)
* Add method to find largest power of two that is a divisor * Binary resolve on PDDs * Add unit tests for binary resolve * Fix factor cache access in case GC happens while factoring * Coding conventions * Change to gc_generation
This commit is contained in:
parent
75c87a2869
commit
0e9fc4762a
3 changed files with 192 additions and 9 deletions
|
@ -200,6 +200,7 @@ namespace dd {
|
|||
rational m_freeze_value;
|
||||
rational m_mod2N;
|
||||
unsigned m_power_of_2 { 0 };
|
||||
unsigned m_gc_generation { 0 }; ///< will be incremented on each GC
|
||||
|
||||
void reset_op_cache();
|
||||
void init_nodes(unsigned_vector const& l2v);
|
||||
|
@ -261,6 +262,9 @@ namespace dd {
|
|||
unsigned degree(pdd const& p) const;
|
||||
unsigned degree(PDD p) const;
|
||||
unsigned degree(PDD p, unsigned v);
|
||||
unsigned max_pow2_divisor(PDD p);
|
||||
unsigned max_pow2_divisor(pdd const& p);
|
||||
template <class Fn> pdd map_coefficients(pdd const& p, Fn f);
|
||||
|
||||
void factor(pdd const& p, unsigned v, unsigned degree, pdd& lc, pdd& rest);
|
||||
|
||||
|
@ -320,6 +324,7 @@ namespace dd {
|
|||
pdd reduce(pdd const& a, pdd const& b);
|
||||
pdd subst_val(pdd const& a, vector<std::pair<unsigned, rational>> const& s);
|
||||
pdd subst_val(pdd const& a, unsigned v, rational const& val);
|
||||
bool resolve(unsigned v, pdd const& p, pdd const& q, pdd& r);
|
||||
|
||||
bool is_linear(PDD p) { return degree(p) == 1; }
|
||||
bool is_linear(pdd const& p);
|
||||
|
@ -411,6 +416,7 @@ namespace dd {
|
|||
double tree_size() const { return m.tree_size(*this); }
|
||||
unsigned degree() const { return m.degree(*this); }
|
||||
unsigned degree(unsigned v) const { return m.degree(root, v); }
|
||||
unsigned max_pow2_divisor() const { return m.max_pow2_divisor(root); }
|
||||
unsigned_vector const& free_vars() const { return m.free_vars(*this); }
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue