Author: Ronan Lamy <[email protected]>
Branch: ssa-flow
Changeset: r74488:d6628fb03af8
Date: 2013-08-15 16:47 +0100
http://bitbucket.org/pypy/pypy/changeset/d6628fb03af8/
Log: Eliminate empty blocks before calling SSA_to_SSI()
diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py
--- a/rpython/flowspace/bytecode.py
+++ b/rpython/flowspace/bytecode.py
@@ -5,7 +5,6 @@
from opcode import EXTENDED_ARG, HAVE_ARGUMENT
import opcode
from rpython.flowspace.argument import Signature
-from rpython.flowspace.flowcontext import BytecodeCorruption
CO_GENERATOR = 0x0020
CO_VARARGS = 0x0004
@@ -27,6 +26,11 @@
kwargname = None
return Signature(argnames, varargname, kwargname)
+
+class BytecodeCorruption(Exception):
+ pass
+
+
class HostCode(object):
"""
A wrapper around a native code object of the host interpreter
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -8,6 +8,7 @@
from rpython.tool.error import source_lines
from rpython.translator.backendopt.ssa import SSA_to_SSI
+from rpython.translator.simplify import eliminate_empty_blocks
from rpython.rlib import rstackovf
from rpython.flowspace.argument import CallSpec
from rpython.flowspace.model import (Constant, Variable, Block, Link,
@@ -17,6 +18,7 @@
from rpython.flowspace.specialcase import (rpython_print_item,
rpython_print_newline)
from rpython.flowspace.operation import op
+from rpython.flowspace.bytecode import BytecodeCorruption
w_None = const(None)
@@ -31,11 +33,10 @@
msg += source_lines(self.ctx.graph, None, offset=self.ctx.last_instr)
return "\n".join(msg)
+
class StopFlowing(Exception):
pass
-class BytecodeCorruption(Exception):
- pass
class SpamBlock(Block):
def __init__(self, framestate):
@@ -87,6 +88,7 @@
if isinstance(w_value, Variable):
w_value.rename(name)
del block.framestate # memory saver
+ eliminate_empty_blocks(graph)
SSA_to_SSI(graph)
# ____________________________________________________________
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit