[pypy-svn] r76486 - in pypy/branch/interplevel-array/pypy: jit/backend/x86 module/pypyjit/test objspace/std
hakanardo at codespeak.net
hakanardo at codespeak.net
Thu Aug 5 20:02:02 CEST 2010
Author: hakanardo
Date: Thu Aug 5 20:01:57 2010
New Revision: 76486
Modified:
pypy/branch/interplevel-array/pypy/jit/backend/x86/assembler.py
pypy/branch/interplevel-array/pypy/module/pypyjit/test/test_pypy_c.py
pypy/branch/interplevel-array/pypy/objspace/std/itertype.py
Log:
pypy-c tests
Modified: pypy/branch/interplevel-array/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/interplevel-array/pypy/jit/backend/x86/assembler.py (original)
+++ pypy/branch/interplevel-array/pypy/jit/backend/x86/assembler.py Thu Aug 5 20:01:57 2010
@@ -1071,7 +1071,7 @@
self.mc.MOV(resloc, addr_add(base_loc, ofs_loc, ofs.value,
scale.value))
else:
- print "[asmgen]setarrayitem unsupported size: %d" % scale.value
+ print "[asmgen]getarrayitem unsupported size: %d" % scale.value
raise NotImplementedError()
genop_getarrayitem_gc_pure = genop_getarrayitem_gc
Modified: pypy/branch/interplevel-array/pypy/module/pypyjit/test/test_pypy_c.py
==============================================================================
--- pypy/branch/interplevel-array/pypy/module/pypyjit/test/test_pypy_c.py (original)
+++ pypy/branch/interplevel-array/pypy/module/pypyjit/test/test_pypy_c.py Thu Aug 5 20:01:57 2010
@@ -779,8 +779,13 @@
'''%(e1, e2), n, ([], res))
def test_array_sum(self):
- #for tc in 'bhilBHILfd':
- for tc in 'd':
+ for tc, maxops in zip('bhilBHILfd', (38,) * 6 + (40, 40, 41, 38)):
+ res = 19352859
+ if tc in 'IL':
+ res = long(res)
+ elif tc in 'fd':
+ res = float(res)
+
self.run_source('''
from array import array
@@ -791,20 +796,56 @@
l += img[i]
i += 1
return l
- ''' % tc, 38, ([], 19352859))
+ ''' % tc, maxops, ([], res))
def test_array_sum_char(self):
self.run_source('''
from array import array
def main():
- img = array("c", ' ') * 640 * 480
+ img = array("c", "Hello") * 130 * 480
l, i = 0, 0
while i < 640 * 480:
l += ord(img[i])
i += 1
return l
- ''', 60, ([], 9830400))
+ ''', 60, ([], 30720000))
+
+ def test_array_sum_unicode(self):
+ self.run_source('''
+ from array import array
+
+ def main():
+ img = array("u", u"Hello") * 130 * 480
+ l, i = 0, 0
+ while i < 640 * 480:
+ if img[i] == u"l":
+ l += 1
+ i += 1
+ return l
+ ''', 65, ([], 122880))
+
+ def test_array_intimg(self):
+ for tc, maxops in zip('ilILd', (67, 67, 69, 69, 61)):
+ res = 73574560
+ if tc in 'IL':
+ res = long(res)
+ elif tc in 'fd':
+ res = float(res)
+
+ self.run_source('''
+ from array import array
+
+ def main(tc):
+ img = array(tc, range(3)) * (350 * 480)
+ intimg = array(tc, (0,)) * (640 * 480)
+ l, i = 0, 640
+ while i < 640 * 480:
+ l = l + img[i]
+ intimg[i] = (intimg[i-640] + l)
+ i += 1
+ return intimg[i - 1]
+ ''', maxops, ([tc], res))
class AppTestJIT(PyPyCJITTests):
def setup_class(cls):
@@ -828,6 +869,7 @@
cls.counter = 0
cls.pypy_c = option.pypy_c
+
def has_info(pypy_c, option):
g = os.popen('"%s" --info' % pypy_c, 'r')
lines = g.readlines()
Modified: pypy/branch/interplevel-array/pypy/objspace/std/itertype.py
==============================================================================
--- pypy/branch/interplevel-array/pypy/objspace/std/itertype.py (original)
+++ pypy/branch/interplevel-array/pypy/objspace/std/itertype.py Thu Aug 5 20:01:57 2010
@@ -11,7 +11,8 @@
"""
# cpython does not support pickling iterators
- raise OperationError(space.w_TypeError, space.w_None)
+ msg = 'Pickling for iterators dissabled as cpython does not support it'
+ raise OperationError(space.w_TypeError, space.wrap(msg))
from pypy.objspace.std.iterobject import W_AbstractSeqIterObject
assert isinstance(w_self, W_AbstractSeqIterObject)
More information about the Pypy-commit
mailing list