Author: Armin Rigo <[email protected]>
Branch:
Changeset: r60595:37b71225d44c
Date: 2013-01-28 10:28 +0100
http://bitbucket.org/pypy/pypy/changeset/37b71225d44c/
Log: Fix test_jit_ffi_vref, actually by improving the code produced.
diff --git a/rpython/jit/backend/llsupport/ffisupport.py
b/rpython/jit/backend/llsupport/ffisupport.py
--- a/rpython/jit/backend/llsupport/ffisupport.py
+++ b/rpython/jit/backend/llsupport/ffisupport.py
@@ -42,11 +42,14 @@
@specialize.memo()
def _get_ffi2descr_dict(cpu):
- d = {('v', 0): ('v', None)}
+ def entry(letter, TYPE):
+ return (letter, cpu.arraydescrof(rffi.CArray(TYPE)), rffi.sizeof(TYPE))
+ #
+ d = {('v', 0): ('v', None, 1)}
if cpu.supports_floats:
- d[('f', 0)] = ('f', cpu.arraydescrof(rffi.CArray(lltype.Float)))
+ d[('f', 0)] = entry('f', lltype.Float)
if cpu.supports_singlefloats:
- d[('S', 0)] = ('i', cpu.arraydescrof(rffi.CArray(lltype.SingleFloat)))
+ d[('S', 0)] = entry('i', lltype.SingleFloat)
for SIGNED_TYPE in [rffi.SIGNEDCHAR,
rffi.SHORT,
rffi.INT,
@@ -59,7 +62,7 @@
continue
key = ('L', 0)
kind = 'f'
- d[key] = (kind, cpu.arraydescrof(rffi.CArray(SIGNED_TYPE)))
+ d[key] = entry(kind, SIGNED_TYPE)
for UNSIGNED_TYPE in [rffi.UCHAR,
rffi.USHORT,
rffi.UINT,
@@ -68,7 +71,7 @@
key = ('u', rffi.sizeof(UNSIGNED_TYPE))
if key[1] > rffi.sizeof(lltype.Signed):
continue
- d[key] = ('i', cpu.arraydescrof(rffi.CArray(UNSIGNED_TYPE)))
+ d[key] = entry('i', UNSIGNED_TYPE)
return d
def get_arg_descr(cpu, ffi_type):
diff --git a/rpython/jit/metainterp/pyjitpl.py
b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -2567,7 +2567,8 @@
self.history.operations.pop()
arg_boxes = []
for i in range(cif_description.nargs):
- kind, descr = get_arg_descr(self.cpu, cif_description.atypes[i])
+ kind, descr, itemsize = get_arg_descr(self.cpu,
+ cif_description.atypes[i])
if kind == 'i':
box_arg = history.BoxInt()
elif kind == 'f':
@@ -2576,16 +2577,14 @@
assert kind == 'v'
continue
ofs = cif_description.exchange_args[i]
- box_argpos = history.BoxInt()
- self.history.record(rop.INT_ADD,
- [box_exchange_buffer, ConstInt(ofs)],
- box_argpos)
+ assert ofs % itemsize == 0 # alignment check
self.history.record(rop.GETARRAYITEM_RAW,
- [box_argpos, ConstInt(0)],
+ [box_exchange_buffer,
+ ConstInt(ofs // itemsize)],
box_arg, descr)
arg_boxes.append(box_arg)
#
- kind, descr = get_arg_descr(self.cpu, cif_description.rtype)
+ kind, descr, itemsize = get_arg_descr(self.cpu, cif_description.rtype)
if kind == 'i':
box_result = history.BoxInt()
elif kind == 'f':
@@ -2601,12 +2600,10 @@
#
if box_result is not None:
ofs = cif_description.exchange_result
- box_resultpos = history.BoxInt()
- self.history.record(rop.INT_ADD,
- [box_exchange_buffer, ConstInt(ofs)],
- box_resultpos)
+ assert ofs % itemsize == 0 # alignment check (result)
self.history.record(rop.SETARRAYITEM_RAW,
- [box_resultpos, ConstInt(0), box_result],
+ [box_exchange_buffer,
+ ConstInt(ofs // itemsize), box_result],
None, descr)
def direct_call_release_gil(self):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit