[pypy-svn] r29504 - in pypy/dist/pypy/jit: llabstractinterp/test tl tl/test

arigo at codespeak.net arigo at codespeak.net
Thu Jun 29 18:53:36 CEST 2006


Author: arigo
Date: Thu Jun 29 18:53:34 2006
New Revision: 29504

Modified:
   pypy/dist/pypy/jit/llabstractinterp/test/test_jit_tl.py
   pypy/dist/pypy/jit/tl/test/test_tl.py
   pypy/dist/pypy/jit/tl/tl.py
Log:
( " , " , " )

A flag to get a version of the TL without the recursive call.



Modified: pypy/dist/pypy/jit/llabstractinterp/test/test_jit_tl.py
==============================================================================
--- pypy/dist/pypy/jit/llabstractinterp/test/test_jit_tl.py	(original)
+++ pypy/dist/pypy/jit/llabstractinterp/test/test_jit_tl.py	Thu Jun 29 18:53:34 2006
@@ -11,7 +11,7 @@
 
 def setup_module(mod):
     t = TranslationContext()
-    t.buildannotator().build_types(tl.interp, [str, int])
+    t.buildannotator().build_types(tl.interp, [str, int, bool])
     rtyper = t.buildrtyper()
     rtyper.specialize()
     #inline.auto_inlining(t, 0.3)
@@ -23,10 +23,12 @@
 def jit_tl(code):
     interp = LLAbstractInterp()
     hints = {0: string_repr.convert_const(code),
-             1: 0}
+             1: 0,
+             2: True}
     graph2 = interp.eval(graph1, hints)
 
-    result1 = llinterp.eval_graph(graph1, [string_repr.convert_const(code), 0])
+    result1 = llinterp.eval_graph(graph1, [string_repr.convert_const(code), 0,
+                                           True])
     result2 = llinterp.eval_graph(graph2, [])
 
     assert result1 == result2

Modified: pypy/dist/pypy/jit/tl/test/test_tl.py
==============================================================================
--- pypy/dist/pypy/jit/tl/test/test_tl.py	(original)
+++ pypy/dist/pypy/jit/tl/test/test_tl.py	Thu Jun 29 18:53:34 2006
@@ -48,7 +48,7 @@
 
 def test_tl_translatable():
     code = list2bytecode([PUSH,42, PUSH,100, ADD])
-    fn = translate(interp, [str, int])
+    fn = translate(interp, [str, int, bool])
     assert interp(code) == fn(code)
 
 def test_swap():

Modified: pypy/dist/pypy/jit/tl/tl.py
==============================================================================
--- pypy/dist/pypy/jit/tl/tl.py	(original)
+++ pypy/dist/pypy/jit/tl/tl.py	Thu Jun 29 18:53:34 2006
@@ -11,7 +11,7 @@
         t = -(-ord(c) & 0xff)
     return t
 
-def interp(code='', pc=0):
+def interp(code='', pc=0, support_calls=True):
     if not isinstance(code,str):
         raise TypeError("code '%s' should be a string" % str(code))
 
@@ -111,7 +111,7 @@
             if stack.pop():
                 pc += hint(offset, forget=True)
 
-        elif opcode == CALL:
+        elif support_calls and opcode == CALL:
             offset = char2int(code[pc])
             pc += 1
             res = interp(code, pc + offset)



More information about the Pypy-commit mailing list