Skip to content

Instantly share code, notes, and snippets.

@squeaky-pl
Created February 16, 2014 20:07
Show Gist options
  • Save squeaky-pl/9039911 to your computer and use it in GitHub Desktop.
Save squeaky-pl/9039911 to your computer and use it in GitHub Desktop.
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=...)
- guard_not_invalidated(descr=...)
- # the bound check guard on img has been killed (thanks to the asserts)
- i14 = getarrayitem_raw(i10, i8, descr=<ArrayS .>)
- i15 = int_add_ovf(i9, i14)
- guard_no_overflow(descr=...)
- i17 = int_sub(i8, 640)
- # the bound check guard on intimg has been killed (thanks to the asserts)
- i18 = getarrayitem_raw(i11, i17, descr=<ArrayS .>)
- i19 = int_add_ovf(i18, i15)
- guard_no_overflow(descr=...)
- # on 64bit, there is a guard checking that i19 actually fits into 32bit
- ...
- setarrayitem_raw(i11, i8, _, descr=<ArrayS .>)
- i28 = int_add(i8, 1)
- --TICK--
- jump(..., descr=...)
- """)
+
+ if sys.maxint == 2 ** 31 - 1:
+ assert loop.match("""
+ i13 = int_lt(i8, 307200)
+ guard_true(i13, descr=...)
+ guard_not_invalidated(descr=...)
+ # the bound check guard on img has been killed (thanks to the asserts)
+ i14 = getarrayitem_raw(i10, i8, descr=<ArrayS .>)
+ i15 = int_add_ovf(i9, i14)
+ guard_no_overflow(descr=...)
+ i17 = int_sub(i8, 640)
+ # the bound check guard on intimg has been killed (thanks to the asserts)
+ i18 = getarrayitem_raw(i11, i17, descr=<ArrayS .>)
+ i19 = int_add_ovf(i18, i15)
+ guard_no_overflow(descr=...)
+ setarrayitem_raw(i11, i8, _, descr=<ArrayS .>)
+ i28 = int_add(i8, 1)
+ --TICK--
+ jump(..., descr=...)
+ """)
+ elif sys.maxint == 2 ** 63 - 1:
+ assert loop.match("""
+ i13 = int_lt(i8, 307200)
+ guard_true(i13, descr=...)
+ guard_not_invalidated(descr=...)
+ # the bound check guard on img has been killed (thanks to the asserts)
+ i14 = getarrayitem_raw(i10, i8, descr=<ArrayS .>)
+ i15 = int_add(i9, i14)
+ i17 = int_sub(i8, 640)
+ # the bound check guard on intimg has been killed (thanks to the asserts)
+ i18 = getarrayitem_raw(i11, i17, descr=<ArrayS .>)
+ i19 = int_add(i18, i15)
+ # on 64bit, there is a guard checking that i19 actually fits into 32bit
+ ...
+ setarrayitem_raw(i11, i8, _, descr=<ArrayS .>)
+ i28 = int_add(i8, 1)
+ --TICK--
+ jump(..., descr=...)
+ """)
+
def test_array_of_doubles(self):
def main():
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment