[pypy-commit] pypy default: Merge the fixed stacklet branch.
arigo
noreply at buildbot.pypy.org
Sun Aug 28 12:24:34 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r46860:8d94b3f39fb7
Date: 2011-08-28 12:22 +0200
http://bitbucket.org/pypy/pypy/changeset/8d94b3f39fb7/
Log: Merge the fixed stacklet branch.
diff --git a/pypy/rlib/_stacklet_shadowstack.py b/pypy/rlib/_stacklet_shadowstack.py
--- a/pypy/rlib/_stacklet_shadowstack.py
+++ b/pypy/rlib/_stacklet_shadowstack.py
@@ -13,6 +13,7 @@
# We still have the old shadowstack active at this point; save it
# away, and start a fresh new one
oldsuspstack = gcrootfinder.oldsuspstack
+ h = llmemory.cast_ptr_to_adr(h)
llop.gc_save_current_state_away(lltype.Void,
oldsuspstack, h)
llop.gc_start_fresh_new_state(lltype.Void)
@@ -50,6 +51,7 @@
# away, and restore the new one
if oldsuspstack:
ll_assert(not _c.is_empty_handle(h),"unexpected empty stacklet handle")
+ h = llmemory.cast_ptr_to_adr(h)
llop.gc_save_current_state_away(lltype.Void, oldsuspstack, h)
else:
ll_assert(_c.is_empty_handle(h),"unexpected non-empty stacklet handle")
diff --git a/pypy/rpython/memory/gctransform/shadowstack.py b/pypy/rpython/memory/gctransform/shadowstack.py
--- a/pypy/rpython/memory/gctransform/shadowstack.py
+++ b/pypy/rpython/memory/gctransform/shadowstack.py
@@ -162,7 +162,7 @@
# We are in the child process. Assumes that only the
# current thread survived, so frees the shadow stacks
# of all the other ones.
- gcdata.thread_stacks.clear()
+ gcdata.thread_stacks = None
# Finally, reset the stored thread IDs, in case it
# changed because of fork(). Also change the main
# thread to the current one (because there is not any
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
@@ -1019,6 +1019,27 @@
'5 ok']
+ def test_gc_with_fork_without_threads(self):
+ from pypy.rlib.objectmodel import invoke_around_extcall
+ if not hasattr(os, 'fork'):
+ py.test.skip("requires fork()")
+
+ def entry_point(argv):
+ childpid = os.fork()
+ if childpid == 0:
+ print "Testing..."
+ else:
+ pid, status = os.waitpid(childpid, 0)
+ assert pid == childpid
+ assert status == 0
+ print "OK."
+ return 0
+
+ t, cbuilder = self.compile(entry_point)
+ data = cbuilder.cmdexec('')
+ print repr(data)
+ assert data.startswith('Testing...\nOK.')
+
def test_thread_and_gc_with_fork(self):
# This checks that memory allocated for the shadow stacks of the
# other threads is really released when doing a fork() -- or at
More information about the pypy-commit
mailing list