]> 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>
Tue, 1 Sep 2015 06:57:38 +0000 (09:57 +0300)
commit5f350a0c66186cce067ba1cdec9208bc43a4fdd9
treea2dea960ef8893911fa30afb92035ab1064137cb
parentbfe78991e3868983f1840270b8dbbfb2d9606a38
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