mirror of
https://github.com/Z3Prover/z3
synced 2025-06-06 06:03:23 +00:00
add cache for length terms to theory_str, but it seems to slow things down so I disabled it
This commit is contained in:
parent
521e0e175b
commit
61d1d5e8b0
2 changed files with 18 additions and 2 deletions
|
@ -696,8 +696,21 @@ app * theory_str::mk_strlen(expr * e) {
|
||||||
int len = strlen(strval);
|
int len = strlen(strval);
|
||||||
return m_autil.mk_numeral(rational(len), true);
|
return m_autil.mk_numeral(rational(len), true);
|
||||||
} else {
|
} else {
|
||||||
expr * args[1] = {e};
|
if (false) {
|
||||||
return get_manager().mk_app(get_id(), OP_STRLEN, 0, 0, 1, args);
|
// use cache
|
||||||
|
app * lenTerm = NULL;
|
||||||
|
if (!length_ast_map.find(e, lenTerm)) {
|
||||||
|
expr * args[1] = {e};
|
||||||
|
lenTerm = get_manager().mk_app(get_id(), OP_STRLEN, 0, 0, 1, args);
|
||||||
|
length_ast_map.insert(e, lenTerm);
|
||||||
|
m_trail.push_back(lenTerm);
|
||||||
|
}
|
||||||
|
return lenTerm;
|
||||||
|
} else {
|
||||||
|
// always regen
|
||||||
|
expr * args[1] = {e};
|
||||||
|
return get_manager().mk_app(get_id(), OP_STRLEN, 0, 0, 1, args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -287,6 +287,9 @@ namespace smt {
|
||||||
// used when opt_FastValueTesterCache is true
|
// used when opt_FastValueTesterCache is true
|
||||||
string_map valueTesterCache;
|
string_map valueTesterCache;
|
||||||
|
|
||||||
|
// cache mapping each string S to Length(S)
|
||||||
|
obj_map<expr, app*> length_ast_map;
|
||||||
|
|
||||||
th_union_find m_find;
|
th_union_find m_find;
|
||||||
th_trail_stack m_trail_stack;
|
th_trail_stack m_trail_stack;
|
||||||
theory_var get_var(expr * n) const;
|
theory_var get_var(expr * n) const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue