[pypy-commit] pypy nogil-unsafe-2: make sure we allocate shadow stack

fijal pypy.commits at gmail.com
Tue Jul 11 10:19:48 EDT 2017


Author: fijal
Branch: nogil-unsafe-2
Changeset: r91861:17d925b4fab8
Date: 2017-07-11 16:19 +0200
http://bitbucket.org/pypy/pypy/changeset/17d925b4fab8/

Log:	make sure we allocate shadow stack

diff --git a/rpython/memory/gctransform/shadowstack.py b/rpython/memory/gctransform/shadowstack.py
--- a/rpython/memory/gctransform/shadowstack.py
+++ b/rpython/memory/gctransform/shadowstack.py
@@ -152,6 +152,13 @@
             if tl_shadowstack.get_or_make_raw() == llmemory.NULL:
                 allocate_shadow_stack()
 
+
+        def thread_start():
+            allocate_shadow_stack()
+            tl_synclock.get_or_make_raw()  # reference the field at least once
+
+        thread_start._always_inline_ = True
+
         def allocate_shadow_stack():
             root_stack_depth = 163840
             root_stack_size = sizeofaddr * root_stack_depth
@@ -175,6 +182,8 @@
         self.thread_setup = thread_setup
         self.thread_run_ptr = getfn(thread_run, [], annmodel.s_None,
                                     minimal_transform=False)
+        self.thread_start_ptr = getfn(thread_start, [], annmodel.s_None,
+                                      minimal_transform=False)
         self.thread_die_ptr = getfn(thread_die, [], annmodel.s_None,
                                     minimal_transform=False)
 


More information about the pypy-commit mailing list