[pypy-svn] r36297 - in pypy/dist/pypy: rpython/memory/gctransform translator
antocuni at codespeak.net
antocuni at codespeak.net
Mon Jan 8 17:58:42 CET 2007
Author: antocuni
Date: Mon Jan 8 17:58:39 2007
New Revision: 36297
Modified:
pypy/dist/pypy/rpython/memory/gctransform/transform.py
pypy/dist/pypy/translator/unsimplify.py
Log:
(antocuni, arre, pedronis)
Don't take away what you didn't put there.
Modified: pypy/dist/pypy/rpython/memory/gctransform/transform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform/transform.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform/transform.py Mon Jan 8 17:58:39 2007
@@ -5,7 +5,6 @@
from pypy.translator.unsimplify import insert_empty_block
from pypy.translator.unsimplify import insert_empty_startblock
from pypy.translator.unsimplify import starts_with_empty_block
-from pypy.translator.unsimplify import remove_empty_startblock
from pypy.translator.backendopt.support import var_needsgc
from pypy.translator.backendopt import inline
from pypy.translator.backendopt import graphanalyze
@@ -193,8 +192,10 @@
self.links_to_split = {} # link -> vars to pop_alive across the link
# for sanity, we need an empty block at the start of the graph
+ inserted_empty_startblock = False
if not starts_with_empty_block(graph):
insert_empty_startblock(self.translator.annotator, graph)
+ inserted_empty_startblock = True
is_borrowed = self.compute_borrowed_vars(graph)
for block in graph.iterblocks():
@@ -215,8 +216,11 @@
# remove the empty block at the start of the graph, which should
# still be empty (but let's check)
- if starts_with_empty_block(graph):
- remove_empty_startblock(graph)
+ if starts_with_empty_block(graph) and inserted_empty_startblock:
+ old_startblock = graph.startblock
+ graph.startblock.isstartblock = False
+ graph.startblock = graph.startblock.exits[0].target
+ graph.startblock.isstartblock = True
checkgraph(graph)
Modified: pypy/dist/pypy/translator/unsimplify.py
==============================================================================
--- pypy/dist/pypy/translator/unsimplify.py (original)
+++ pypy/dist/pypy/translator/unsimplify.py Mon Jan 8 17:58:39 2007
@@ -51,11 +51,6 @@
and graph.startblock.exitswitch is None
and graph.startblock.exits[0].args == graph.getargs())
-def remove_empty_startblock(graph):
- graph.startblock.isstartblock = False
- graph.startblock = graph.startblock.exits[0].target
- graph.startblock.isstartblock = True
-
def split_block(annotator, block, index, _forcelink=None):
"""return a link where prevblock is the block leading up but excluding the
index'th operation and target is a new block with the neccessary variables
More information about the Pypy-commit
mailing list