Author: Armin Rigo <ar...@tunes.org> Branch: ffi-backend Changeset: r56548:7fa5cf224645 Date: 2012-08-03 11:16 +0200 http://bitbucket.org/pypy/pypy/changeset/7fa5cf224645/
Log: Hack until the test reaches the xxxx in pyjitpl.py. diff --git a/pypy/jit/backend/llgraph/llimpl.py b/pypy/jit/backend/llgraph/llimpl.py --- a/pypy/jit/backend/llgraph/llimpl.py +++ b/pypy/jit/backend/llgraph/llimpl.py @@ -879,7 +879,7 @@ if arraydescr.typeinfo == REF: raise NotImplementedError("setarrayitem_raw <- gcref") elif arraydescr.typeinfo == INT: - do_setarrayitem_raw_int(array, index, newvalue) + do_setarrayitem_raw_int(array, index, newvalue, arraydescr.ofs) elif arraydescr.typeinfo == FLOAT: do_setarrayitem_raw_float(array, index, newvalue) else: @@ -1546,10 +1546,13 @@ newvalue = cast_from_int(ITEMTYPE, newvalue) array.setitem(index, newvalue) -def do_setarrayitem_raw_int(array, index, newvalue): +def do_setarrayitem_raw_int(array, index, newvalue, itemsize): array = array.adr.ptr ITEMTYPE = lltype.typeOf(array).TO.OF - newvalue = cast_from_int(ITEMTYPE, newvalue) + TYPE = symbolic.Size2Type[itemsize] + if TYPE.OF != ITEMTYPE: + array = rffi.cast(lltype.Ptr(TYPE), array) + newvalue = cast_from_int(TYPE.OF, newvalue) array._obj.setitem(index, newvalue) def do_setarrayitem_gc_float(array, index, newvalue): diff --git a/pypy/jit/backend/llgraph/runner.py b/pypy/jit/backend/llgraph/runner.py --- a/pypy/jit/backend/llgraph/runner.py +++ b/pypy/jit/backend/llgraph/runner.py @@ -507,7 +507,7 @@ def bh_setarrayitem_raw_i(self, arraydescr, array, index, newvalue): assert isinstance(arraydescr, Descr) - llimpl.do_setarrayitem_raw_int(array, index, newvalue) + llimpl.do_setarrayitem_raw_int(array, index, newvalue, arraydescr.ofs) def bh_setarrayitem_gc_r(self, arraydescr, array, index, newvalue): assert isinstance(arraydescr, Descr) diff --git a/pypy/rpython/lltypesystem/llmemory.py b/pypy/rpython/lltypesystem/llmemory.py --- a/pypy/rpython/lltypesystem/llmemory.py +++ b/pypy/rpython/lltypesystem/llmemory.py @@ -541,8 +541,12 @@ def __nonzero__(self): return bool(self.adr) def __add__(self, ofs): + if (isinstance(ofs, int) and + getattr(self.adr.ptr._TYPE.TO, 'OF', None) == lltype.Char): + return AddressAsInt(self.adr + ItemOffset(lltype.Char, ofs)) if isinstance(ofs, FieldOffset) and ofs.TYPE is self.adr.ptr._TYPE.TO: - return AddressAsInt(cast_ptr_to_adr(self.adr.ptr.b)) + fieldadr = getattr(self.adr.ptr, ofs.fieldname) + return AddressAsInt(cast_ptr_to_adr(fieldadr)) return NotImplemented def __repr__(self): try: _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit