Author: Hakan Ardo <ha...@debian.org> Branch: Changeset: r48685:569f16f25b1b Date: 2011-11-03 09:10 +0100 http://bitbucket.org/pypy/pypy/changeset/569f16f25b1b/
Log: alternative fix that does not rely on interning ints diff --git a/pypy/jit/metainterp/optimizeopt/heap.py b/pypy/jit/metainterp/optimizeopt/heap.py --- a/pypy/jit/metainterp/optimizeopt/heap.py +++ b/pypy/jit/metainterp/optimizeopt/heap.py @@ -43,7 +43,7 @@ optheap.optimizer.ensure_imported(cached_fieldvalue) cached_fieldvalue = self._cached_fields.get(structvalue, None) - if cached_fieldvalue is not fieldvalue: + if not fieldvalue.same_value(cached_fieldvalue): # common case: store the 'op' as lazy_setfield, and register # myself in the optheap's _lazy_setfields_and_arrayitems list self._lazy_setfield = op diff --git a/pypy/jit/metainterp/optimizeopt/optimizer.py b/pypy/jit/metainterp/optimizeopt/optimizer.py --- a/pypy/jit/metainterp/optimizeopt/optimizer.py +++ b/pypy/jit/metainterp/optimizeopt/optimizer.py @@ -145,6 +145,13 @@ return not box.nonnull() return False + def same_value(self, other): + if not other: + return False + if self.is_constant() and other.is_constant(): + return self.box.same_constant(other.box) + return self is other + def make_constant(self, constbox): """Replace 'self.box' with a Const box.""" assert isinstance(constbox, Const) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit