[pypy-svn] r25566 - pypy/dist/pypy/translator/stackless

hpk at codespeak.net hpk at codespeak.net
Sat Apr 8 18:19:52 CEST 2006


Author: hpk
Date: Sat Apr  8 18:19:51 2006
New Revision: 25566

Modified:
   pypy/dist/pypy/translator/stackless/transform.py
Log:
(mwh, hpk) some more support for actually getting to issue the resume handling code 
at the start of a block ... 



Modified: pypy/dist/pypy/translator/stackless/transform.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/transform.py	(original)
+++ pypy/dist/pypy/translator/stackless/transform.py	Sat Apr  8 18:19:51 2006
@@ -71,6 +71,11 @@
         
 ##     return retval + x + 1
 
+class ResumePoint:
+    def __init__(self, var_result, varstoload, targetblock):
+        self.var_result = var_result
+        self.varstoload = varstoload 
+        self.targetblock = targetblock 
 
 class StacklessTransfomer(object):
     def __init__(self, translator):
@@ -141,11 +146,16 @@
         
         for block in list(graph.iterblocks()):
             self.transform_block(block)
+
         if self.resume_points:
-            XXX
+            self.insert_resume_handling(graph)
 
         self.curr_graph = None
 
+    def insert_resume_handling(self, graph):
+        #graph.startblock.isstartblock = False 
+        pass
+
     def transform_block(self, block):
         i = 0
 
@@ -160,10 +170,13 @@
                                                           self.curr_graph, block, i+1)
                 var_unwind_exception = varoftype(evalue)
                
-                args = [v for v in link.args if v is not op.result]
+                args = [v for v in link.args 
+                            if v is not op.result and v.concretetype is not lltype.Void]
                 save_block = self.generate_save_block(
                                 args, var_unwind_exception)
 
+                self.resume_points.append(ResumePoint(op.result, args, link.target))
+
                 newlink = model.Link(args + [var_unwind_exception], 
                                      save_block, code.UnwindException)
                 block.exitswitch = model.c_last_exception
@@ -179,7 +192,6 @@
                 i += 1
 
     def generate_save_block(self, varstosave, var_unwind_exception):
-        varstosave = [v for v in varstosave if v.concretetype is not lltype.Void]
         rtyper = self.translator.rtyper
         edata = rtyper.getexceptiondata()
         etype = edata.lltype_of_exception_type



More information about the Pypy-commit mailing list