[pypy-commit] pypy default: a test and a fix. test_zjit still fails, has to be investigated deeper
fijal
noreply at buildbot.pypy.org
Tue Nov 29 08:54:50 CET 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r49940:7bd54cc2db83
Date: 2011-11-29 09:54 +0200
http://bitbucket.org/pypy/pypy/changeset/7bd54cc2db83/
Log: a test and a fix. test_zjit still fails, has to be investigated
deeper
diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py
--- a/pypy/module/micronumpy/compile.py
+++ b/pypy/module/micronumpy/compile.py
@@ -70,7 +70,7 @@
start += size
if stop < 0:
stop += size
- return (start, stop, step, size//step)
+ return (start, stop, step, (stop - start)//step + 1)
@specialize.argtype(1)
def wrap(self, obj):
diff --git a/pypy/module/micronumpy/test/test_compile.py b/pypy/module/micronumpy/test/test_compile.py
--- a/pypy/module/micronumpy/test/test_compile.py
+++ b/pypy/module/micronumpy/test/test_compile.py
@@ -187,6 +187,17 @@
""")
assert interp.results[0].value.val == 5
+
+ def test_slice2(self):
+ interp = self.run("""
+ a = |30|
+ s1 = a -> 0:20:2
+ s2 = a -> 0:30:3
+ b = s1 + s2
+ b -> 3
+ """)
+ assert interp.results[0].value.val == 15
+
def test_multidim_getitem(self):
interp = self.run("""
a = [[1,2]]
diff --git a/pypy/module/micronumpy/test/test_zjit.py b/pypy/module/micronumpy/test/test_zjit.py
--- a/pypy/module/micronumpy/test/test_zjit.py
+++ b/pypy/module/micronumpy/test/test_zjit.py
@@ -246,10 +246,31 @@
def test_slice(self):
result = self.run("slice")
assert result == 18
- py.test.skip("Few remaining arraylen_gc left")
+ # arraylen_gc are removed by the backend, would be good if they weren't
+ # here though
self.check_simple_loop({'int_mul': 2, 'getarrayitem_raw': 2, 'float_add': 1,
'setarrayitem_raw': 1, 'int_add': 3,
- 'int_lt': 1, 'guard_true': 1, 'jump': 1})
+ 'int_lt': 1, 'guard_true': 1, 'jump': 1,
+ 'arraylen_gc': 4})
+
+ def define_slice2():
+ return """
+ a = |30|
+ s1 = a -> :20:2
+ s2 = a -> :30:3
+ b = s1 + s2
+ b -> 3
+ """
+
+ def test_slice2(self):
+ result = self.run("slice2")
+ assert result == 15
+ # arraylen_gc are removed by the backend, would be good if they weren't
+ # here though
+ self.check_simple_loop({'int_mul': 2, 'getarrayitem_raw': 2, 'float_add': 1,
+ 'setarrayitem_raw': 1, 'int_add': 1,
+ 'int_lt': 1, 'guard_true': 1, 'jump': 1,
+ 'arraylen_gc': 4})
def define_multidim():
return """
@@ -337,28 +358,6 @@
cls.space = FakeSpace()
cls.float64_dtype = cls.space.fromcache(W_Float64Dtype)
- def test_slice2(self):
- def f(i):
- step1 = 2
- step2 = 3
- ar = NDimArray(step2*i, dtype=self.float64_dtype)
- new_sig = signature.Signature.find_sig([
- NDimSlice.signature, ar.signature
- ])
- s1 = NDimSlice(0, step1*i, step1, i, ar, new_sig)
- new_sig = signature.Signature.find_sig([
- NDimSlice.signature, s1.signature
- ])
- s2 = NDimSlice(0, step2*i, step2, i, ar, new_sig)
- v = interp_ufuncs.get(self.space).add.call(self.space, [s1, s2])
- return v.get_concrete().eval(3).val
-
- result = self.meta_interp(f, [5], listops=True, backendopt=True)
- self.check_simple_loop({'int_mul': 2, 'getarrayitem_raw': 2, 'float_add': 1,
- 'setarrayitem_raw': 1, 'int_add': 1,
- 'int_lt': 1, 'guard_true': 1, 'jump': 1})
- assert result == f(5)
-
def test_int32_sum(self):
py.test.skip("pypy/jit/backend/llimpl.py needs to be changed to "
"deal correctly with int dtypes for this test to "
More information about the pypy-commit
mailing list