Author: Remi Meier <remi.me...@gmail.com> Branch: nogil-unsafe-2 Changeset: r90491:e5602c37c2a3 Date: 2017-03-02 16:24 +0100 http://bitbucket.org/pypy/pypy/changeset/e5602c37c2a3/
Log: (arigo, remi) make exception data thread-local diff --git a/rpython/memory/gctypelayout.py b/rpython/memory/gctypelayout.py --- a/rpython/memory/gctypelayout.py +++ b/rpython/memory/gctypelayout.py @@ -432,6 +432,12 @@ appendto = self.addresses_of_static_ptrs else: return + elif hasattr(TYPE, "_hints") and TYPE._hints.get('is_excdata'): + # The exception data's value object is skipped: it's a thread- + # local data structure. We assume that objects are stored only + # temporarily there, so it is always cleared at the point where we + # collect the roots. + return else: appendto = self.addresses_of_static_ptrs_in_nongc for a in gc_pointers_inside(value, adr, mutable_only=True): 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 @@ -1442,7 +1442,7 @@ def bootstrap(): rthread.gc_thread_start() x = None - for i in range(1000000): + for i in range(100000): x = X(x) state.lock.acquire(True) @@ -1458,7 +1458,7 @@ def entry_point(argv): os.write(1, "hello world\n") # start 5 new threads - TS = 30 + TS = 100 state.lock = rthread.allocate_lock() state.counter = TS @@ -1466,7 +1466,7 @@ new_thread() while True: - time.sleep(0.5) + time.sleep(0.1) gc.collect() if state.counter == 0: break diff --git a/rpython/translator/exceptiontransform.py b/rpython/translator/exceptiontransform.py --- a/rpython/translator/exceptiontransform.py +++ b/rpython/translator/exceptiontransform.py @@ -452,7 +452,8 @@ def setup_excdata(self): EXCDATA = lltype.Struct('ExcData', ('exc_type', self.lltype_of_exception_type), - ('exc_value', self.lltype_of_exception_value)) + ('exc_value', self.lltype_of_exception_value), + hints={'thread_local': True, 'is_excdata': True}) self.EXCDATA = EXCDATA exc_data = lltype.malloc(EXCDATA, immortal=True) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit