[pypy-svn] r66183 - in pypy/branch/pyjitpl5/pypy/jit/metainterp: . test
arigo at codespeak.net
arigo at codespeak.net
Sun Jul 12 13:28:32 CEST 2009
Author: arigo
Date: Sun Jul 12 13:28:32 2009
New Revision: 66183
Modified:
pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize4.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimize4.py
Log:
Test and fix.
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize4.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize4.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize4.py Sun Jul 12 13:28:32 2009
@@ -117,10 +117,14 @@
for old_loop in old_loops:
if perfect_specializer.match(old_loop):
# xxx slow, maybe
+ # XXX the next loop is a big hack. Ideally it should set cls=None
+ # to prevent assuming something about the cls -- but only if there
+ # is no code in the previous loop that checks the cls.
for node in perfect_specializer.nodes.values():
if node.startbox:
node.cls = None
assert not node.virtual
+ perfect_specializer.propagate_escapes()
perfect_specializer.adapt_for_match(old_loop)
perfect_specializer.optimize_loop()
return old_loop
@@ -144,7 +148,7 @@
node = InstanceNode(box, escaped=True, const=True)
else:
assert self._allow_automatic_node_creation
- node = InstanceNode(box, escaped=False, startbox=True)
+ node = InstanceNode(box, escaped=True, startbox=True)
self.nodes[box] = node
return node
@@ -266,6 +270,9 @@
if isinstance(other_box, Box):
self.nodes[box].add_to_dependency_graph(self.nodes[other_box],
self.dependency_graph)
+ self.propagate_escapes()
+
+ def propagate_escapes(self):
# XXX find efficient algorithm, we're too fried for that by now
done = False
while not done:
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimize4.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimize4.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimize4.py Sun Jul 12 13:28:32 2009
@@ -881,3 +881,22 @@
# It is ok to reorder just the 'getfield_gc[n1], n2' operation,
# but the three remaining getfields/setfields *must* be in that order.
equaloplists(spec.loop.operations, P.ops)
+
+# ____________________________________________________________
+
+class Q:
+ locals().update(A.__dict__) # :-)
+ ops = [
+ ResOperation('new_with_vtable', [ConstAddr(node_vtable, cpu)], n1,
+ size_of_node),
+ ResOperation('setfield_gc', [n2, n1], None, ofs_next),
+ ResOperation('jump', [], None),
+ ]
+
+def test_Q_find_nodes():
+ spec = PerfectSpecializer(Loop(None, Q.ops))
+ spec.find_nodes()
+ spec.propagate_escapes()
+ # 'n2' should be marked as 'escaped', so that 'n1' is too
+ assert spec.nodes[Q.n2].escaped
+ assert spec.nodes[Q.n1].escaped
More information about the Pypy-commit
mailing list