[pypy-svn] r77287 - pypy/branch/jitffi/pypy/rlib

fijal at codespeak.net fijal at codespeak.net
Thu Sep 23 09:43:26 CEST 2010


Author: fijal
Date: Thu Sep 23 09:43:24 2010
New Revision: 77287

Modified:
   pypy/branch/jitffi/pypy/rlib/clibffi.py
   pypy/branch/jitffi/pypy/rlib/libffi.py
Log:
A bunch of jit-related changes.


Modified: pypy/branch/jitffi/pypy/rlib/clibffi.py
==============================================================================
--- pypy/branch/jitffi/pypy/rlib/clibffi.py	(original)
+++ pypy/branch/jitffi/pypy/rlib/clibffi.py	Thu Sep 23 09:43:24 2010
@@ -471,6 +471,8 @@
     ll_args = lltype.nullptr(rffi.VOIDPP.TO)
     ll_result = lltype.nullptr(rffi.VOIDP.TO)
 
+    _immutable_fields_ = ['funcsym'] # XXX probably more
+
     def __init__(self, name, argtypes, restype, funcsym, flags=FUNCFLAG_CDECL,
                  keepalive=None):
         # initialize each one of pointers with null
@@ -491,9 +493,9 @@
                                            flavor='raw')
 
     def push_arg(self, value):
-        if self.pushed_args == self.argnum:
-            raise TypeError("Too many arguments, eats %d, pushed %d" %
-                            (self.argnum, self.argnum + 1))
+        #if self.pushed_args == self.argnum:
+        #    raise TypeError("Too many arguments, eats %d, pushed %d" %
+        #                    (self.argnum, self.argnum + 1))
         if not we_are_translated():
             TP = lltype.typeOf(value)
             if isinstance(TP, lltype.Ptr):
@@ -522,7 +524,7 @@
     def _clean_args(self):
         self.pushed_args = 0
 
-    def call(self, RES_TP):
+    def call(self, funcsym, RES_TP):
         self._check_args()
         ffires = c_ffi_call(self.ll_cif, self.funcsym,
                             rffi.cast(rffi.VOIDP, self.ll_result),
@@ -535,8 +537,8 @@
         self._clean_args()
         check_fficall_result(ffires, self.flags)
         return res
-    call._annspecialcase_ = 'specialize:arg(1)'
-    call.oopspec = 'libffi_call(self, RES_TP)'
+    call._annspecialcase_ = 'specialize:arg(2)'
+    call.oopspec = 'libffi_call(self, funcsym, RES_TP)'
 
     def __del__(self):
         if self.ll_args:

Modified: pypy/branch/jitffi/pypy/rlib/libffi.py
==============================================================================
--- pypy/branch/jitffi/pypy/rlib/libffi.py	(original)
+++ pypy/branch/jitffi/pypy/rlib/libffi.py	Thu Sep 23 09:43:24 2010
@@ -1,6 +1,7 @@
 
 from pypy.rlib.clibffi import *
 from pypy.rlib.objectmodel import specialize
+from pypy.rlib import jit
 
 class AbstractArg(object):
     next = None
@@ -32,6 +33,7 @@
         # the future it will replace it completely
         self.funcptr = funcptr
 
+    @jit.unroll_safe
     @specialize.arg(2)
     def call(self, argchain, RESULT):
         # implementation detail
@@ -39,6 +41,4 @@
         while arg:
             arg.push(self.funcptr)
             arg = arg.next
-        return self.funcptr.call(RESULT)
-
-
+        return self.funcptr.call(self.funcptr.funcsym, RESULT)



More information about the Pypy-commit mailing list