[pypy-svn] r77562 - in pypy/branch/jitffi/pypy: jit/metainterp/test rlib
antocuni at codespeak.net
antocuni at codespeak.net
Mon Oct 4 11:38:57 CEST 2010
Author: antocuni
Date: Mon Oct 4 11:38:56 2010
New Revision: 77562
Modified:
pypy/branch/jitffi/pypy/jit/metainterp/test/test_direct_call.py
pypy/branch/jitffi/pypy/rlib/libffi.py
Log:
actually test float args
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 Mon Oct 4 11:38:56 2010
@@ -2,7 +2,7 @@
import py
from pypy.rlib.jit import JitDriver, hint
from pypy.jit.metainterp.test.test_basic import LLJitMixin
-from pypy.rlib.libffi import CDLL, ffi_type_sint, ArgChain, Func
+from pypy.rlib.libffi import CDLL, ffi_type_sint, ffi_type_double, ArgChain, Func
from pypy.tool.udir import udir
from pypy.translator.tool.cbuild import ExternalCompilationInfo
from pypy.translator.platform import platform
@@ -14,9 +14,9 @@
# it via rlib.libffi
c_file = udir.ensure("test_jit_direct_call", dir=1).join("xlib.c")
c_file.write(py.code.Source('''
- int sum_xy(int x, int y)
+ int sum_xy(int x, double y)
{
- return (x + y);
+ return (x + (int)y);
}
'''))
eci = ExternalCompilationInfo(export_symbols=['sum_xy'])
@@ -28,14 +28,14 @@
def f(n):
cdll = CDLL(self.lib_name)
- func = cdll.getpointer('sum_xy', [ffi_type_sint, ffi_type_sint],
+ func = cdll.getpointer('sum_xy', [ffi_type_sint, ffi_type_double],
ffi_type_sint)
while n < 10:
driver.jit_merge_point(n=n, func=func)
driver.can_enter_jit(n=n, func=func)
func = hint(func, promote=True)
argchain = ArgChain()
- argchain.int(n).int(1)
+ argchain.int(n).float(1.2)
n = func.call(argchain, lltype.Signed)
return n
Modified: pypy/branch/jitffi/pypy/rlib/libffi.py
==============================================================================
--- pypy/branch/jitffi/pypy/rlib/libffi.py (original)
+++ pypy/branch/jitffi/pypy/rlib/libffi.py Mon Oct 4 11:38:56 2010
@@ -1,5 +1,5 @@
from pypy.rpython.lltypesystem import rffi, lltype
-from pypy.rlib.objectmodel import specialize
+from pypy.rlib.objectmodel import specialize, enforceargs
from pypy.rlib.rarithmetic import intmask, r_uint
from pypy.rlib import jit
from pypy.rlib import clibffi
@@ -120,11 +120,12 @@
ll_args[i] = ll_buf
@jit.oopspec('libffi_push_int(self, value, ll_args, i)')
+ @enforceargs( None, int, None, int) # fix the annotation for tests
def _push_int(self, value, ll_args, i):
self._push_arg(lltype.Signed, value, ll_args, i)
- _push_int._annenforceargs_ = [None, int, None, int]
@jit.oopspec('libffi_push_float(self, value, ll_args, i)')
+ @enforceargs( None, float, None, int) # fix the annotation for tests
def _push_float(self, value, ll_args, i):
self._push_arg(lltype.Float, value, ll_args, i)
More information about the Pypy-commit
mailing list