[pypy-svn] r51914 - in pypy/branch/jit-refactoring/pypy/jit: codegen/llgraph rainbow/test

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Feb 28 14:56:01 CET 2008


Author: cfbolz
Date: Thu Feb 28 14:55:59 2008
New Revision: 51914

Modified:
   pypy/branch/jit-refactoring/pypy/jit/codegen/llgraph/llimpl.py
   pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py
Log:
fix a problem with sharing blocks between flow graphs


Modified: pypy/branch/jit-refactoring/pypy/jit/codegen/llgraph/llimpl.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/codegen/llgraph/llimpl.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/codegen/llgraph/llimpl.py	Thu Feb 28 14:55:59 2008
@@ -599,11 +599,26 @@
             block.renamevariables(mapping)
             done[block] = True
 
+def _find_and_set_return_block(graph):
+    returnblocks = {}
+    for block in graph.iterblocks():
+        if block.exits == () and len(block.inputargs) == 1:
+            returnblocks[block] = None
+    assert len(returnblocks) == 1, "ambiguous return block"
+    graph.returnblock = iter(returnblocks).next()
+       
+
 def _buildgraph(graph):
     assert graph.startblock.operations[0].opname == 'debug_assert'
     del graph.startblock.operations[0]
     # rgenop makes graphs that use the same variable in several blocks,
     fixduplicatevars(graph)                             # fix this now
+    # through caching it is possible that parts of another graph are reused
+    # make a copy of the whole graph to no longer share data
+    newgraph = flowmodel.copygraph(graph)
+    graph.__dict__.update(newgraph.__dict__)
+    _find_and_set_return_block(graph)
+    
     flowmodel.checkgraph(graph)
     eliminate_empty_blocks(graph)
     # we cannot call join_blocks(graph) here!  It has a subtle problem:

Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_portal.py	Thu Feb 28 14:55:59 2008
@@ -158,7 +158,6 @@
         assert not res
 
     def test_dfa_compile2(self):
-        py.test.skip("not working yet")
         from pypy.lang.automata.dfa import getautomaton, convertagain, recognizeparts
         more = [convertagain(getautomaton()), convertagain(getautomaton())]
         def main(gets, gets2):



More information about the Pypy-commit mailing list