Author: Antonio Cuni <[email protected]>
Branch:
Changeset: r56792:af6e5e8ca77b
Date: 2012-08-22 11:58 +0200
http://bitbucket.org/pypy/pypy/changeset/af6e5e8ca77b/
Log: hg merge
diff --git a/pypy/jit/backend/test/calling_convention_test.py
b/pypy/jit/backend/test/calling_convention_test.py
--- a/pypy/jit/backend/test/calling_convention_test.py
+++ b/pypy/jit/backend/test/calling_convention_test.py
@@ -310,9 +310,9 @@
F = lltype.Float
S = lltype.SingleFloat
I = lltype.Signed
- floats = [random.random() - 0.5 for i in range(8)]
- singlefloats = [r_singlefloat(random.random() - 0.5) for i in range(8)]
- ints = [random.randrange(-99, 99) for i in range(8)]
+ floats = [random.random() - 0.5 for i in range(20)]
+ singlefloats = [r_singlefloat(random.random() - 0.5) for i in
range(20)]
+ ints = [random.randrange(-99, 99) for i in range(20)]
for repeat in range(100):
args = []
argvalues = []
@@ -320,20 +320,23 @@
local_floats = list(floats)
local_singlefloats = list(singlefloats)
local_ints = list(ints)
- for i in range(8):
- case = random.randrange(0, 3)
- if case == 0:
+ for i in range(random.randrange(4, 20)):
+ case = random.randrange(0, 6)
+ if case & 1: boxme = BoxInt
+ else: boxme = ConstInt
+ if case < 2:
args.append(F)
- arg = local_floats.pop()
- argslist.append(boxfloat(arg))
- elif case == 1:
+ arg = arg1 = local_floats.pop()
+ if case & 1: boxme = boxfloat
+ else: boxme = constfloat
+ elif case < 4:
args.append(S)
arg = local_singlefloats.pop()
- argslist.append(BoxInt(longlong.singlefloat2int(arg)))
+ arg1 = longlong.singlefloat2int(arg)
else:
args.append(I)
- arg = local_ints.pop()
- argslist.append(BoxInt(arg))
+ arg = arg1 = local_ints.pop()
+ argslist.append(boxme(arg1))
argvalues.append(arg)
FUNC = self.FuncType(args, F)
FPTR = self.Ptr(FUNC)
diff --git a/pypy/jit/backend/x86/assembler.py
b/pypy/jit/backend/x86/assembler.py
--- a/pypy/jit/backend/x86/assembler.py
+++ b/pypy/jit/backend/x86/assembler.py
@@ -1171,11 +1171,13 @@
xmm_dst_locs.append(unused_xmm.pop())
else:
pass_on_stack.append(loc)
- elif (argtypes is not None and argtypes[i-start] == 'S' and
- len(unused_xmm) > 0):
+ elif argtypes is not None and argtypes[i-start] == 'S':
# Singlefloat argument
- if singlefloats is None: singlefloats = []
- singlefloats.append((loc, unused_xmm.pop()))
+ if len(unused_xmm) > 0:
+ if singlefloats is None: singlefloats = []
+ singlefloats.append((loc, unused_xmm.pop()))
+ else:
+ pass_on_stack.append(loc)
else:
if len(unused_gpr) > 0:
src_locs.append(loc)
@@ -1209,6 +1211,9 @@
# Load the singlefloat arguments from main regs or stack to xmm regs
if singlefloats is not None:
for src, dst in singlefloats:
+ if isinstance(src, ImmedLoc):
+ self.mc.MOV(X86_64_SCRATCH_REG, src)
+ src = X86_64_SCRATCH_REG
self.mc.MOVD(dst, src)
# Finally remap the arguments in the main regs
# If x is a register and is in dst_locs, then oups, it needs to
diff --git a/pypy/module/_cffi_backend/test/test_c.py
b/pypy/module/_cffi_backend/test/test_c.py
--- a/pypy/module/_cffi_backend/test/test_c.py
+++ b/pypy/module/_cffi_backend/test/test_c.py
@@ -1,7 +1,19 @@
from __future__ import with_statement
"""
This file is OBSCURE. Really. The purpose is to avoid copying and changing
-'test_c.py' from cffi/c/.
+'test_c.py' from cffi/c/ in the original CFFI repository:
+ https://bitbucket.org/cffi/cffi
+
+Adding a test here involves:
+1. add a test to cffi/c/test.py
+ - if you need a C function to call, add it into _cffi_backend.c
+ as a testfuncNN().
+2. have it pass when you run 'py.test test_c.py' in cffi
+3. check in and (if you can) push the changes
+4. copy test_c.py into _backend_test.py here, killing the few lines of header
+ - if you added a C function, it goes into _test_lib.c here
+ - if you could complete step 3, try running 'py.test test_file.py' here
+5. make the test pass in pypy ('py.test test_c.py')
"""
import py, sys, ctypes
if sys.version_info < (2, 6):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit