Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slottify expressions #1729

Draft
wants to merge 147 commits into
base: master
Choose a base branch
from
Draft

Slottify expressions #1729

wants to merge 147 commits into from

Conversation

feliam
Copy link
Contributor

@feliam feliam commented Jun 15, 2020

  • Added a metaclass magic to compile the __slots__ from parent classes automatically-ish. (xslots)
  • Refactored Expression constructor arguments to be all kwargs based as suggested by the "Super Considered Super" thing.
  • Added tests to check 100% of the Expressions are slotted. It uses __subclasses__ to ensure all are accounted for.
  • ArrayProxy renamed to MutableArray
  • Array's index_max index_bits value_bits -> length, index_size, value_size
  • Added an ArrayConstant to hold tainted concrete "bytes" and other concrete arrays.
  • Added a way to read the full model from a solved core so 2 consecutives solver.get_value wont solve the CS twice
  • BitVec to Bitvec
    .... (tbc)

ekilmer and others added 12 commits January 12, 2021 10:44
Fixes some issues in the examples directory that can be found by running
mypy as follows:
    mypy --check-untyped-defs examples/**/*.py
* Black formatting

* Native tests pass

* Passes checked in (non-generated) wasm tests

* Some ethereum test fixes

* Reenable wasm tests

* Fix mypy error

* Use pytest timeout

* mypy checked untyped defs in manticore.core.smtlib
Comment on lines +263 to +265
raise ExpressionError(
"You tried to use a Bool Expression as a boolean constant. Expressions could represent a set of concrete values."
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement is causing issues. I've replaced it with just

Suggested change
raise ExpressionError(
"You tried to use a Bool Expression as a boolean constant. Expressions could represent a set of concrete values."
)
return self

and it seems to be passing for me natively on both Python 3.6 and 3.9 🤷

Maybe we should revert this to how it was.

CHANGELOG.md Outdated Show resolved Hide resolved
Comment on lines +1170 to +1175
__xslots__: Tuple[str, ...] = (
"_written#v",
"_concrete_cache#v",
"_length#v",
"_default#v",
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the #v suffix mean here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use __slots__ throughout the expression system
3 participants