about summary refs log tree commit diff stats
path: root/miasm2/analysis/depgraph.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2015-03-06 12:33:25 +0100
committerAjax <commial@gmail.com>2015-03-06 12:33:25 +0100
commite9b9364aaeacd501e6ca1e6d8c773af5fbe0d196 (patch)
tree2a837a2e1806c49048e3f49d9f342233f0e590ed /miasm2/analysis/depgraph.py
parent379788f5e9eff86d3ec70fb8ca7dc88f1ebfe9a3 (diff)
downloadmiasm-e9b9364aaeacd501e6ca1e6d8c773af5fbe0d196.tar.gz
miasm-e9b9364aaeacd501e6ca1e6d8c773af5fbe0d196.zip
Depgraph: Modify the inter block `done` data structure to improve membership check
Diffstat (limited to 'miasm2/analysis/depgraph.py')
-rw-r--r--miasm2/analysis/depgraph.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/miasm2/analysis/depgraph.py b/miasm2/analysis/depgraph.py
index 724d412c..5c46a081 100644
--- a/miasm2/analysis/depgraph.py
+++ b/miasm2/analysis/depgraph.py
@@ -495,7 +495,7 @@ class DependencyGraph(object):
         current_depdict.pending.update(depnodes)
 
         # Init the work list
-        done = []
+        done = {}
         todo = [current_depdict]
 
         while todo:
@@ -505,9 +505,10 @@ class DependencyGraph(object):
             self._updateDependencyDict(depdict)
 
             # Avoid infinite loops
-            if depdict in done:
+            label = depdict.label
+            if depdict in done.get(label, []):
                 continue
-            done.append(depdict)
+            done.setdefault(label, []).append(depdict)
 
             # No more dependencies
             if len(depdict.pending) == 0: