[pypy-svn] pypy jit-short_from_state: Make _lazy_setfield invalidate _cached_fields_getfield_op when it is not None. This way a lazy setfield that was canceled because the original value was written later will not clear the cache at the loop boundary.
hakanardo
commits-noreply at bitbucket.org
Fri Apr 22 09:43:46 CEST 2011
Author: Hakan Ardo <hakan at debian.org>
Branch: jit-short_from_state
Changeset: r43527:f1a2f92171de
Date: 2011-04-22 09:42 +0200
http://bitbucket.org/pypy/pypy/changeset/f1a2f92171de/
Log: Make _lazy_setfield invalidate _cached_fields_getfield_op when it is
not None. This way a lazy setfield that was canceled because the
original value was written later will not clear the cache at the
loop boundary.
diff --git a/pypy/jit/metainterp/test/test_optimizeopt.py b/pypy/jit/metainterp/test/test_optimizeopt.py
--- a/pypy/jit/metainterp/test/test_optimizeopt.py
+++ b/pypy/jit/metainterp/test/test_optimizeopt.py
@@ -5001,6 +5001,8 @@
"""
expected = """
[p0]
+ p1 = getfield_gc(p0, descr=valuedescr)
+ setfield_gc(p0, p0, descr=valuedescr)
jump(p0)
"""
self.optimize_loop(ops, expected, preamble)
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
@@ -38,10 +38,6 @@
if cached_fieldvalue is not fieldvalue:
# common case: store the 'op' as lazy_setfield, and register
# myself in the optheap's _lazy_setfields list
- try:
- del self._cached_fields_getfield_op[structvalue]
- except KeyError:
- pass
self._lazy_setfield = op
if not self._lazy_setfield_registered:
optheap._lazy_setfields.append(self)
@@ -110,6 +106,8 @@
def produce_potential_short_preamble_ops(self, optimizer,
potential_ops, descr):
+ if self._lazy_setfield is not None:
+ return
for structvalue, op in self._cached_fields_getfield_op.iteritems():
if op and structvalue in self._cached_fields:
potential_ops[op.result] = op
More information about the Pypy-commit
mailing list