]> granicus.if.org Git - gc/commit
Fix data race in GC_init_explicit_typing
authorIvan Maidanski <ivmai@mail.ru>
Tue, 1 Sep 2015 06:57:38 +0000 (09:57 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 29 Jan 2016 13:01:39 +0000 (16:01 +0300)
commit69527f21d06e790a22197ca732580299c832e9ec
tree25129c85c2f193f027f8325713f3b2189ebe5f2f
parentf9d1b7d225d06a312c19be4cbe7cfd1a661035e3
Fix data race in GC_init_explicit_typing

* typd_mlc.c: Force include atomic_ops.h if
GC_FORCE_INCLUDE_ATOMIC_OPS (by default it is included if
PARALLEL_MARK or pthreads are used).
* typd_mlc.c (GC_explicit_typing_initialized): Use AO_t if
AO_load_acquire() available.
* typd_mlc.c (GC_init_explicit_typing): Move locking (and
GC_explicit_typing_initialized access) outside to the caller
(GC_make_descriptor); remove comment; remove "register" keyword for
local variable.
* typd_mlc.c (GC_make_descriptor): Use AO_load_acquire (if available)
to fetch GC_explicit_typing_initialized value (to avoid data race and
avoid lock acquiring on each call).
* typd_mlc.c (GC_explicit_typing_initialized,
GC_malloc_explicitly_typed_ignore_off_page,
GC_calloc_explicitly_typed): Add assertion on
GC_explicit_typing_initialized is true.
typd_mlc.c