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

Speed up ArmV7Operand.type assertions #1313

Merged
merged 4 commits into from Dec 20, 2018

Conversation

Projects
None yet
2 participants
@disconnect3d
Copy link
Contributor

disconnect3d commented Dec 20, 2018

So accessing operand.type will now just return the value instead of building a mapping and getting a value for given key.

We will also fail fast if there will ever be an unrecognized type for a given operand.


This change is Reviewable

Speed up ArmV7Operand.type assertions
So .type will now just return the value instead of building a mapping
and returning a result.

disconnect3d added some commits Dec 20, 2018

Merge branch 'faster-arm-operand-assertions' of github.com:trailofbit…
…s/manticore into faster-arm-operand-assertions

* 'faster-arm-operand-assertions' of github.com:trailofbits/manticore:
  Update manticore/native/cpu/arm.py
class Armv7Operand(Operand):
def __init__(self, cpu, op, **kwargs):
super().__init__(cpu, op, **kwargs)
self.__type = _TYPE_MAP[self.op.type]

This comment has been minimized.

@mossberg

mossberg Dec 20, 2018

Contributor

jw, why two underscores? maybe just 1 is fine

This comment has been minimized.

@disconnect3d

disconnect3d Dec 20, 2018

Contributor

Mostly to be more bullet proof against future changes of Operand - e.g. if it ever get a _type attribute, having a _type here would overwrite it. Using __type prevents it.

But I guess it doesn't have a _type and we can do it for now.

This comment has been minimized.

@mossberg

mossberg Dec 20, 2018

Contributor

ah i see. either way is fine with me then!

class Armv7Operand(Operand):
def __init__(self, cpu, op, **kwargs):
super().__init__(cpu, op, **kwargs)
self.__type = _TYPE_MAP[self.op.type]

This comment has been minimized.

@mossberg

mossberg Dec 20, 2018

Contributor

ah i see. either way is fine with me then!

@disconnect3d disconnect3d merged commit c0b6ce1 into master Dec 20, 2018

5 checks passed

codeclimate All good!
Details
codeclimate/total-coverage 70% (0.0% change)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

@disconnect3d disconnect3d deleted the faster-arm-operand-assertions branch Dec 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment