Author: Armin Rigo <ar...@tunes.org> Branch: gc-del Changeset: r62761:7ce93195ebd3 Date: 2013-03-25 22:00 +0100 http://bitbucket.org/pypy/pypy/changeset/7ce93195ebd3/
Log: Support raw array manipulations too diff --git a/rpython/translator/backendopt/destructor.py b/rpython/translator/backendopt/destructor.py --- a/rpython/translator/backendopt/destructor.py +++ b/rpython/translator/backendopt/destructor.py @@ -31,12 +31,13 @@ if (op.opname.startswith('int_') or op.opname.startswith('float_') or op.opname.startswith('cast_')): return self.bottom_result() - if op.opname == 'setfield' or op.opname == 'bare_setfield': - TP = op.args[2].concretetype + if (op.opname == 'setfield' or op.opname == 'bare_setfield' or + op.opname == 'setarrayitem' or op.opname == 'bare_setarrayitem'): + TP = op.args[-1].concretetype if not isinstance(TP, lltype.Ptr) or TP.TO._gckind == 'raw': # primitive type return self.bottom_result() - if op.opname == 'getfield': + if op.opname == 'getfield' or op.opname == 'getarrayitem': TP = op.result.concretetype if not isinstance(TP, lltype.Ptr) or TP.TO._gckind == 'raw': # primitive type diff --git a/rpython/translator/backendopt/test/test_destructor.py b/rpython/translator/backendopt/test/test_destructor.py --- a/rpython/translator/backendopt/test/test_destructor.py +++ b/rpython/translator/backendopt/test/test_destructor.py @@ -127,6 +127,15 @@ r = self.analyze(g, [], f, backendopt=True) assert not r + def test_setarrayitem(self): + x = lltype.malloc(lltype.Array(lltype.Signed), 5, flavor='raw', + immortal=True) + def f(): + x[1] += 1 + + r = self.analyze(f, [], f) + assert not r + def test_chain(self): class B(object): def __init__(self): _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit