[pypy-svn] r77687 - pypy/branch/jitffi/pypy/module/_ffi
antocuni at codespeak.net
antocuni at codespeak.net
Thu Oct 7 17:07:22 CEST 2010
Author: antocuni
Date: Thu Oct 7 17:07:21 2010
New Revision: 77687
Modified:
pypy/branch/jitffi/pypy/module/_ffi/interp_ffi.py
Log:
try to be nicer wrt the jit: the construction of the argchain has been moved
to its own function, which is marked as unroll_safe: this should be enough to
make the argchain completely virtual
Modified: pypy/branch/jitffi/pypy/module/_ffi/interp_ffi.py
==============================================================================
--- pypy/branch/jitffi/pypy/module/_ffi/interp_ffi.py (original)
+++ pypy/branch/jitffi/pypy/module/_ffi/interp_ffi.py Thu Oct 7 17:07:21 2010
@@ -6,6 +6,7 @@
#
from pypy.rpython.lltypesystem import lltype, rffi
#
+from pypy.rlib import jit
from pypy.rlib import libffi
from pypy.rlib.rdynload import DLOpenError
@@ -49,12 +50,12 @@
def __init__(self, func):
self.func = func
- @unwrap_spec('self', ObjSpace, 'args_w')
- def call(self, space, args_w):
- assert len(args_w) == len(self.func.argtypes) # XXX: raise OperationError
+ @jit.unroll_safe
+ def build_argchain(self, space, argtypes, args_w):
+ assert len(args_w) == len(argtypes) # XXX: raise OperationError
argchain = libffi.ArgChain()
for i in range(len(args_w)):
- argtype = self.func.argtypes[i]
+ argtype = argtypes[i]
w_arg = args_w[i]
kind = libffi.types.getkind(argtype)
if kind == 'i':
@@ -63,7 +64,11 @@
argchain.arg(space.float_w(w_arg))
else:
assert False # XXX
- #
+ return argchain
+
+ @unwrap_spec('self', ObjSpace, 'args_w')
+ def call(self, space, args_w):
+ argchain = self.build_argchain(space, self.func.argtypes, args_w)
reskind = libffi.types.getkind(self.func.restype)
if reskind == 'i':
intres = self.func.call(argchain, rffi.LONG)
More information about the Pypy-commit
mailing list