[pypy-svn] r37604 - in pypy/dist/pypy/jit/timeshifter: . test
arigo at codespeak.net
arigo at codespeak.net
Tue Jan 30 16:15:29 CET 2007
Author: arigo
Date: Tue Jan 30 16:15:28 2007
New Revision: 37604
Modified:
pypy/dist/pypy/jit/timeshifter/hrtyper.py
pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
pypy/dist/pypy/jit/timeshifter/test/test_virtualizable.py
Log:
Move StopAtXPolicy. Add an assert.
Modified: pypy/dist/pypy/jit/timeshifter/hrtyper.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/hrtyper.py (original)
+++ pypy/dist/pypy/jit/timeshifter/hrtyper.py Tue Jan 30 16:15:28 2007
@@ -1314,6 +1314,7 @@
def translate_op_green_call(self, hop):
for r_arg in hop.args_r:
assert isinstance(r_arg, GreenRepr)
+ assert isinstance(hop.r_result, GreenRepr)
v = hop.genop('direct_call', hop.args_v, hop.r_result.lowleveltype)
return v
Modified: pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py (original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py Tue Jan 30 16:15:28 2007
@@ -334,6 +334,21 @@
assert count == expected_count
+class StopAtXPolicy(HintAnnotatorPolicy):
+ def __init__(self, *funcs):
+ HintAnnotatorPolicy.__init__(self, novirtualcontainer=True,
+ oopspec=True)
+ self.funcs = funcs
+
+ def look_inside_graph(self, graph):
+ try:
+ if graph.func in self.funcs:
+ return False
+ except AttributeError:
+ pass
+ return True
+
+
class TestTimeshift(TimeshiftingTests):
def test_simple_fixed(self):
@@ -1182,15 +1197,7 @@
def f(x):
return 2*g(x)
- class StopAtGPolicy(HintAnnotatorPolicy):
- novirtualcontainer = True
-
- def look_inside_graph(self, graph):
- if graph.name == 'g':
- return False
- return True
-
- res = self.timeshift(f, [20], [], policy=StopAtGPolicy())
+ res = self.timeshift(f, [20], [], policy=StopAtXPolicy(g))
assert res == 42
self.check_insns(int_add=0)
@@ -1210,16 +1217,7 @@
except ValueError:
return 7
- class StopAtHPolicy(HintAnnotatorPolicy):
- novirtualcontainer = True
-
- def look_inside_graph(self, graph):
- if graph.name == 'h':
- return False
- return True
-
- stop_at_h = StopAtHPolicy()
-
+ stop_at_h = StopAtXPolicy(h)
res = self.timeshift(f, [20], [], policy=stop_at_h)
assert res == 42
self.check_insns(int_add=0)
Modified: pypy/dist/pypy/jit/timeshifter/test/test_virtualizable.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_virtualizable.py (original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_virtualizable.py Tue Jan 30 16:15:28 2007
@@ -1,5 +1,5 @@
-from pypy.jit.hintannotator.annotator import HintAnnotatorPolicy
from pypy.jit.timeshifter.test.test_portal import PortalTest, P_OOPSPEC
+from pypy.jit.timeshifter.test.test_timeshift import StopAtXPolicy
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rpython.lltypesystem.rvirtualizable import VABLERTIPTR
from pypy.rlib.objectmodel import hint
@@ -114,21 +114,6 @@
-class StopAtXPolicy(HintAnnotatorPolicy):
- def __init__(self, *funcs):
- HintAnnotatorPolicy.__init__(self, novirtualcontainer=True,
- oopspec=True)
- self.funcs = funcs
-
- def look_inside_graph(self, graph):
- try:
- if graph.func in self.funcs:
- return False
- except AttributeError:
- pass
- return True
-
-
class TestVirtualizableExplicit(PortalTest):
def test_simple(self):
More information about the Pypy-commit
mailing list