-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,9 @@ parameter::~parameter() { | |
if (m_kind == PARAM_RATIONAL) { | ||
dealloc(m_rational); | ||
} | ||
if (m_kind == PARAM_ZSTRING) { | ||
dealloc(m_zstring); | ||
} | ||
} | ||
|
||
parameter::parameter(parameter const& other) { | ||
|
@@ -64,6 +67,7 @@ parameter& parameter::operator=(parameter const& other) { | |
case PARAM_RATIONAL: m_rational = alloc(rational, other.get_rational()); break; | ||
case PARAM_DOUBLE: m_dval = other.m_dval; break; | ||
case PARAM_EXTERNAL: m_ext_id = other.m_ext_id; break; | ||
case PARAM_ZSTRING: m_zstring = alloc(zstring, other.get_zstring()); break; | ||
default: | ||
UNREACHABLE(); | ||
break; | ||
|
@@ -99,6 +103,7 @@ bool parameter::operator==(parameter const & p) const { | |
case PARAM_RATIONAL: return get_rational() == p.get_rational(); | ||
case PARAM_DOUBLE: return m_dval == p.m_dval; | ||
case PARAM_EXTERNAL: return m_ext_id == p.m_ext_id; | ||
case PARAM_ZSTRING: return get_zstring() == p.get_zstring(); | ||
default: UNREACHABLE(); return false; | ||
} | ||
} | ||
|
@@ -111,6 +116,7 @@ unsigned parameter::hash() const { | |
case PARAM_SYMBOL: b = get_symbol().hash(); break; | ||
case PARAM_RATIONAL: b = get_rational().hash(); break; | ||
case PARAM_DOUBLE: b = static_cast<unsigned>(m_dval); break; | ||
case PARAM_ZSTRING: b = get_zstring().hash(); break; | ||
case PARAM_EXTERNAL: b = m_ext_id; break; | ||
} | ||
return (b << 2) | m_kind; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
nunoplopes
Collaborator
|
||
|
@@ -124,6 +130,7 @@ std::ostream& parameter::display(std::ostream& out) const { | |
case PARAM_AST: return out << "#" << get_ast()->get_id(); | ||
case PARAM_DOUBLE: return out << m_dval; | ||
case PARAM_EXTERNAL: return out << "@" << m_ext_id; | ||
case PARAM_ZSTRING: return out << get_zstring(); | ||
default: | ||
UNREACHABLE(); | ||
return out << "[invalid parameter]"; | ||
|
3 comments
on commit 20a67e4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing a significant regression after this patch. The number of OOMs more than doubles.
The deal is.. I don't use the string theory. So why the heck is this happening? I thought it could be because of the implicit constructors, as they could be silently changing some parameters from symbols to zstrings, but I change zstring to have explicit constructors and still OOMs.. Rings any bell @NikolajBjorner?
git bisect says:
20a67e47caefc3caf1d4fef9612c5caf6a4fe611 is the first bad commit
commit 20a67e47caefc3caf1d4fef9612c5caf6a4fe611
Author: Nikolaj Bjorner <nbjorner@microsoft.com>
Date: Sat May 22 13:12:49 2021 -0700
remove symbol -> zstring -> symbol round-trips
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
src/ast/ast.cpp | 7 +++++++
src/ast/ast.h | 11 ++++++++++-
src/ast/rewriter/seq_axioms.cpp | 2 +-
src/ast/rewriter/seq_rewriter.cpp | 8 ++++----
src/ast/seq_decl_plugin.cpp | 16 ++++------------
src/ast/seq_decl_plugin.h | 13 +++----------
src/model/seq_factory.h | 14 ++++++++------
src/parsers/smt2/smt2parser.cpp | 2 +-
src/smt/theory_str.cpp | 3 +--
src/smt/theory_str.h | 11 ++++++-----
src/smt/theory_str_mc.cpp | 20 ++++++++------------
src/util/zstring.cpp | 14 +++++++++-----
src/util/zstring.h | 9 ++++++---
13 files changed, 68 insertions(+), 62 deletions(-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, wait, it changed the hash for parameters, as ZSTRING was placed in the middle. Let me confirm that theory by moving it to end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, wait, it changed the hash for parameters, as ZSTRING was placed in the middle. Let me confirm that theory by moving it to end.
That's it! The difference in the hash of parameters is the cause.
Should we just change the order of elements so we preserve the old hash function and call it a day?
@nunoplopes could you see if b << 3 makes a difference?
m_kind uses now more than 2 bits to represent.
I don't see why adding ZSTRING should influence your code-path at all.