[pypy-commit] pypy default: Attempt to fix stacklet+thread+asmgcc+callbacks: the ordering

arigo noreply at buildbot.pypy.org
Wed May 15 21:19:55 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r64201:ba2ad0ee741f
Date: 2013-05-15 21:16 +0200
http://bitbucket.org/pypy/pypy/changeset/ba2ad0ee741f/

Log:	Attempt to fix stacklet+thread+asmgcc+callbacks: the ordering was
	wrong, causing self.belongs_to_current_thread to resolve too early
	as the constant "lambda:True".

diff --git a/rpython/memory/gctransform/asmgcroot.py b/rpython/memory/gctransform/asmgcroot.py
--- a/rpython/memory/gctransform/asmgcroot.py
+++ b/rpython/memory/gctransform/asmgcroot.py
@@ -331,6 +331,11 @@
                                            [annmodel.SomeInteger(),
                                             annmodel.SomeAddress()],
                                            annmodel.s_None)
+        #
+        # check that the order of the need_*() is correct for us: if we
+        # need both threads and stacklets, need_thread_support() must be
+        # called first, to initialize self.belongs_to_current_thread.
+        assert not hasattr(self, 'gc_detach_callback_pieces_ptr')
 
     def walk_stack_roots(self, collect_stack_root):
         gcdata = self.gcdata
diff --git a/rpython/memory/gctransform/framework.py b/rpython/memory/gctransform/framework.py
--- a/rpython/memory/gctransform/framework.py
+++ b/rpython/memory/gctransform/framework.py
@@ -236,9 +236,10 @@
         # thread support
         if translator.config.translation.continuation:
             root_walker.stacklet_support = True
-            root_walker.need_stacklet_support(self, getfn)
         if translator.config.translation.thread:
             root_walker.need_thread_support(self, getfn)
+        if root_walker.stacklet_support:
+            root_walker.need_stacklet_support(self, getfn)
 
         self.layoutbuilder.encode_type_shapes_now()
 


More information about the pypy-commit mailing list