Fix data race in GC_init_explicit_typing
(Cherry-pick commits
69527f2,
c0492a7 from 'release-7_4' branch.)
* 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 volatile AO_t if
AO_load_acquire() and AO_store_release() are both 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 and AO_store_release to
set GC_explicit_typing_initialized (to avoid data race and avoid lock
acquiring on each call); otherwise use locked checking of
GC_explicit_typing_initialized.
* 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.