Author: ldiekmann Branch: list-strategies Changeset: r47508:8eff389e3bcd Date: 2011-04-27 13:26 +0000 http://bitbucket.org/pypy/pypy/changeset/8eff389e3bcd/
Log: merged default into list-strategies diff --git a/pypy/jit/metainterp/optimizeopt/intutils.py b/pypy/jit/metainterp/optimizeopt/intutils.py --- a/pypy/jit/metainterp/optimizeopt/intutils.py +++ b/pypy/jit/metainterp/optimizeopt/intutils.py @@ -1,4 +1,4 @@ -from pypy.rlib.rarithmetic import ovfcheck, ovfcheck_lshift +from pypy.rlib.rarithmetic import ovfcheck, ovfcheck_lshift, LONG_BIT class IntBound(object): _attrs_ = ('has_upper', 'has_lower', 'upper', 'lower') @@ -20,7 +20,7 @@ def make_lt(self, other): return self.make_le(other.add(-1)) - + def make_ge(self, other): if other.has_lower: if not self.has_lower or other.lower > self.lower: @@ -161,7 +161,8 @@ def lshift_bound(self, other): if self.has_upper and self.has_lower and \ other.has_upper and other.has_lower and \ - other.known_ge(IntBound(0, 0)): + other.known_ge(IntBound(0, 0)) and \ + other.known_lt(IntBound(LONG_BIT, LONG_BIT)): try: vals = (ovfcheck_lshift(self.upper, other.upper), ovfcheck_lshift(self.upper, other.lower), @@ -176,7 +177,8 @@ def rshift_bound(self, other): if self.has_upper and self.has_lower and \ other.has_upper and other.has_lower and \ - other.known_ge(IntBound(0, 0)): + other.known_ge(IntBound(0, 0)) and \ + other.known_lt(IntBound(LONG_BIT, LONG_BIT)): vals = (self.upper >> other.upper, self.upper >> other.lower, self.lower >> other.upper, diff --git a/pypy/jit/metainterp/test/test_intbound.py b/pypy/jit/metainterp/test/test_intbound.py --- a/pypy/jit/metainterp/test/test_intbound.py +++ b/pypy/jit/metainterp/test/test_intbound.py @@ -2,6 +2,7 @@ IntLowerBound, IntUnbounded from copy import copy import sys +from pypy.rlib.rarithmetic import LONG_BIT def bound(a,b): if a is None and b is None: @@ -229,6 +230,12 @@ assert not b10.lshift_bound(b100).has_upper assert not bmax.lshift_bound(b10).has_upper assert b10.lshift_bound(b10).has_upper + + for b in (b10, b100, bmax, IntBound(0, 0)): + for shift_count_bound in (IntBound(7, LONG_BIT), IntBound(-7, 7)): + #assert not b.lshift_bound(shift_count_bound).has_upper + assert not b.rshift_bound(shift_count_bound).has_upper + def test_div_bound(): for _, _, b1 in some_bounds(): diff --git a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py --- a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py +++ b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py @@ -164,9 +164,7 @@ # assert entry_bridge.match_by_id('call', """ p29 = getfield_gc(ConstPtr(ptr28), descr=<GcPtrFieldDescr pypy.objspace.std.celldict.ModuleCell.inst_w_value .*>) - guard_nonnull_class(p29, ConstClass(Function), descr=<Guard17>) - i32 = getfield_gc(p0, descr=<BoolFieldDescr pypy.interpreter.pyframe.PyFrame.inst_is_being_profiled .*>) - guard_false(i32, descr=<Guard18>) + guard_nonnull_class(p29, ConstClass(Function), descr=<Guard18>) p33 = getfield_gc(p29, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_code .*>) guard_value(p33, ConstPtr(ptr34), descr=<Guard19>) p35 = getfield_gc(p29, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_w_func_globals .*>) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit