[pypy-commit] pypy default: another test for [non-None-ptr] * n being virtual, although only if n < 15
cfbolz
noreply at buildbot.pypy.org
Wed Feb 26 12:38:00 CET 2014
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch:
Changeset: r69462:2c8e18a5330a
Date: 2014-02-26 12:37 +0100
http://bitbucket.org/pypy/pypy/changeset/2c8e18a5330a/
Log: another test for [non-None-ptr] * n being virtual, although only if
n < 15
diff --git a/rpython/jit/metainterp/test/test_list.py b/rpython/jit/metainterp/test/test_list.py
--- a/rpython/jit/metainterp/test/test_list.py
+++ b/rpython/jit/metainterp/test/test_list.py
@@ -98,8 +98,8 @@
self.check_resops(setarrayitem_gc=0, call=0, getarrayitem_gc=0)
def test_vlist_alloc_and_set(self):
- # the check_loops fails, because [non-null] * n is not supported yet
- # (it is implemented as a residual call)
+ # the check_loops fails, because [non-null] * n is only supported
+ # if n < 15 (otherwise it is implemented as a residual call)
jitdriver = JitDriver(greens = [], reds = ['n'])
def f(n):
l = [1] * 20
@@ -116,7 +116,7 @@
res = self.meta_interp(f, [10], listops=True)
assert res == f(10)
- py.test.skip("'[non-null] * n' gives a residual call so far")
+ py.test.skip("'[non-null] * n' for n >= 15 gives a residual call so far")
self.check_loops(setarrayitem_gc=0, getarrayitem_gc=0, call=0)
def test_arraycopy_simpleoptimize(self):
@@ -307,6 +307,32 @@
'guard_true': 2,
'jump': 1})
+ def test_list_mul_virtual_nonzero(self):
+ class base:
+ pass
+ class Foo(base):
+ def __init__(self, l):
+ self.l = l
+ l[0] = self
+ class nil(base):
+ pass
+
+ nil = nil()
+
+ myjitdriver = JitDriver(greens = [], reds = ['y'])
+ def f(y):
+ while y > 0:
+ myjitdriver.jit_merge_point(y=y)
+ Foo([nil] * 5)
+ y -= 1
+ return 42
+
+ self.meta_interp(f, [5])
+ self.check_resops({'int_sub': 2,
+ 'int_gt': 2,
+ 'guard_true': 2,
+ 'jump': 1})
+
def test_list_mul_unsigned_virtual(self):
from rpython.rlib.rarithmetic import r_uint
diff --git a/rpython/rtyper/test/test_generator.py b/rpython/rtyper/test/test_generator.py
--- a/rpython/rtyper/test/test_generator.py
+++ b/rpython/rtyper/test/test_generator.py
@@ -88,3 +88,16 @@
return s
res = self.interpret(g, [])
assert res == 6
+
+ def test_send(self):
+ def f():
+ yield (yield 1) + 1
+ def g():
+ gen = f()
+ res = f.send(2)
+ assert res == 1
+ res = f.next()
+ assert res == 3
+
+ res = self.interpret(g, [])
+
More information about the pypy-commit
mailing list