[pypy-svn] r55313 - in pypy/branch/gc+thread/pypy: module/thread/test rpython/memory/gctransform

arigo at codespeak.net arigo at codespeak.net
Tue May 27 19:47:40 CEST 2008


Author: arigo
Date: Tue May 27 19:47:36 2008
New Revision: 55313

Modified:
   pypy/branch/gc+thread/pypy/module/thread/test/test_ll_thread.py
   pypy/branch/gc+thread/pypy/rpython/memory/gctransform/framework.py
Log:
Fix the bug.  Basic tests work now.


Modified: pypy/branch/gc+thread/pypy/module/thread/test/test_ll_thread.py
==============================================================================
--- pypy/branch/gc+thread/pypy/module/thread/test/test_ll_thread.py	(original)
+++ pypy/branch/gc+thread/pypy/module/thread/test/test_ll_thread.py	Tue May 27 19:47:36 2008
@@ -188,5 +188,3 @@
 
 class TestUsingFramework(AbstractThreadTests):
     gcpolicy = 'generation'
-    def getcompiled(self, f, argtypes):
-        py.test.skip("in-progress")

Modified: pypy/branch/gc+thread/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/branch/gc+thread/pypy/rpython/memory/gctransform/framework.py	(original)
+++ pypy/branch/gc+thread/pypy/rpython/memory/gctransform/framework.py	Tue May 27 19:47:36 2008
@@ -863,6 +863,7 @@
 class ShadowStackRootWalker(BaseRootWalker):
     need_root_stack = True
     thread_setup = None
+    collect_stacks_from_other_threads = None
 
     def __init__(self, gctransformer):
         BaseRootWalker.__init__(self, gctransformer)
@@ -913,6 +914,8 @@
             if addr.address[0] != llmemory.NULL:
                 collect_stack_root(gc, addr)
             addr += sizeofaddr
+        if self.collect_stacks_from_other_threads is not None:
+            self.collect_stacks_from_other_threads(collect_stack_root)
 
     def need_thread_support(self):
         from pypy.module.thread import ll_thread    # xxx fish
@@ -1009,7 +1012,21 @@
             # done
             gcdata.active_thread = new_aid
 
+        def collect_stack(aid, stacktop, callback):
+            if stacktop != llmemory.NULL:
+                gc = self.gc
+                end = stacktop - sizeofaddr
+                addr = end.address[0]
+                while addr != end:
+                    if addr.address[0] != llmemory.NULL:
+                        callback(gc, addr)
+                    addr += sizeofaddr
+
+        def collect_more_stacks(callback):
+            gcdata.thread_stacks.foreach(collect_stack, callback)
+
         self.thread_setup = thread_setup
         self.thread_prepare = thread_prepare
         self.thread_run = thread_run
         self.thread_die = thread_die
+        self.collect_stacks_from_other_threads = collect_more_stacks



More information about the Pypy-commit mailing list