Skip to content

Commit 49d82da

Browse files
committed
fix cache
1 parent d27068c commit 49d82da

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

manticore/core/smtlib/expression.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ def __init__(self, array: Array, index: BitVec, value: BitVec, **kwargs):
11681168
assert index.size == array.index_size
11691169
assert value.size == array.value_size
11701170
self._written: Optional[Set[Any]] = None # Cache of the known indexes
1171-
self._concrete_cache: Dict[Any, Any] = dict()
1171+
self._concrete_cache: Dict[Any, Any] = None
11721172
self._length = array.length
11731173
self._default = array.default
11741174

@@ -1184,11 +1184,13 @@ def __init__(self, array: Array, index: BitVec, value: BitVec, **kwargs):
11841184

11851185
@property
11861186
def concrete_cache(self):
1187-
for index, value in get_items(self):
1188-
if not isinstance(index, Constant):
1189-
break
1190-
if index.value not in self._concrete_cache:
1191-
self._concrete_cache[index.value] = value
1187+
if self._concrete_cache is None:
1188+
self._concrete_cache = {}
1189+
for index, value in get_items(self):
1190+
if not isinstance(index, Constant):
1191+
break
1192+
if index.value not in self._concrete_cache:
1193+
self._concrete_cache[index.value] = value
11921194
return self._concrete_cache
11931195

11941196
@property

0 commit comments

Comments
 (0)