[pypy-dev] [pypy-svn] pypy default: port test_intbound_addsub_ge to test_pypy_c_new
Antonio Cuni
anto.cuni at gmail.com
Thu Apr 14 15:01:17 CEST 2011
Hi Hakan,
On 14/04/11 14:53, Hakan Ardo wrote:
>> + def test_intbound_addsub_ge(self):
>> + def main(n):
>> + i, a, b = 0, 0, 0
>> + while i < n:
>> + if i + 5 >= 5:
>> + a += 1
>> + if i - 1 >= -1:
>> + b += 1
>> + i += 1
>> + return (a, b)
>> + #
>> + log = self.run(main, [300], threshold=200)
>> + assert log.result == (300, 300)
>> + loop, = log.loops_by_filename(self.filepath)
>> + assert loop.match("""
>> + i10 = int_lt(i8, i9)
>> + guard_true(i10, descr=...)
>> + # XXX: why do we need ovf check here? If we put a literal "300"
>> + # instead of "n", it disappears
>
> With n==sys.maxint, the operation i+5 would be the one overflowing.
yes, you are right of course. I was just thinking nonsense, but I realized
only after I asked the question :-).
Of course the ovf check needs to be there because we don't specialize the loop
on the value of n. Although it might be cool to be able to do promotion at
applevel, for those who really want :-)
ciao,
Anto
More information about the Pypy-dev
mailing list