[pypy-svn] r47579 - in pypy/dist/pypy/rpython: . memory

arigo at codespeak.net arigo at codespeak.net
Fri Oct 19 14:19:00 CEST 2007


Author: arigo
Date: Fri Oct 19 14:18:58 2007
New Revision: 47579

Modified:
   pypy/dist/pypy/rpython/llinterp.py
   pypy/dist/pypy/rpython/memory/gcwrapper.py
Log:
This fixes the tracer for destructor invocations from gcwrapper.


Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py	(original)
+++ pypy/dist/pypy/rpython/llinterp.py	Fri Oct 19 14:18:58 2007
@@ -57,11 +57,12 @@
         if tracing:
             self.tracer = Tracer()
 
-    def eval_graph(self, graph, args=()):
+    def eval_graph(self, graph, args=(), recursive=False):
         llframe = self.frame_class(graph, args, self)
-        if self.tracer:
+        if self.tracer and not recursive:
             self.tracer.start()
         retval = None
+        old_active_frame = self.active_frame
         try:
             try:
                 retval = llframe.eval()
@@ -82,10 +83,12 @@
                     self.tracer.dump(line + '\n')
                 raise
         finally:
+            self.active_frame = old_active_frame
             if self.tracer:
                 if retval is not None:
                     self.tracer.dump('   ---> %r\n' % (retval,))
-                self.tracer.stop()
+                if not recursive:
+                    self.tracer.stop()
         return retval
 
     def print_traceback(self):

Modified: pypy/dist/pypy/rpython/memory/gcwrapper.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gcwrapper.py	(original)
+++ pypy/dist/pypy/rpython/memory/gcwrapper.py	Fri Oct 19 14:18:58 2007
@@ -122,16 +122,12 @@
 
         assert not type_contains_pyobjs(TYPE), "not implemented"
         def ll_finalizer(addr):
-            old_active_frame = self.llinterp.active_frame
             try:
-                try:
-                    v = llmemory.cast_adr_to_ptr(addr, DESTR_ARG)
-                    self.llinterp.eval_graph(destrgraph, [v])
-                except llinterp.LLException:
-                    raise RuntimeError(
-                        "a finalizer raised an exception, shouldn't happen")
-            finally:
-                self.llinterp.active_frame = old_active_frame
+                v = llmemory.cast_adr_to_ptr(addr, DESTR_ARG)
+                self.llinterp.eval_graph(destrgraph, [v], recursive=True)
+            except llinterp.LLException:
+                raise RuntimeError(
+                    "a finalizer raised an exception, shouldn't happen")
         return ll_finalizer
 
 



More information about the Pypy-commit mailing list