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

mwh at codespeak.net mwh at codespeak.net
Fri May 19 18:39:25 CEST 2006


Author: mwh
Date: Fri May 19 18:39:23 2006
New Revision: 27485

Modified:
   pypy/dist/pypy/translator/stackless/frame.py
   pypy/dist/pypy/translator/stackless/transform.py
Log:
AAAAARGH, DO NOT call MixLevelHelperAnnotator.finish() an unbounded number of
times.  This workaround is not especially clean, but the stackless tests pass
so I want to try a translation on snake.  Hopefully it won't take 26 hours :)


Modified: pypy/dist/pypy/translator/stackless/frame.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/frame.py	(original)
+++ pypy/dist/pypy/translator/stackless/frame.py	Fri May 19 18:39:23 2006
@@ -130,7 +130,7 @@
         self.func_or_graph = func_or_graph
         self.frame_types = frame_types
 
-    def compress(self, rtyper):
+    def compress(self, rtyper, mix):
         if self.frame_types:
             bk = rtyper.annotator.bookkeeper
             graph = self.func_or_graph
@@ -148,10 +148,8 @@
             for i in range(len(self.frame_types)):
                 reccopy = self.frame_types[i].reccopy
                 s_header = annmodel.SomePtr(lltype.Ptr(STATE_HEADER))
-                mixlevelannotator = MixLevelHelperAnnotator(rtyper)
-                fnptr = mixlevelannotator.delayedfunction(reccopy, [s_header],
+                fnptr = mix.delayedfunction(reccopy, [s_header],
                                                           s_header)
-                mixlevelannotator.finish()
                 result[i]['reccopy'] = fnptr
         else:
             result = []

Modified: pypy/dist/pypy/translator/stackless/transform.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/transform.py	(original)
+++ pypy/dist/pypy/translator/stackless/transform.py	Fri May 19 18:39:23 2006
@@ -229,6 +229,8 @@
                                            lltype.typeOf(null_state))
         self.c_gc_nocollect = model.Constant("gc_nocollect", lltype.Void)
 
+        self.reccopyannotator = MixLevelHelperAnnotator(translator.rtyper)
+
         # register the prebuilt restartinfos
         for restartinfo in frame.RestartInfo.prebuilt:
             self.register_restart_info(restartinfo)
@@ -574,12 +576,13 @@
 
     def register_restart_info(self, restartinfo):
         rtyper = self.translator.rtyper
-        for frame_info_dict in restartinfo.compress(rtyper):
+        for frame_info_dict in restartinfo.compress(rtyper, self.reccopyannotator):
             self.masterarray1.append(frame_info_dict)
 
     def finish(self):
         # compute the final masterarray by copying over the masterarray1,
         # which is a list of dicts of attributes
+        self.reccopyannotator.finish()
         masterarray = lltype.malloc(frame.FRAME_INFO_ARRAY,
                                     len(self.masterarray1),
                                     immortal=True)



More information about the Pypy-commit mailing list