[pypy-svn] r67474 - in pypy/trunk/pypy: jit/metainterp module/pypyjit
antocuni at codespeak.net
antocuni at codespeak.net
Fri Sep 4 15:41:43 CEST 2009
Author: antocuni
Date: Fri Sep 4 15:41:42 2009
New Revision: 67474
Modified:
pypy/trunk/pypy/jit/metainterp/policy.py
pypy/trunk/pypy/module/pypyjit/policy.py
Log:
kill ManualJitPolicy, as it's no longer used
Modified: pypy/trunk/pypy/jit/metainterp/policy.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/policy.py (original)
+++ pypy/trunk/pypy/jit/metainterp/policy.py Fri Sep 4 15:41:42 2009
@@ -99,96 +99,3 @@
if func in self.funcs:
return False
return super(StopAtXPolicy, self).look_inside_function(func)
-
-# ____________________________________________________________
-
-from pypy.annotation.specialize import getuniquenondirectgraph
-
-class ManualJitPolicy(JitPolicy):
- def __init__(self, translator):
- self.translator = translator
- self.bookkeeper = translator.annotator.bookkeeper
- self.enabled_graphs = {}
- self.memo = {}
- self.fill_seen_graphs()
-
- def look_inside_graph(self, graph):
- if graph in self.enabled_graphs:
- return self.enabled_graphs[graph]
- res = super(ManualJitPolicy, self).look_inside_graph(graph)
- self.enabled_graphs[graph] = res # cache the result
- return res
-
- def fill_seen_graphs(self):
- # subclasses should have their own
- pass
-
- def _graph(self, func):
- func = getattr(func, 'im_func', func)
- desc = self.bookkeeper.getdesc(func)
- return getuniquenondirectgraph(desc)
-
- def seefunc(self, fromfunc, *tofuncs):
- targetgraphs = {}
- for tofunc in tofuncs:
- targetgraphs[self._graph(tofunc)] = True
- graphs = graphs_on_the_path_to(self.translator, self._graph(fromfunc),
- targetgraphs, self.memo)
- for graph in graphs:
- if graph not in self.enabled_graphs:
- self.enabled_graphs[graph] = True
- print '++', graph
-
- def seepath(self, *path):
- assert len(path) >= 2
- for i in range(1, len(path)):
- self.seefunc(path[i-1], path[i])
-
- def seegraph(self, func, look=True):
- graph = self._graph(func)
- self.enabled_graphs[graph] = look
- if look:
- print '++', graph
- else:
- print '--', graph
-
-def enumerate_reachable_graphs(translator, startgraph, memo=None):
- from pypy.translator.backendopt.support import find_calls_from
- pending = [(startgraph, None)]
- yield pending[0]
- seen = {startgraph: True}
- while pending:
- yield None # hack: a separator meaning "length increases now"
- nextlengthlist = []
- nextseen = {}
- for node in pending:
- head, tail = node
- for block, callee in find_calls_from(translator, head, memo):
- if callee not in seen:
- newnode = callee, node
- yield newnode
- nextlengthlist.append(newnode)
- nextseen[callee] = True
- pending = nextlengthlist
- seen.update(nextseen)
- yield None
-
-def graphs_on_the_path_to(translator, startgraph, targetgraphs, memo=None):
- targetgraphs = targetgraphs.copy()
- result = {}
- found = {}
- for node in enumerate_reachable_graphs(translator, startgraph, memo):
- if node is None: # hack: a separator meaning "length increases now"
- for graph in found:
- del targetgraphs[graph]
- found.clear()
- if not targetgraphs:
- return result
- elif node[0] in targetgraphs:
- found[node[0]] = True
- while node is not None:
- head, tail = node
- result[head] = True
- node = tail
- raise Exception("did not reach all targets:\nmissing %r" % (
- targetgraphs.keys(),))
Modified: pypy/trunk/pypy/module/pypyjit/policy.py
==============================================================================
--- pypy/trunk/pypy/module/pypyjit/policy.py (original)
+++ pypy/trunk/pypy/module/pypyjit/policy.py Fri Sep 4 15:41:42 2009
@@ -1,6 +1,6 @@
-from pypy.jit.metainterp.policy import ManualJitPolicy
+from pypy.jit.metainterp.policy import JitPolicy
-class PyPyJitPolicy(ManualJitPolicy):
+class PyPyJitPolicy(JitPolicy):
def look_inside_function(self, func):
mod = func.__module__ or '?'
More information about the Pypy-commit
mailing list