[pypy-svn] r27184 - in pypy/dist/pypy: rpython translator/backendopt
arigo at codespeak.net
arigo at codespeak.net
Sat May 13 18:48:22 CEST 2006
Author: arigo
Date: Sat May 13 18:48:21 2006
New Revision: 27184
Modified:
pypy/dist/pypy/rpython/llinterp.py
pypy/dist/pypy/translator/backendopt/propagate.py
Log:
Major headaches for minor clean-ups.
Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py (original)
+++ pypy/dist/pypy/rpython/llinterp.py Sat May 13 18:48:21 2006
@@ -36,9 +36,7 @@
class LLInterpreter(object):
""" low level interpreter working with concrete values. """
- TRACING = True
-
- def __init__(self, typer, heap=lltype):
+ def __init__(self, typer, heap=lltype, tracing=True):
self.bindings = {}
self.typer = typer
self.heap = heap #module that provides malloc, etc for lltypes
@@ -51,7 +49,7 @@
if hasattr(heap, "prepare_graphs_and_create_gc"):
flowgraphs = typer.annotator.translator.graphs
self.gc = heap.prepare_graphs_and_create_gc(self, flowgraphs)
- if self.TRACING:
+ if tracing:
self.tracer = Tracer()
def eval_graph(self, graph, args=()):
Modified: pypy/dist/pypy/translator/backendopt/propagate.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/propagate.py (original)
+++ pypy/dist/pypy/translator/backendopt/propagate.py Sat May 13 18:48:21 2006
@@ -159,7 +159,7 @@
"""do constant folding if the arguments of an operations are constants"""
if analyzer is None:
analyzer = CanfoldAnalyzer(translator)
- lli = LLInterpreter(translator.rtyper)
+ lli = LLInterpreter(translator.rtyper, tracing=False)
llframe = LLFrame(graph, None, lli)
changed = False
for block in graph.iterblocks():
@@ -183,7 +183,7 @@
res = Constant(llframe.getval(op.result))
except (SystemExit, KeyboardInterrupt):
raise
- except:
+ except: # XXXXXXXXXXXXXXXX try to only catch TypeError
continue
log.constantfolding("in graph %s, %s = %s" %
(graph.name, op, res))
@@ -191,7 +191,6 @@
block.operations[i].opname = "same_as"
block.operations[i].args = [res]
changed = True
- block.operations = [op for op in block.operations if op is not None]
if changed:
remove_same_as(graph)
propagate_consts(graph)
@@ -328,10 +327,6 @@
return result
def partial_folding(graph, translator, analyzer=None):
- """this function does constant folding in the following situation:
- a block has a link that leads to it that has only constant args. Then all
- the operations of this block are evaluated and the link leading to the
- block is adjusted according to the resulting value of the exitswitch"""
if do_atmost(1000, partial_folding_once, graph, translator, analyzer):
propagate_consts(graph)
simplify.join_blocks(graph)
More information about the Pypy-commit
mailing list