[pypy-svn] r34465 - in pypy/dist/pypy/jit: timeshifter/test tl

pedronis at codespeak.net pedronis at codespeak.net
Fri Nov 10 15:38:26 CET 2006


Author: pedronis
Date: Fri Nov 10 15:38:22 2006
New Revision: 34465

Modified:
   pypy/dist/pypy/jit/timeshifter/test/test_portal.py
   pypy/dist/pypy/jit/timeshifter/test/test_tlr.py
   pypy/dist/pypy/jit/tl/tlr.py
Log:
(arre, pedronis)

port the tlr test to the portal style.



Modified: pypy/dist/pypy/jit/timeshifter/test/test_portal.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_portal.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_portal.py	Fri Nov 10 15:38:22 2006
@@ -9,7 +9,7 @@
 
 import py.test
 
-class TestPortal(object):
+class PortalTest(object):
     from pypy.jit.codegen.llgraph.rgenop import RGenOp
 
     def setup_class(cls):
@@ -28,7 +28,7 @@
                               backendoptimize=False):
         # decode the 'values' if they are specified as strings
         if hasattr(main, 'convert_arguments'):
-            assert len(main.convert_arguments) == len(values)
+            assert len(main.convert_arguments) == len(main_args)
             main_args = [decoder(value) for decoder, value in zip(
                                         main.convert_arguments,
                                         main_args)]
@@ -40,7 +40,7 @@
         else:
             self.__dict__.update(cache)
             assert argtypes == getargtypes(self.rtyper.annotator, main_args)
-            return
+            return main_args
 
         hs, ha, self.rtyper = hannotate(main, main_args, portal=portal,
                                    policy=policy, inline=inline,
@@ -69,14 +69,15 @@
         cache = self.__dict__.copy()
         self._cache[key] = cache, getargtypes(self.rtyper.annotator, main_args)
         self._cache_order.append(key)
+        return main_args
 
     
     def timeshift_from_portal(self, main, portal, main_args,
                               inline=None, policy=None,
                               backendoptimize=False):
-        self._timeshift_from_portal(main, portal, main_args,
-                                    inline=inline, policy=policy,
-                                    backendoptimize=backendoptimize)
+        main_args = self._timeshift_from_portal(main, portal, main_args,
+                                                inline=inline, policy=policy,
+                                                backendoptimize=backendoptimize)
         self.main_args = main_args
         llinterp = LLInterpreter(self.rtyper)
         res = llinterp.eval_graph(self.maingraph, main_args)
@@ -92,6 +93,8 @@
             assert self.insns == expected
         for opname, count in counts.items():
             assert self.insns.get(opname, 0) == count
+
+class TestPortal(PortalTest):
             
     def test_simple(self):
 

Modified: pypy/dist/pypy/jit/timeshifter/test/test_tlr.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_tlr.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_tlr.py	Fri Nov 10 15:38:22 2006
@@ -1,12 +1,12 @@
 from pypy.rpython.module.support import LLSupport
-from pypy.jit.timeshifter.test.test_timeshift import TimeshiftingTests
+from pypy.jit.timeshifter.test.test_portal import PortalTest
 from pypy.jit.timeshifter.test.test_vlist import P_OOPSPEC
 from pypy.tool.sourcetools import func_with_new_name
 
 from pypy.jit.tl import tlr
 
 
-class TestTLR(TimeshiftingTests):
+class TestTLR(PortalTest):
 
     def test_tlr(self):
         bytecode = ','.join([str(ord(c)) for c in tlr.SQUARE])
@@ -17,10 +17,10 @@
             return LLSupport.to_rstr(result)
         tlr_interpret.convert_arguments = [build_bytecode, int]
 
-        res = self.timeshift(tlr_interpret, [bytecode, 1764], [0],
+        res = self.timeshift_from_portal(tlr_interpret, tlr_interpret, [bytecode, 1764],
                              policy=P_OOPSPEC)
         assert res == 3111696
 
-        res = self.timeshift(tlr_interpret, [bytecode, 9], [0, 1],
+        res = self.timeshift_from_portal(tlr_interpret, tlr_interpret, [bytecode, 9],
                              policy=P_OOPSPEC)
         assert res == 81

Modified: pypy/dist/pypy/jit/tl/tlr.py
==============================================================================
--- pypy/dist/pypy/jit/tl/tlr.py	(original)
+++ pypy/dist/pypy/jit/tl/tlr.py	Fri Nov 10 15:38:22 2006
@@ -16,6 +16,7 @@
     regs = []
     pc = 0
     while True:
+        hint(None, global_merge_point=True)
         opcode = hint(ord(bytecode[pc]), concrete=True)
         pc += 1
         if opcode == MOV_A_R:



More information about the Pypy-commit mailing list