[pypy-svn] r46007 - in pypy/branch/pypy-more-rtti-inprogress/rpython/lltypesystem: . test

fijal at codespeak.net fijal at codespeak.net
Mon Aug 27 10:28:40 CEST 2007


Author: fijal
Date: Mon Aug 27 10:28:40 2007
New Revision: 46007

Modified:
   pypy/branch/pypy-more-rtti-inprogress/rpython/lltypesystem/rffi.py
   pypy/branch/pypy-more-rtti-inprogress/rpython/lltypesystem/test/test_rffi.py
Log:
Always inline helpers here. Add float case


Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/lltypesystem/rffi.py	(original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/lltypesystem/rffi.py	Mon Aug 27 10:28:40 2007
@@ -50,9 +50,12 @@
         for i, tp in unrolling_arg_tps:
             if isinstance(tp, lltype.Number):
                 real_args = real_args + (cast(tp, args[i]),)
+            elif tp is lltype.Float:
+                real_args = real_args + (float(args[i]),)
             else:
                 real_args = real_args + (args[i],)
         return funcptr(*real_args)
+    wrapper._always_inline_ = True
     return func_with_new_name(wrapper, name)
 
 from pypy.rpython.tool.rfficache import platform

Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/lltypesystem/test/test_rffi.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/lltypesystem/test/test_rffi.py	(original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/lltypesystem/test/test_rffi.py	Mon Aug 27 10:28:40 2007
@@ -310,24 +310,21 @@
     assert interpret(f, []) == 3
 
 def test_implicit_cast():
-    py.test.skip("Does not work")
-    z = llexternal('z', [USHORT], USHORT)
+    z = llexternal('z', [USHORT, ULONG, USHORT], USHORT)
 
-    def f(x):
-        return z(x)
+    def f(x, y, xx):
+        return z(x, y, xx)
 
     a = RPythonAnnotator()
-    r = a.build_types(f, [int])
+    r = a.build_types(f, [int, int, int])
     rtyper = RPythonTyper(a)
     rtyper.specialize()
     a.translator.rtyper = rtyper
-    if option.view:
-        a.translator.view()
     backend_optimizations(a.translator)
     if option.view:
         a.translator.view()
     graph = graphof(a.translator, f)
     s = summary(graph)
     # there should be not too many operations here by now
-    assert sorted(s.keys()) == ['cast_primitive', 'direct_call']
+    assert s == {'cast_int_to_uint': 1, 'direct_call': 1, 'cast_primitive': 2}
     



More information about the Pypy-commit mailing list