Skip to content

Commit

Permalink
Remove uninitialized, discrete_set, discrete_set_max_cardinality from…
Browse files Browse the repository at this point in the history
… BVS args
  • Loading branch information
twizmwazin committed Sep 25, 2024
1 parent ecb16b3 commit e5e1e11
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 28 deletions.
10 changes: 4 additions & 6 deletions claripy/ast/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def __new__( # pylint:disable=redefined-builtin
symbolic: bool | None = None,
variables: frozenset[str] | None = None,
errored: set[Backend] | None = None,
uninitialized: bool | None = None,
uninitialized: bool = False,
annotations: tuple[Annotation, ...] = (),
skip_child_annotations: bool = False,
length: int | None = None,
Expand Down Expand Up @@ -275,7 +275,7 @@ def make_like(
annotations: tuple[Annotation, ...] | None = None,
variables: frozenset[str] | None = None,
symbolic: bool | None = None,
uninitialized: bool | None = None,
uninitialized: bool = False,
skip_child_annotations: bool = False,
length: int | None = None,
) -> Self:
Expand All @@ -288,7 +288,7 @@ def make_like(
and annotations
and variables is None
and symbolic is None
and uninitialized is None
and uninitialized is False
and skip_child_annotations
and length is not None
):
Expand Down Expand Up @@ -357,7 +357,7 @@ def __a_init__(
length: int | None = None,
simplified: SimplificationLevel = SimplificationLevel.UNSIMPLIFIED,
errored: set[Backend] | None = None,
uninitialized: bool | None = None,
uninitialized: bool = False,
annotations: tuple[Annotation, ...] | None = None,
encoded_name: bytes | None = None,
depth: int | None = None,
Expand Down Expand Up @@ -775,8 +775,6 @@ def _op_repr(
if args[3] is not None:
fmt = "%#x" if isinstance(args[3], int) else "%s"
extras.append("stride=%s" % (fmt % args[3]))
if args[4] is True:
extras.append("UNINITIALIZED")
return "{}{}".format(args[0], "{{{}}}".format(", ".join(extras)) if extras else "")

if op == "BoolV":
Expand Down
18 changes: 1 addition & 17 deletions claripy/ast/bv.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,7 @@ def BVS( # pylint:disable=redefined-builtin
min=None,
max=None,
stride=None,
uninitialized=False,
explicit_name=None,
discrete_set=False,
discrete_set_max_card=None,
**kwargs,
) -> BV:
"""
Expand All @@ -219,12 +216,7 @@ def BVS( # pylint:disable=redefined-builtin
:param min: The minimum value of the symbol, used only for value-set analysis
:param max: The maximum value of the symbol, used only for value-set analysis
:param stride: The stride of the symbol, used only for value-set analysis
:param uninitialized: Whether this value should be counted as an "uninitialized" value in the course of an
analysis.
:param bool explicit_name: If False, an identifier is appended to the name to ensure uniqueness.
:param bool discrete_set: If True, a DiscreteStridedIntervalSet will be used instead of a normal StridedInterval.
:param int discrete_set_max_card: The maximum cardinality of the discrete set. It is ignored if discrete_set is set
to False or None.
:returns: a BV object representing this symbol.
"""
Expand All @@ -240,16 +232,12 @@ def BVS( # pylint:disable=redefined-builtin
n = _make_name(name, size, False if explicit_name is None else explicit_name)
encoded_name = n.encode()

if not discrete_set:
discrete_set_max_card = None

return BV(
"BVS",
(n, min, max, stride, uninitialized, discrete_set, discrete_set_max_card),
(n, min, max, stride),
variables=frozenset((n,)),
length=size,
symbolic=True,
uninitialized=uninitialized,
encoded_name=encoded_name,
**kwargs,
)
Expand Down Expand Up @@ -307,8 +295,6 @@ def SI(
stride=None,
to_conv=None,
explicit_name=None,
discrete_set=False,
discrete_set_max_card=None,
):
name = "unnamed" if name is None else name
if to_conv is not None:
Expand All @@ -325,8 +311,6 @@ def SI(
max=upper_bound,
stride=stride,
explicit_name=explicit_name,
discrete_set=discrete_set,
discrete_set_max_card=discrete_set_max_card,
)


Expand Down
7 changes: 2 additions & 5 deletions claripy/backends/backend_vsa/backend_vsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,15 @@ def SGE(a, b):
return a.SGE(b)

@staticmethod
def BVS(ast):
def BVS(ast: Base):
size = ast.size()
name, mn, mx, stride, uninitialized, discrete_set, max_card = ast.args
name, mn, mx, stride = ast.args
return CreateStridedInterval(
name=name,
bits=size,
lower_bound=mn,
upper_bound=mx,
stride=stride,
uninitialized=uninitialized,
discrete_set=discrete_set,
discrete_set_max_cardinality=max_card,
)

def If(self, cond, t, f):
Expand Down

0 comments on commit e5e1e11

Please sign in to comment.