[pypy-svn] pypy default: Wrong, un-revert the previous checkin. It was correct, and

arigo commits-noreply at bitbucket.org
Wed Feb 2 16:33:34 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r41565:a5669fad99a4
Date: 2011-02-01 15:30 +0100
http://bitbucket.org/pypy/pypy/changeset/a5669fad99a4/

Log:	Wrong, un-revert the previous checkin. It was correct, and the
	error was actually in the test, which missed calls to the correct
	ll_thread.gc_thread_xxx() operations.

diff --git a/pypy/translator/c/test/test_standalone.py b/pypy/translator/c/test/test_standalone.py
--- a/pypy/translator/c/test/test_standalone.py
+++ b/pypy/translator/c/test/test_standalone.py
@@ -832,6 +832,7 @@
             ll_thread.release_NOAUTO(state.ll_lock)
         def after():
             ll_thread.acquire_NOAUTO(state.ll_lock, True)
+            ll_thread.gc_thread_run()
 
         class Cons:
             def __init__(self, head, tail):
@@ -841,6 +842,7 @@
         def bootstrap():
             state.xlist.append(Cons(123, Cons(456, None)))
             gc.collect()
+            ll_thread.gc_thread_die()
 
         def entry_point(argv):
             os.write(1, "hello world\n")
@@ -850,13 +852,18 @@
             state.ll_lock = ll_thread.allocate_ll_lock()
             after()
             invoke_around_extcall(before, after)
+            ll_thread.gc_thread_prepare()
             ident1 = ll_thread.start_new_thread(bootstrap, ())
+            ll_thread.gc_thread_prepare()
             ident2 = ll_thread.start_new_thread(bootstrap, ())
             #
             gc.collect()
             #
+            ll_thread.gc_thread_prepare()
             ident3 = ll_thread.start_new_thread(bootstrap, ())
+            ll_thread.gc_thread_prepare()
             ident4 = ll_thread.start_new_thread(bootstrap, ())
+            ll_thread.gc_thread_prepare()
             ident5 = ll_thread.start_new_thread(bootstrap, ())
             # wait for the 5 threads to finish
             while True:

diff --git a/pypy/rpython/memory/gctransform/framework.py b/pypy/rpython/memory/gctransform/framework.py
--- a/pypy/rpython/memory/gctransform/framework.py
+++ b/pypy/rpython/memory/gctransform/framework.py
@@ -1451,7 +1451,7 @@
             gcdata.active_thread = new_aid
 
         def collect_stack(aid, stacktop, callback):
-            if stacktop != llmemory.NULL and aid != get_aid():
+            if stacktop != llmemory.NULL and aid != gcdata.active_thread:
                 # collect all valid stacks from the dict (the entry
                 # corresponding to the current thread is not valid)
                 gc = self.gc
@@ -1463,6 +1463,8 @@
                     addr += sizeofaddr
 
         def collect_more_stacks(callback):
+            ll_assert(get_aid() == gcdata.active_thread,
+                      "collect_more_stacks(): invalid active_thread")
             gcdata.thread_stacks.foreach(collect_stack, callback)
 
         def _free_if_not_current(aid, stacktop, _):


More information about the Pypy-commit mailing list