[pypy-svn] r61731 - in pypy/branch/pyjitpl5/pypy/jit/metainterp: . test
arigo at codespeak.net
arigo at codespeak.net
Wed Feb 11 14:45:06 CET 2009
Author: arigo
Date: Wed Feb 11 14:45:05 2009
New Revision: 61731
Modified:
pypy/branch/pyjitpl5/pypy/jit/metainterp/policy.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_tl.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py
Log:
(fijal, arigo)
Use the '_pure_function_' hint again.
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/policy.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/policy.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/policy.py Wed Feb 11 14:45:05 2009
@@ -2,7 +2,11 @@
class JitPolicy:
def graphs_from(self, op):
if op.opname == 'direct_call':
- return [op.args[0].value._obj.graph]
+ graph = op.args[0].value._obj.graph
+ # explicitly pure functions are always opaque
+ if getattr(getattr(graph, 'func', None), '_pure_function_', False):
+ return None
+ return [graph]
assert op.opname == 'indirect_call'
return op.args[-1].value
@@ -24,7 +28,7 @@
def graphs_from(self, op):
graphs = JitPolicy.graphs_from(self, op)
- if len(graphs) > 1: # XXX a hack
+ if graphs is None or len(graphs) > 1: # XXX a hack
return graphs
[graph] = graphs
if getattr(graph, 'func', None) in self.funcs:
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_tl.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_tl.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_tl.py Wed Feb 11 14:45:05 2009
@@ -45,7 +45,7 @@
assert res == 100
def test_tl_base(self):
- from pypy.jit.tl.tl import interp
+ from pypy.jit.tl.tl import interp_without_call
from pypy.jit.tl.tlopcode import compile
code = compile('''
@@ -73,11 +73,11 @@
''')
codes = ["", code]
- def main(n):
+ def main(n, inputarg):
code = codes[n]
- return interp(code)
+ return interp_without_call(code, inputarg=inputarg)
- res = self.meta_interp(main, [1])
+ res = self.meta_interp(main, [1, 6])
assert res == 5040
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py Wed Feb 11 14:45:05 2009
@@ -96,6 +96,9 @@
graph = copygraph(graph)
graph.startblock = support.split_before_jit_merge_point(
*find_jit_merge_point([graph]))
+ for v in graph.getargs():
+ assert isinstance(v, Variable)
+ assert len(dict.fromkeys(graph.getargs())) == len(graph.getargs())
self.translator.graphs.append(graph)
self.portal_graph = graph
self.jitdriver = block.operations[pos].args[1].value
More information about the Pypy-commit
mailing list