[pypy-commit] pypy default: Add a comment describing the complex reason for why the two
arigo
noreply at buildbot.pypy.org
Fri Mar 27 19:51:32 CET 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r76600:b9c118ee7033
Date: 2015-03-27 19:51 +0100
http://bitbucket.org/pypy/pypy/changeset/b9c118ee7033/
Log: Add a comment describing the complex reason for why the two
int_add_ovf() here cannot overflow
diff --git a/pypy/module/pypyjit/test_pypy_c/test_array.py b/pypy/module/pypyjit/test_pypy_c/test_array.py
--- a/pypy/module/pypyjit/test_pypy_c/test_array.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_array.py
@@ -94,13 +94,25 @@
guard_not_invalidated(descr=...)
# the bound check guard on img has been killed (thanks to the asserts)
i14 = getarrayitem_raw(i10, i8, descr=<ArrayS .>)
+ # advanced: the following int_add cannot overflow, because:
+ # - i14 fits inside 32 bits
+ # - i9 fits inside 33 bits, because:
+ # - it comes from the previous iteration's i15
+ # - prev i19 = prev i18 + prev i15
+ # - prev i18 fits inside 32 bits
+ # - prev i19 is guarded to fit inside 32 bits
+ # - so as a consequence, prev i15 fits inside 33 bits
+ # the new i15 thus fits inside "33.5" bits, which is enough to
+ # guarantee that the next int_add(i18, i15) cannot overflow either...
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
- ...
+ # guard checking that i19 actually fits into 32bit
+ i20 = int_signext(i19, 4)
+ i65 = int_ne(i20, i19)
+ guard_false(i65, descr=...)
setarrayitem_raw(i11, i8, _, descr=<ArrayS .>)
i28 = int_add(i8, 1)
--TICK--
More information about the pypy-commit
mailing list