[pypy-svn] r15844 - in pypy/dist/pypy/rpython: memory memory/test test

cfbolz at codespeak.net cfbolz at codespeak.net
Tue Aug 9 18:09:16 CEST 2005


Author: cfbolz
Date: Tue Aug  9 18:09:16 2005
New Revision: 15844

Modified:
   pypy/dist/pypy/rpython/memory/convertlltype.py
   pypy/dist/pypy/rpython/memory/test/test_llinterpsim.py
   pypy/dist/pypy/rpython/test/test_llinterp.py
Log:
do not convert void arguments :-(


Modified: pypy/dist/pypy/rpython/memory/convertlltype.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/convertlltype.py	(original)
+++ pypy/dist/pypy/rpython/memory/convertlltype.py	Tue Aug  9 18:09:16 2005
@@ -8,6 +8,8 @@
 from pypy.objspace.flow.model import Constant
 from pypy.rpython import lltype
 
+from pypy.rpython.rmodel import IntegerRepr
+
 import types, struct
 
 class LLTypeConverter(object):
@@ -118,12 +120,15 @@
         constants = {}
         def collect_args(args):
             for arg in args:
-                if isinstance(arg, Constant):
+                if (isinstance(arg, Constant) and
+                    arg.concretetype is not lltype.Void):
                     constants[arg] = None
         def visit(obj):
             if isinstance(obj, Link):
                 collect_args(obj.args)
                 if hasattr(obj, "llexitcase"):
+                    if isinstance(obj.llexitcase, IntegerRepr):
+                        assert 0
                     constants[Constant(obj.llexitcase)] = None
             elif isinstance(obj, Block):
                 for op in obj.operations:

Modified: pypy/dist/pypy/rpython/memory/test/test_llinterpsim.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/test/test_llinterpsim.py	(original)
+++ pypy/dist/pypy/rpython/memory/test/test_llinterpsim.py	Tue Aug  9 18:09:16 2005
@@ -369,6 +369,23 @@
         return i
     except ValueError:
         raise TypeError
+
+
+#the following function has a constant argument which is void
+def test_str_of_int():
+    def dummy(i):
+        return str(i)
+    
+    res = interpret(dummy, [0])
+    assert ''.join(res.chars) == '0'
+
+    res = interpret(dummy, [1034])
+    assert ''.join(res.chars) == '1034'
+
+    res = interpret(dummy, [-123])
+    assert ''.join(res.chars) == '-123'
+
+
 #__________________________________________________________________
 # interactive playing
 

Modified: pypy/dist/pypy/rpython/test/test_llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_llinterp.py	(original)
+++ pypy/dist/pypy/rpython/test/test_llinterp.py	Tue Aug  9 18:09:16 2005
@@ -9,6 +9,7 @@
 from pypy.rpython import rstr
 from pypy.annotation.model import lltype_to_annotation
 from pypy.rpython.rarithmetic import r_uint, ovfcheck
+from pypy.rpython.memory import gclltype
 
 # switch on logging of interp to show more info on failing tests
 
@@ -73,7 +74,8 @@
         
         t, typer = gengraph(func, [annotation(x)
                       for x in values], viewbefore, policy)
-        interp = LLInterpreter(t.flowgraphs, typer)
+        interp = LLInterpreter(t.flowgraphs, typer, gclltype,
+                               gclltype.prepare_graphs)
         _tcache[key] = (t, interp)
         # keep the cache small 
         _lastinterpreted.append(key) 



More information about the Pypy-commit mailing list