[pypy-svn] r32262 - in pypy/dist/pypy: jit/timeshifter translator translator/backendopt

pedronis at codespeak.net pedronis at codespeak.net
Wed Sep 13 15:46:14 CEST 2006


Author: pedronis
Date: Wed Sep 13 15:46:12 2006
New Revision: 32262

Modified:
   pypy/dist/pypy/jit/timeshifter/timeshift.py
   pypy/dist/pypy/translator/backendopt/support.py
   pypy/dist/pypy/translator/unsimplify.py
Log:
kill the strange dontshuffle kw argument, instead use a different helper
split_block_at_start, that reuses the other through a "private" kw 
argument.
 


Modified: pypy/dist/pypy/jit/timeshifter/timeshift.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/timeshift.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/timeshift.py	Wed Sep 13 15:46:12 2006
@@ -10,7 +10,7 @@
 from pypy.jit.timeshifter import rtimeshift
 from pypy.jit.timeshifter.rtyper import HintRTyper, originalconcretetype
 from pypy.jit.timeshifter.rtyper import GreenRepr, RedRepr, HintLowLevelOpList
-from pypy.translator.unsimplify import varoftype, copyvar
+from pypy.translator.unsimplify import varoftype, copyvar, split_block_at_start
 from pypy.translator.backendopt import support
 from pypy.translator.c import exceptiontransform
 from pypy.jit.codegen import model as cgmodel
@@ -406,9 +406,7 @@
             # simple non-merging and non-returning case: nothing to do 
             return
 
-        support.split_block_with_keepalive(block, 0,
-                                           annotator=self.hannotator,
-                                           dontshuffle=True)
+        split_block_at_start(self.hannotator, block)
         before_block = block
         newinputargs = before_block.inputargs
         llops = HintLowLevelOpList(self)

Modified: pypy/dist/pypy/translator/backendopt/support.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/support.py	(original)
+++ pypy/dist/pypy/translator/backendopt/support.py	Wed Sep 13 15:46:12 2006
@@ -71,10 +71,8 @@
 
 def split_block_with_keepalive(block, index_operation,
                                keep_alive_op_args=True,
-                               annotator=None,
-                               dontshuffle=False):
-    splitlink = split_block(annotator, block, index_operation,
-                            dontshuffle=dontshuffle)
+                               annotator=None):
+    splitlink = split_block(annotator, block, index_operation)
     afterblock = splitlink.target
     conservative_keepalives = needs_conservative_livevar_calculation(block)
     if conservative_keepalives:

Modified: pypy/dist/pypy/translator/unsimplify.py
==============================================================================
--- pypy/dist/pypy/translator/unsimplify.py	(original)
+++ pypy/dist/pypy/translator/unsimplify.py	Wed Sep 13 15:46:12 2006
@@ -56,7 +56,7 @@
     graph.startblock = graph.startblock.exits[0].target
     graph.startblock.isstartblock = True
 
-def split_block(annotator, block, index, dontshuffle=False):
+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 
     passed on.  NOTE: if you call this after rtyping, you WILL need to worry
@@ -100,14 +100,12 @@
     exitswitch = get_new_name(block.exitswitch)
     #the new block gets all the attributes relevant to outgoing links
     #from block the old block
-    if not dontshuffle:
-        linkargs = varmap.keys()
-        newinputargs = varmap.values()
-    else:
+    if _forcelink is not None:
         assert index == 0
-        linkargs = list(block.inputargs)
-        newinputargs = [get_new_name(v) for v in linkargs]
-    newblock = Block(newinputargs)
+        linkargs = list(_forcelink)
+    else:
+        linkargs = varmap.keys()
+    newblock = Block([get_new_name(v) for v in linkargs])
     newblock.operations = moved_operations
     newblock.recloseblock(*links)
     newblock.exitswitch = exitswitch
@@ -119,6 +117,11 @@
     block.exc_handler = False
     return link
 
+def split_block_at_start(annotator, block):
+    # split before the first op, preserve order and inputargs
+    # in the second block!
+    return split_block(annotator, block, 0, _forcelink=block.inputargs)
+
 def remove_direct_loops(annotator, graph):
     """This is useful for code generators: it ensures that no link has
     common input and output variables, which could occur if a block's exit



More information about the Pypy-commit mailing list