Skip to content

Instantly share code, notes, and snippets.

View squeaky-pl's full-sized avatar

Paweł Piotr Przeradowski squeaky-pl

View GitHub Profile
from array import array
LOOP = 10000
a = array('B')
b = array('B')
c = array('H')
with open('/dev/urandom') as f:
def test_cmp_outside_range(self):
ops = """
[p0]
i0 = getfield_gc(p0, descr=chardescr)
i1 = int_lt(i0, 256)
guard_true(i1) []
"""
expected = """
[p0]
diff -r e5565168e86f rpython/jit/backend/llsupport/descr.py
--- a/rpython/jit/backend/llsupport/descr.py Fri Feb 14 14:34:24 2014 +0100
+++ b/rpython/jit/backend/llsupport/descr.py Fri Feb 14 15:44:56 2014 +0100
@@ -103,6 +103,26 @@
def is_field_signed(self):
return self.flag == FLAG_SIGNED
+ def is_integer_bounded(self):
+ return self.flag in (FLAG_SIGNED, FLAG_UNSIGNED) \
+ and self.field_size < symbolic.WORD
+476: i58 = getarrayitem_raw(i57, i42, descr=<ArrayU 1>)
debug_merge_point(0, 0, '<code object add. file 'test.py'. line 18> #33 BINARY_ADD')
+488: i59 = int_add_ovf(i53, i58)
guard_no_overflow(descr=<Guard0x7f9d69aaaf70>) [p1, p0, i59, p2, p3, p6, p7, p12, p14, p16, p20, i58, i53, i42]
rawarraydescr_char = cpu.arraydescrof(lltype.Array(lltype.Char,
hints={'nolength': True}))
Got:
i82 = int_lt(i77, 307200)
guard_true(i82, descr=<Guard0x7f0934de10c0>)
guard_not_invalidated(descr=<Guard0x7f0934de1050>)
i83 = getarrayitem_raw(i59, i77, descr=<ArrayS 4>)
===== HERE =====
i84 = int_add(i62, i83)
i85 = int_sub(i77, 640)
i86 = getarrayitem_raw(i67, i85, descr=<ArrayS 4>)
diff -r 625f047a5759 pypy/module/pypyjit/test_pypy_c/test_array.py
--- a/pypy/module/pypyjit/test_pypy_c/test_array.py Sat Feb 15 18:34:09 2014 +0100
+++ b/pypy/module/pypyjit/test_pypy_c/test_array.py Sun Feb 16 21:05:38 2014 +0100
@@ -67,26 +67,46 @@
log = self.run(main, [])
assert log.result == 73574560
loop, = log.loops_by_filename(self.filepath)
- assert loop.match("""
- i13 = int_lt(i8, 307200)
- guard_true(i13, descr=...)
✘ squeaky@squeaky-mbp  ~/workspace/pypy  ☿ 69181@default ±  hg pull
pulling from ssh://hg@bitbucket.org/pypy/pypy
searching for changes
no changes found
squeaky@squeaky-mbp  ~/workspace/pypy  ☿ 69181@default ±  hg out
comparing with ssh://hg@bitbucket.org/pypy/pypy
searching for changes
no changes found
✘ squeaky@squeaky-mbp  ~/workspace/pypy  ☿ 69181@default ± 
operation(x, y)
a <= x <= b; c <= y <= d
// 32 bit machine
unsigned maxOR(unsigned a, unsigned b,
unsigned c, unsigned d) {
unsigned m, temp;
def add(a, b, c):
for i in range(LOOP):
c[i] = a[i] + b[i] + 1
# Loop 4 (<code object add, file 'test.py', line 18> #13 FOR_ITER) : loop with 124 ops
[p0, p1]
+80: p2 = getfield_gc(p0, descr=<FieldP pypy.interpreter.pyframe.PyFrame.inst_pycode 96>)
+91: p3 = getfield_gc(p0, descr=<FieldP pypy.interpreter.pyframe.PyFrame.inst_lastblock 80>)
+95: i4 = getfield_gc(p0, descr=<FieldS pypy.interpreter.pyframe.PyFrame.inst_valuestackdepth 104>)
./pytest.py -x ./pypy/objspace/std/test/test_celldict.py
============================================================================================================= test session starts =============================================================================================================
platform linux2 -- Python 2.7.3[pypy-2.2.1-final] -- pytest-2.2.4.dev2
pytest-2.2.4.dev2 from /home/squeaky/workspace/pypy/pytest.pyc
collected 55 items
pypy/objspace/std/test/test_celldict.py ...............F
================================================================================================================== FAILURES ===================================================================================================================
______________________________________________________________________________________________ TestModuleDictImplementation.test_setdefault_fast ______________________________________________________________________________________________