diff options
| author | Camille Mougey <camille.mougey@cea.fr> | 2015-10-23 11:28:56 +0200 |
|---|---|---|
| committer | Camille Mougey <camille.mougey@cea.fr> | 2015-10-23 13:29:07 +0200 |
| commit | 7f95cfb59382323da838f249ef824ad6175b0d1a (patch) | |
| tree | f90a41681a64da9d370777027a31f2920f6bc0e7 | |
| parent | a20c8b6c59805240cc802b2558739aa12d1503e2 (diff) | |
| download | miasm-7f95cfb59382323da838f249ef824ad6175b0d1a.tar.gz miasm-7f95cfb59382323da838f249ef824ad6175b0d1a.zip | |
Jitload: has_callbacks is no more needed (no perf gain)
| -rw-r--r-- | miasm2/jitter/jitload.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/miasm2/jitter/jitload.py b/miasm2/jitter/jitload.py index 3c07d41a..7213d73c 100644 --- a/miasm2/jitter/jitload.py +++ b/miasm2/jitter/jitload.py @@ -137,11 +137,7 @@ class CallbackHandlerBitflag(CallbackHandler): "Handle a list of callback with conditions on bitflag" - # Overrides CallbackHandler's implem, but do not serve for optimization - def has_callbacks(self, bitflag): - return any(cb_mask & bitflag != 0 for cb_mask in self.callbacks) - - def __call__(self, bitflag, *args): + def call_callbacks(self, bitflag, *args): """Call each callbacks associated with bit set in bitflag. While callbacks return True, continue with next callback. Iterator on other results""" @@ -309,10 +305,9 @@ class jitter: # Check breakpoints old_pc = self.pc - if self.breakpoints_handler.has_callbacks(self.pc): - for res in self.breakpoints_handler(self.pc, self): - if res is not True: - yield res + for res in self.breakpoints_handler.call_callbacks(self.pc, self): + if res is not True: + yield res # If a callback changed pc, re call every callback if old_pc != self.pc: |