Author: Remi Meier <remi.me...@gmail.com> Branch: nogil-unsafe-2 Changeset: r90514:9d54936470c4 Date: 2017-03-03 18:43 +0100 http://bitbucket.org/pypy/pypy/changeset/9d54936470c4/
Log: (arigo, remi) WIP with failing test 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 @@ -90,6 +90,7 @@ callback(gc, addr) self.rootstackhook = walk_stack_root + from rpython.rlib.debug import ll_assert, debug_print, debug_start, debug_stop def walk_thread_stack(collect_stack_root, tl): # XXX: only visit if nursery_free was not NULL base = (tl + tl_shadowstack._offset).address[0] @@ -100,6 +101,7 @@ # walk that new thread's shadowstack (XXX: compiler may reorder # without barriers) return + debug_print("walk_stack", base, top) self.rootstackhook(collect_stack_root, base, top) self._walk_thread_stack = walk_thread_stack diff --git a/rpython/translator/c/src/mem.c b/rpython/translator/c/src/mem.c --- a/rpython/translator/c/src/mem.c +++ b/rpython/translator/c/src/mem.c @@ -13,7 +13,7 @@ const char *funcname; }; -static struct pypy_debug_alloc_s *pypy_debug_alloc_list = NULL; +static struct pypy_debug_alloc_s *pypy_debug_alloc_list = NULL; static rpy_spinlock_t pypy_debug_alloc_lock = 0; @@ -35,7 +35,7 @@ { struct pypy_debug_alloc_s **p; if (!addr) - return; + return; rpy_spinlock_acquire(&pypy_debug_alloc_lock); for (p = &pypy_debug_alloc_list; *p; p = &((*p)->next)) if ((*p)->addr == addr) diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py --- a/rpython/translator/c/test/test_standalone.py +++ b/rpython/translator/c/test/test_standalone.py @@ -1432,8 +1432,9 @@ from rpython.rlib import rthread, rposix class X: - def __init__(self, prev): + def __init__(self, prev, i): self.prev = prev + self.i = i class State: pass @@ -1443,7 +1444,13 @@ rthread.gc_thread_start() x = None for i in range(100000000): - x = X(x) + prev_x = x + + x = X(x, i) + + if prev_x is not None: + assert prev_x.i == i - 1 + if i % 5001 == 0: x = None @@ -1467,11 +1474,15 @@ for _ in range(TS): new_thread() + i = 0 while True: + x = X(None, i) time.sleep(0.1) + assert x.i == i #gc.collect() if state.counter == 0: break + i += 1 os.write(1, "all threads done\n") return 0 _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit