[pypy-svn] r77534 - in pypy/branch/jitffi/pypy: jit/codewriter jit/metainterp/test rlib

antocuni at codespeak.net antocuni at codespeak.net
Fri Oct 1 17:22:59 CEST 2010


Author: antocuni
Date: Fri Oct  1 17:22:57 2010
New Revision: 77534

Modified:
   pypy/branch/jitffi/pypy/jit/codewriter/support.py
   pypy/branch/jitffi/pypy/jit/metainterp/test/test_direct_call.py
   pypy/branch/jitffi/pypy/rlib/libffi.py
Log:
fix the jit and the test, after the refactoring of libffi.py


Modified: pypy/branch/jitffi/pypy/jit/codewriter/support.py
==============================================================================
--- pypy/branch/jitffi/pypy/jit/codewriter/support.py	(original)
+++ pypy/branch/jitffi/pypy/jit/codewriter/support.py	Fri Oct  1 17:22:57 2010
@@ -222,18 +222,20 @@
 # libffi support
 # --------------
 
-def _ll_1_libffi_prepare_call(func):
-    pass
+def _ll_1_libffi_prepare_call(llfunc):
+    from pypy.rlib.libffi import Func
+    func = cast_base_ptr_to_instance(Func, llfunc)
+    return func._prepare()
 
-def _ll_2_libffi_push_arg(llfunc, value):
+def _ll_4_libffi_push_arg(llfunc, value, ll_args, i):
     from pypy.rlib.libffi import Func
     func = cast_base_ptr_to_instance(Func, llfunc)
-    return func._push_arg(value)
+    return func._push_arg(value, ll_args, i)
 
-def _ll_3_libffi_call(llfunc, funcsym, RESULT):
+def _ll_4_libffi_call(llfunc, funcsym, ll_args, RESULT):
     from pypy.rlib.libffi import Func
     func = cast_base_ptr_to_instance(Func, llfunc)
-    return func._do_call(funcsym, lltype.Signed)
+    return func._do_call(funcsym, ll_args, lltype.Signed)
 # XXX: should be RESULT, but it doesn't work
 
 

Modified: pypy/branch/jitffi/pypy/jit/metainterp/test/test_direct_call.py
==============================================================================
--- pypy/branch/jitffi/pypy/jit/metainterp/test/test_direct_call.py	(original)
+++ pypy/branch/jitffi/pypy/jit/metainterp/test/test_direct_call.py	Fri Oct  1 17:22:57 2010
@@ -2,8 +2,7 @@
 import py
 from pypy.rlib.jit import JitDriver, hint
 from pypy.jit.metainterp.test.test_basic import LLJitMixin
-from pypy.rlib.clibffi import FuncPtr, CDLL, ffi_type_sint
-from pypy.rlib.libffi import IntArg, Func
+from pypy.rlib.libffi import CDLL, ffi_type_sint, IntArg, Func
 from pypy.tool.udir import udir
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.translator.platform import platform
@@ -29,9 +28,8 @@
 
         def f(n):
             cdll = CDLL(self.lib_name)
-            fn = cdll.getpointer('sum_xy', [ffi_type_sint, ffi_type_sint],
-                                 ffi_type_sint)
-            func = Func(fn)
+            func = cdll.getpointer('sum_xy', [ffi_type_sint, ffi_type_sint],
+                                   ffi_type_sint)
             while n < 10:
                 driver.jit_merge_point(n=n, func=func)
                 driver.can_enter_jit(n=n, func=func)

Modified: pypy/branch/jitffi/pypy/rlib/libffi.py
==============================================================================
--- pypy/branch/jitffi/pypy/rlib/libffi.py	(original)
+++ pypy/branch/jitffi/pypy/rlib/libffi.py	Fri Oct  1 17:22:57 2010
@@ -66,8 +66,8 @@
         ll_args[i] = ll_buf
     # XXX this is bad, fix it somehow in the future, but specialize:argtype
     # doesn't work correctly with mixing non-negative and normal integers
-    #_push_arg._annenforceargs_ = [None, int]
-    _push_arg._annspecialcase_ = 'specialize:argtype(1)'
+    _push_arg._annenforceargs_ = [None, int, None, int]
+    #_push_arg._annspecialcase_ = 'specialize:argtype(1)'
     _push_arg.oopspec = 'libffi_push_arg(self, value, ll_args, i)'
 
     def _do_call(self, funcsym, ll_args, RESULT):
@@ -89,8 +89,8 @@
         self._free_buffers(ll_result, ll_args)
         #check_fficall_result(ffires, self.flags)
         return res
-    _do_call._annspecialcase_ = 'specialize:arg(2)'
-    _do_call.oopspec = 'libffi_call(self, funcsym, RESULT)'
+    _do_call._annspecialcase_ = 'specialize:arg(3)'
+    _do_call.oopspec = 'libffi_call(self, funcsym, ll_args, RESULT)'
 
     def _free_buffers(self, ll_result, ll_args):
         lltype.free(ll_result, flavor='raw')



More information about the Pypy-commit mailing list