[pypy-svn] r62488 - in pypy/branch/pyjitpl5/pypy/jit/metainterp: . test
fijal at codespeak.net
fijal at codespeak.net
Tue Mar 3 18:45:18 CET 2009
Author: fijal
Date: Tue Mar 3 18:45:18 2009
New Revision: 62488
Modified:
pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vlist.py
Log:
a test and a partial fix (it exploded before). We still need some optimizations
for this test to pass
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py Tue Mar 3 18:45:18 2009
@@ -779,12 +779,16 @@
def prepare_list_getset(self, op, arraydescr, args):
func = op.args[0].value._obj._callable # xxx break of abstraction
+ # XXX what if the type is called _nonneg or _fast???
non_negative = '_nonneg' in func.__name__
- if isinstance(op.args[1], Variable):
- return None
- tag = op.args[1].value
- assert tag in (rlist.dum_nocheck, rlist.dum_checkidx)
- can_raise = tag != rlist.dum_nocheck
+ fast = '_fast' in func.__name__
+ if fast:
+ can_raise = False
+ non_negative = True
+ else:
+ tag = op.args[1].value
+ assert tag in (rlist.dum_nocheck, rlist.dum_checkidx)
+ can_raise = tag != rlist.dum_nocheck
#
if can_raise:
return None
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vlist.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vlist.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vlist.py Tue Mar 3 18:45:18 2009
@@ -60,6 +60,24 @@
# one setitem should be gone by now
self.check_loops(call_ptr=1, setarrayitem_gc=1, getarrayitem_gc=1)
+ def test_ll_fixed_setitem_fast(self):
+ jitdriver = JitDriver(greens = [], reds = ['n', 'l'])
+
+ def f(n):
+ l = [1, 2, 3]
+
+ while n > 0:
+ jitdriver.can_enter_jit(n=n, l=l)
+ jitdriver.jit_merge_point(n=n, l=l)
+ l = l[:]
+ n -= 1
+ return l[0]
+
+ res = self.meta_interp(f, [10], listops=True)
+ assert res == 1
+ py.test.skip("Constant propagation of length missing")
+ self.check_loops(setarrayitem_gc=0, call_ptr=0, call__4=0)
+
def test_vlist_with_default_read(self):
py.test.skip("for now, more support in codewriter needed")
jitdriver = JitDriver(greens = [], reds = ['n'])
More information about the Pypy-commit
mailing list