]> granicus.if.org Git - gc/log
gc
6 years agoEliminate 'there is pointer arithmetic with NULL' cppcheck warning
Ivan Maidanski [Thu, 5 Apr 2018 21:42:29 +0000 (00:42 +0300)]
Eliminate 'there is pointer arithmetic with NULL' cppcheck warning

* extra/msvc_dbg.c (GetDescriptionFromStack): Compare size to 0 instead
of comparing description to NULL; mark format argument as used.
* extra/msvc_dbg.c (backtrace_symbols): Do not call
GetDescriptionFromStack if symbols (description) is NULL but size is
non-zero.

6 years agoExplicitly unblock GC signals on GC initialization
Ivan Maidanski [Thu, 22 Mar 2018 22:09:40 +0000 (01:09 +0300)]
Explicitly unblock GC signals on GC initialization

Issue #175 (bdgwc).

Note: NO_SIGNALS_UNBLOCK_IN_MAIN macro is to be defined manually to
turn off this feature (for a reason).

* include/private/gcconfig.h [GC_NO_PTHREAD_SIGMASK]
(NO_SIGNALS_UNBLOCK_IN_MAIN): New macro.
* pthread_stop_world.c [GC_PTHREADS && !GC_WIN32_THREADS
&& !GC_DARWIN_THREADS && !SN_TARGET_ORBIS && !SN_TARGET_PSP2 && !NACL
&& !GC_OPENBSD_UTHREADS && !NO_SIGNALS_UNBLOCK_IN_MAIN]
(GC_unblock_gc_signals): Define.
* pthread_stop_world.c [GC_PTHREADS && !GC_WIN32_THREADS
&& !GC_DARWIN_THREADS && !SN_TARGET_ORBIS && !SN_TARGET_PSP2 && !NACL
&& !GC_OPENBSD_UTHREADS && !NO_SIGNALS_UNBLOCK_IN_MAIN] (GC_stop_init):
Call GC_unblock_gc_signals; add comment.

6 years agoFix thread_suspend fail for threads registered from key destructor (OS X)
Ivan Maidanski [Fri, 23 Mar 2018 08:13:23 +0000 (11:13 +0300)]
Fix thread_suspend fail for threads registered from key destructor (OS X)

Issue #213 (bdwgc).

* pthread_support.c [GC_DARWIN_THREADS] (GC_register_my_thread):
Reinitialize stop_info.mach_thread if the thread is registered from
the client thread key destructor; add comment.

6 years agoFix assertion violation in DllMain of win32_threads
Ivan Maidanski [Thu, 22 Mar 2018 08:24:04 +0000 (11:24 +0300)]
Fix assertion violation in DllMain of win32_threads

DllMain(DLL_THREAD_ATTACH) might be called for C runtime threads
before main() is launched, so this commit just removes wrong
assertion in DllMain.

* win32_threads.c [!GC_NO_THREADS_DISCOVERY] (GC_DllMain): Remove
entry_count static variable; remove assertion for entry_count and
parallel_initialized values in DLL_THREAD_ATTACH case.

6 years agoFix 'scope of var can be reduced' cppcheck err in enqueue_all_finalizers
Ivan Maidanski [Thu, 15 Mar 2018 20:38:31 +0000 (23:38 +0300)]
Fix 'scope of var can be reduced' cppcheck err in enqueue_all_finalizers
(back-port of commit b82af3a3 from 'master')

* finalize.c [!JAVA_FINALIZATION_NOT_NEEDED]
(GC_enqueue_all_finalizers): Declare curr_fo and real_ptr in the scopes
of their use.

6 years agoFix comment for debug_generic_malloc_inner[_ignore_off_page]
Ivan Maidanski [Thu, 15 Mar 2018 07:41:22 +0000 (10:41 +0300)]
Fix comment for debug_generic_malloc_inner[_ignore_off_page]
(fix of commit 38965f279)

* dbg_mlc.c [DBG_HDRS_ALL] (GC_debug_generic_malloc_inner): Update
comment after adding GC_start_debugging[_inner] call.

6 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Mon, 5 Mar 2018 10:55:41 +0000 (13:55 +0300)]
Update ChangeLog file (v7.6 changes only)

6 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Sun, 4 Mar 2018 15:52:32 +0000 (18:52 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
(a cherry-pick of commit 08a2e0ba from 'release-7_4')

6 years agoFix missing GC_generic_malloc_words_small implementation in new_gc_alloc.h
Ivan Maidanski [Thu, 1 Mar 2018 19:47:22 +0000 (22:47 +0300)]
Fix missing GC_generic_malloc_words_small implementation in new_gc_alloc.h

* include/new_gc_alloc.h (GC_generic_malloc_words_small): Replace
prototype with a macro (that uses GC_generic_malloc); remove FIXME item.

6 years agoFix include gc_gcj.h in thread_local_alloc.c
Ivan Maidanski [Wed, 28 Feb 2018 20:16:36 +0000 (23:16 +0300)]
Fix include gc_gcj.h in thread_local_alloc.c
(back-port of commit 60d9632a from 'master')

The #include for the public GC headers should not contain "include/"
prefix.

* thread_local_alloc.c [GC_GCJ_SUPPORT]: Include "gc_gcj.h" instead of
"include/gc_gcj.h".

6 years agoRemove API symbols renaming in WCC_MAKEFILE
Ivan Maidanski [Wed, 28 Feb 2018 06:27:26 +0000 (09:27 +0300)]
Remove API symbols renaming in WCC_MAKEFILE

GC_is_marked, GC_incr_bytes_allocd, GC_incr_bytes_freed are now
declared as GC_API, the so symbols renaming by the linker is not needed.

GC_generic_malloc_words_small does not exist anymore.

* WCC_MAKEFILE [MAKE_AS_DLL] (gc.dll): Remove "append $*.lnk export"
for GC_is_marked, GC_incr_bytes_allocd, GC_incr_bytes_freed,
GC_generic_malloc_words_small.
* WCC_MAKEFILE (gc.lib): Adjust indentation.
* WCC_MAKEFILE [MAKE_AS_DLL] (gctest.exe): Remove "append $*.lnk import"
for GC_is_marked.
* WCC_MAKEFILE [MAKE_AS_DLL] (test_cpp.exe): Remove
"append $*.lnk import" for GC_incr_bytes_allocd, GC_incr_bytes_freed,
GC_generic_malloc_words_small.

6 years agoTravis CI: Output content of threadkey_test.log
Ivan Maidanski [Wed, 28 Feb 2018 06:21:18 +0000 (09:21 +0300)]
Travis CI: Output content of threadkey_test.log

6 years agoFix typo in AIX macro name
Ivan Maidanski [Wed, 28 Feb 2018 05:26:27 +0000 (08:26 +0300)]
Fix typo in AIX macro name

* include/private/gc_priv.h [AIX] (NEED_FIND_LIMIT): Define macro
(rename AUX to AIX).
* os_dep.c [AIX && !PCR] (GC_SysVGetDataStart): Define function.

6 years agoFix dbg_mlc.c/o file name in documentation
Ivan Maidanski [Tue, 27 Feb 2018 21:35:19 +0000 (00:35 +0300)]
Fix dbg_mlc.c/o file name in documentation

* README.md (Debugging Facilities): Fix file name ("dbg_mlc.c").
* misc.c (GC_debugging_started): Fix file name ("dbg_mlc.o") in
comment.

6 years agoFix missing new-line in GC_INFOLOG_PRINTF call in ABORT_ARG<n>
Ivan Maidanski [Thu, 22 Feb 2018 21:54:02 +0000 (00:54 +0300)]
Fix missing new-line in GC_INFOLOG_PRINTF call in ABORT_ARG<n>

* include/private/gc_priv.h (ABORT_ARG1, ABORT_ARG2, ABORT_ARG3):
Output "\n" after C_fmt by GC_INFOLOG_PRINTF.

6 years agoUpdate AUTHORS file (add Natanael Copa)
Ivan Maidanski [Fri, 2 Mar 2018 17:15:31 +0000 (20:15 +0300)]
Update AUTHORS file (add Natanael Copa)

6 years agoFix gctest with musl libc on s390x
Natanael Copa [Tue, 6 Feb 2018 20:21:23 +0000 (21:21 +0100)]
Fix gctest with musl libc on s390x

Issue #202 (bdwgc).

DEFAULT_STACK_MAYBE_SMALL is only set if PARALLEL_MARK is set, but stack
is too small on musl libc even if PARALLEL_MARK is unset.  We solve this
by detecting musl via NO_GETCONTEXT.

6 years agoFix type of local variables receiving result of PHT_HASH
Ivan Maidanski [Thu, 22 Feb 2018 20:39:38 +0000 (23:39 +0300)]
Fix type of local variables receiving result of PHT_HASH
(back-port of commit 037991eb from 'master')

The variables should be of word type, not int or size_t.

* os_dep.c (GC_write_fault_handler, GC_remove_protection): Change type
of index local variable from size_t to word.
* os_dep.c [MPROTECT_VDB && DARWIN] (catch_exception_raise): Change
type of index local variable from int to word.

6 years agoFix man section number (3)
Ivan Maidanski [Mon, 19 Feb 2018 08:02:12 +0000 (11:02 +0300)]
Fix man section number (3)

Library calls should use section 3 (unlike Programs that use section 1).

* doc/gc.man (TH GC_MALLOC): Change section number from 1L to 3.

6 years agoFix arguments delimiter in pcr_interface.c (PCR)
Ivan Maidanski [Thu, 8 Feb 2018 08:45:57 +0000 (11:45 +0300)]
Fix arguments delimiter in pcr_interface.c (PCR)

* extra/pcr_interface.c (GC_enumerate_block): Replace ';' with ',' in
the arguments list.

6 years agoUpdate AUTHORS file (add Jay Krell)
Ivan Maidanski [Mon, 5 Feb 2018 07:14:09 +0000 (10:14 +0300)]
Update AUTHORS file (add Jay Krell)

6 years agoFix typo in comment in specific.h
Jay Krell [Mon, 5 Feb 2018 07:06:59 +0000 (10:06 +0300)]
Fix typo in comment in specific.h

* include/private/specific.h (tse): Fix a typo ("thread") in comment.

6 years agoFix 'undefined reference to __builtin_unwind_init' linker error (ArmCC)
Jonathan Chambers [Thu, 1 Feb 2018 21:35:49 +0000 (00:35 +0300)]
Fix 'undefined reference to __builtin_unwind_init' linker error (ArmCC)
(part of commit 9379c66 from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* include/private/gcconfig.h (HAVE_BUILTIN_UNWIND_INIT): Do not define
if __ARMCC_VERSION.

6 years agoWorkaround 'address of auto-variable returned' cppcheck error
Ivan Maidanski [Tue, 30 Jan 2018 08:11:45 +0000 (11:11 +0300)]
Workaround 'address of auto-variable returned' cppcheck error
(back-port of commit b51bdee1 from 'master')

* mark_rts.c [CPPCHECK] (GC_approx_sp): Use __builtin_frame_address.

7 years ago[7.6.4] v7.6.4
Ivan Maidanski [Fri, 26 Jan 2018 11:45:31 +0000 (14:45 +0300)]
[7.6.4]

Bump gc version to 7.6.4

* Makefile.am (LIBGC_VER_INFO): Increment revision (change version info
of libgc.so to 4:2:3, change version info of libgccpp.so to 4:1:3).
* README.md: Bump micro version.
* configure.ac (AC_INIT): Likewise.
* include/gc_version.h (GC_TMP_VERSION_MICRO): Likewise.

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Fri, 26 Jan 2018 11:30:43 +0000 (14:30 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoFix 'undeclared identifier USRSTACK' compiler error on OpenBSD-6.2
Peter Wang [Wed, 24 Jan 2018 14:37:23 +0000 (17:37 +0300)]
Fix 'undeclared identifier USRSTACK' compiler error on OpenBSD-6.2
(back-port of commits ef879a90bafc33 from 'master')

Issue #198 (bdwgc).

USRSTACK macro is defined in <machine/vmparam.h> but that is protected
by "ifdef _KERNEL" in <uvm/uvm_param.h>.

* include/private/gcconfig.h [POWERPC && OPENBSD && !GC_OPENBSD_THREADS]
(STACKBOTTOM): Add comment.
* include/private/gcconfig.h [(POWERPC || SPARC || I386 || MIPS
|| HP_PA || ALPHA || ARM32 || SH && !SH4 || X86_64) && OPENBSD
&& !GC_OPENBSD_THREADS] (STACKBOTTOM): Define only if USRSTACK is
defined.
* include/private/gcconfig.h [(POWERPC || SPARC || I386 || MIPS
|| HP_PA || ALPHA || ARM32 || SH && !SH4 || X86_64) && OPENBSD
&& !GC_OPENBSD_THREADS && !USRSTACK] (HEURISTIC2): Define.
* include/private/gcconfig.h [(MIPS || SH && !SH4) && OPENBSD]:
Reformat code.

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Wed, 24 Jan 2018 13:29:26 +0000 (16:29 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Mon, 22 Jan 2018 06:34:28 +0000 (09:34 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
(a cherry-pick of commit 357a28b8 from 'release-7_4')

7 years ago.gitignore: Ignore 'cords' marker file (generated by Makefile.direct)
Ivan Maidanski [Wed, 24 Jan 2018 13:13:26 +0000 (16:13 +0300)]
.gitignore: Ignore 'cords' marker file (generated by Makefile.direct)

7 years agoFix 'cords' parallel build in Makefile.direct
Ivan Maidanski [Tue, 23 Jan 2018 16:28:21 +0000 (19:28 +0300)]
Fix 'cords' parallel build in Makefile.direct

* Makefile.direct (cords): Create empty "cords" file after the last
if_not_there command is executed.
* Makefile.direct (clean): Remove "cords" file.

7 years agoDelete dont_ar_* build intermediate files on make clean (Makefile.direct)
Ivan Maidanski [Tue, 23 Jan 2018 15:31:44 +0000 (18:31 +0300)]
Delete dont_ar_* build intermediate files on make clean (Makefile.direct)

* Makefile.direct (clean): Add "rm dont_ar_*"; reorder items.

7 years ago.gitignore: Ignore dont_ar_* files (generated by Makefile.direct)
Ivan Maidanski [Tue, 23 Jan 2018 15:18:55 +0000 (18:18 +0300)]
.gitignore: Ignore dont_ar_* files (generated by Makefile.direct)

7 years agoFix libgc version which was changed in linkage breaking way (release-7_6)
Ivan Maidanski [Fri, 19 Jan 2018 08:24:31 +0000 (11:24 +0300)]
Fix libgc version which was changed in linkage breaking way (release-7_6)

Issue #197 (bdwgc).

* Makefile.am (LIBGC_VER_INFO): Change from 4:1:2 to 4:1:3 (to bring
the SONAME back to libgc.so.1).

7 years agoUpdate AUTHORS file (add Gustavo Giraldez)
Ivan Maidanski [Thu, 18 Jan 2018 21:55:08 +0000 (00:55 +0300)]
Update AUTHORS file (add Gustavo Giraldez)

7 years agoFix GC allocation mutex in child after a fork
Gustavo Giraldez [Thu, 18 Jan 2018 21:52:25 +0000 (00:52 +0300)]
Fix GC allocation mutex in child after a fork

Even though after a fork the child only inherits the single thread
that called the fork(), if another thread in the parent was attempting
to lock the mutex while being held in fork_child_prepare(), the mutex
will be left in an inconsistent state in the child after the UNLOCK().
This is the case, at least, in Mac OS X and leads to an unusable GC in
the child which will block when attempting to perform any GC operation
that acquires the mutex.

* pthread_support.c [CAN_HANDLE_FORK && USE_PTHREAD_LOCKS]
(fork_child_proc): Add assertion (after UNLOCK) that the lock is not
held actually, and, then, re-initialize GC_allocate_ml; add comments.

7 years agoFix missing EOLn output in threadlibs tool
Ivan Maidanski [Wed, 17 Jan 2018 21:46:38 +0000 (00:46 +0300)]
Fix missing EOLn output in threadlibs tool

* tools/threadlibs.c [GC_OSF1_THREADS] (main): Print "\n" after "-lrt".

7 years agoDo not declare dl_iterate_phdr as weak for DragonFly
Ivan Maidanski [Wed, 17 Jan 2018 08:45:56 +0000 (11:45 +0300)]
Do not declare dl_iterate_phdr as weak for DragonFly

* dyn_load.c [!USE_PROC_FOR_LIBRARIES && __DragonFly__]
(HAVE_DL_ITERATE_PHDR, DL_ITERATE_PHDR_STRONG): Define.

7 years agoFix threadlibs tool to output '-lpthread' for DragonFly
Ivan Maidanski [Wed, 17 Jan 2018 08:43:09 +0000 (11:43 +0300)]
Fix threadlibs tool to output '-lpthread' for DragonFly

* tools/threadlibs.c [GC_FREEBSD_THREADS && (__DragonFly__
|| !__FREEBSD_version)] (main): Print "-lpthread" (as well as for
__FREEBSD_version >= 500000).

7 years agoChange compiler invocation example in gc.man to use dynamic libgc
Ivan Maidanski [Wed, 17 Jan 2018 07:46:56 +0000 (10:46 +0300)]
Change compiler invocation example in gc.man to use dynamic libgc

* doc/gc.man (SYNOPSIS): Replace gc.a to -lgc option in the compiler
(cc) invocation example.

7 years agoAdd note of set_free_space_divisor, set_warn_proc ABI change after gc-7.1
Ivan Maidanski [Wed, 17 Jan 2018 07:42:04 +0000 (10:42 +0300)]
Add note of set_free_space_divisor, set_warn_proc ABI change after gc-7.1

Issue #197 (bdwgc).

GC_set_free_space_divisor() and GC_set_warn_proc() used to return
some value.  But starting from version 7.1alpha2, these API functions
do not return any value.

* include/gc.h (GC_set_free_space_divisor, GC_set_warn_proc): Add
comment that the setter used to returned the old value in gc-7.1 (and
previous versions).

7 years agoTravis CI: Fix ASan build with Clang-4.0 (add sudo)
Ivan Maidanski [Mon, 15 Jan 2018 22:19:01 +0000 (01:19 +0300)]
Travis CI: Fix ASan build with Clang-4.0 (add sudo)

7 years agoTravis CI: Do not use 'trusty' build environment
Ivan Maidanski [Mon, 25 Dec 2017 07:57:58 +0000 (10:57 +0300)]
Travis CI: Do not use 'trusty' build environment
(backport of commit 468ac9bd from 'master')

7 years agoPrevent DATASTART redefinition for NaCl
Ivan Maidanski [Mon, 15 Jan 2018 23:22:37 +0000 (02:22 +0300)]
Prevent DATASTART redefinition for NaCl
(backport of commit 331e3944 from 'master')

* include/private/gcconfig.h [NACL] (NO_PTHREAD_GETATTR_NP): Define.
* include/private/gcconfig.h [I386 && NACL] (OS_TYPE, etext, DATASTART,
_end, DATAEND, STACK_GRAN, HEURISTIC1, NO_PTHREAD_GETATTR_NP,
GETPAGESIZE, MAX_NACL_GC_THREADS): Remove.

7 years agoFix global operator delete definition for C++14 in gc_cpp
Ivan Maidanski [Mon, 15 Jan 2018 05:20:02 +0000 (08:20 +0300)]
Fix global operator delete definition for C++14 in gc_cpp

Issue #195 (bdwgc).

Sized variants of global operator delete should be defined along with
the non-sized ones.  Otherwise compiler might invoke the one from the
standard library (as observed in e.g. Cygwin) leading to a crash.

* gc_cpp.cc [!_MSC_VER && __cplusplus>201103L] (operator delete):
Define sized variant (the size argument is ignored for now).
* gc_cpp.cc [!_MSC_VER && __cplusplus>201103L && GC_OPERATOR_NEW_ARRAY
&& !CPPCHECK] (operator delete[]): Likewise.

7 years agoFix last_reclaimed..gc_no interval comparison to threshold in unmap_old
Ivan Maidanski [Sun, 14 Jan 2018 07:51:06 +0000 (10:51 +0300)]
Fix last_reclaimed..gc_no interval comparison to threshold in unmap_old
(fix commit 14c324f8b)

* allchblk.c [USE_MUNMAP] (GC_unmap_old): Replace
(unsigned short)GC_gc_no-hb_last_reclaimed to
(unsigned short)(GC_gc_no-hb_last_reclaimed) to handle
value wrapping in hb_last_reclaimed (and the truncated GC_gc_no)
correctly.

7 years agoRemove obsolete advice about linking with _DYNAMIC=0 (Linux)
Peter Wang [Fri, 12 Jan 2018 16:50:47 +0000 (19:50 +0300)]
Remove obsolete advice about linking with _DYNAMIC=0 (Linux)

Issue #196 (bdwgc).

The mentioned GCC option is not needed since gc-5.0alpha3 (when
_DYNAMIC symbol was declared as weak in dyn_load.c).
Even more, the advice is problematic for Alpine Linux (and probably
other systems using musl) as building a program with gcc -static
produces a binary containing a _DYNAMIC symbol with a non-zero address,
and forcing the address to 0 causes a crash during GC initialization.

* doc/README.linux: Remove note that static executable should be
linked with the gcc option "-Wl,-defsym,_DYNAMIC=0".

7 years agoFix error code in abort message if sem_wait failed in start_world (NetBSD)
Ivan Maidanski [Wed, 27 Dec 2017 08:09:48 +0000 (11:09 +0300)]
Fix error code in abort message if sem_wait failed in start_world (NetBSD)

* pthread_stop_world.c [GC_NETBSD_THREADS_WORKAROUND] (GC_start_world):
Print errno instead of the value returned by sem_wait if the latter has
failed; remove "code" local variable.

7 years ago[7.6.2] v7.6.2
Ivan Maidanski [Sat, 23 Dec 2017 08:01:34 +0000 (11:01 +0300)]
[7.6.2]

Bump gc version to 7.6.2

* ChangeLog (7.6.2): Set release date.
* Makefile.am (LIBGC_VER_INFO): Increment revision (change version
info of libgc.so to 4:1:2).
* README.md: Bump micro version.
* configure.ac (AC_INIT): Likewise.
* include/gc_version.h (GC_TMP_VERSION_MICRO): Likewise.

7 years agoUpdate ChangeLog file (add gc-7.4.8 release date)
Ivan Maidanski [Fri, 22 Dec 2017 21:05:41 +0000 (00:05 +0300)]
Update ChangeLog file (add gc-7.4.8 release date)

7 years agoUpdate ChangeLog file (add gc-7.2i release date)
Ivan Maidanski [Thu, 21 Dec 2017 21:40:34 +0000 (00:40 +0300)]
Update ChangeLog file (add gc-7.2i release date)

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Tue, 19 Dec 2017 21:53:44 +0000 (00:53 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Tue, 19 Dec 2017 08:10:23 +0000 (11:10 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
(Cherry-pick commit b15b52be from 'release-7_4' branch.)

7 years agoAppveyor CI: Use v7.6 of libatomic_ops
Ivan Maidanski [Sun, 17 Dec 2017 07:47:41 +0000 (10:47 +0300)]
Appveyor CI: Use v7.6 of libatomic_ops

7 years agoTravis CI: Test with ASan and GCC
Ivan Maidanski [Wed, 29 Nov 2017 08:20:04 +0000 (11:20 +0300)]
Travis CI: Test with ASan and GCC
(Cherry-pick commit 03dafe9c from 'master' branch.)

7 years agoEliminate TSan warning about A.dummy in gctest
Ivan Maidanski [Thu, 2 Nov 2017 21:58:18 +0000 (00:58 +0300)]
Eliminate TSan warning about A.dummy in gctest

* tests/test.c (reverse_test_inner): Move A.dummy=17 to
set_print_procs().
* tests/test.c (set_print_procs): Add comment.

7 years agoAvoid 'Unexpected heap growth' fail if compiled by GCC with ASan (gctest)
Ivan Maidanski [Thu, 23 Nov 2017 17:26:02 +0000 (20:26 +0300)]
Avoid 'Unexpected heap growth' fail if compiled by GCC with ASan (gctest)

* tests/test.c [ADDRESS_SANITIZER && !__clang__] (check_heap_stats):
Multiply max_heap_sz by ~1.66.

7 years agoSupport AddressSanitizer (GCC)
Ivan Maidanski [Tue, 21 Nov 2017 08:03:28 +0000 (11:03 +0300)]
Support AddressSanitizer (GCC)
(Cherry-pick commit e8e90817 from 'master' branch.)

* include/private/gcconfig.h [!__has_feature && __SANITIZE_ADDRESS__]
(ADDRESS_SANITIZER): Define.

7 years agoFix 'unknown attribute no_sanitize' compiler warnings for GCC
Ivan Maidanski [Mon, 20 Nov 2017 21:17:51 +0000 (00:17 +0300)]
Fix 'unknown attribute no_sanitize' compiler warnings for GCC
(Cherry-pick commit bba7234a from 'master' branch.)

* include/private/gc_priv.h [!GC_ATTR_NO_SANITIZE_ADDR
&& ADDRESS_SANITIZER && !AO_CLANG_PREREQ(3,8)]
(GC_ATTR_NO_SANITIZE_ADDR): Define to
__attribute__((no_sanitize_address)).
* include/private/gc_priv.h [!GC_ATTR_NO_SANITIZE_MEMORY
&& MEMORY_SANITIZER && !AO_CLANG_PREREQ(3,8)]
(GC_ATTR_NO_SANITIZE_MEMORY): Define to
__attribute__((no_sanitize_memory)).

7 years agoPlace no_sanitize address/memory attributes in a GCC-compliant way
Ivan Maidanski [Mon, 20 Nov 2017 21:10:08 +0000 (00:10 +0300)]
Place no_sanitize address/memory attributes in a GCC-compliant way
(Cherry-pick commit 2914cbff from 'master' branch.)

Now the attributes precede the function prototypes (the format is:
<attribute> void f(void) <body>).

* mark.c (GC_mark_from, GC_push_all_eager): Move
GC_ATTR_NO_SANITIZE_ADDR, GC_ATTR_NO_SANITIZE_MEMORY attributes to the
beginning of the function prototype.
* mach_dep.c (GC_with_callee_saves_pushed): Likewise.
* mark.c [WRAP_MARK_SOME && PARALLEL_MARK] (GC_push_conditional_eager):
Likewise.

7 years agoEliminate UBSan warning of overflow during descr subtraction in mark_from
Ivan Maidanski [Thu, 14 Dec 2017 21:54:04 +0000 (00:54 +0300)]
Eliminate UBSan warning of overflow during descr subtraction in mark_from

There is no unsigned overflow because descr has a negative value
actually when it is subtracted from type_descr.

* mark.c (GC_mark_from): Cast descr to signed_word
in (type_descr-(descr+...)).

7 years agoAdjust AO_HAVE_x check to match AO_fetch_and_add primitive variant used
Ivan Maidanski [Tue, 28 Nov 2017 23:57:28 +0000 (02:57 +0300)]
Adjust AO_HAVE_x check to match AO_fetch_and_add primitive variant used
(fix commit 6043293)

* tests/subthread_create.c: Replace "ifdef AO_HAVE_fetch_and_add" with
"ifdef AO_HAVE_fetch_and_add1".

7 years agoRemove 'ifdef USE_SPIN_LOCK' which is always false in gc_locks.h
Ivan Maidanski [Fri, 10 Nov 2017 15:44:57 +0000 (18:44 +0300)]
Remove 'ifdef USE_SPIN_LOCK' which is always false in gc_locks.h
(fix commit 9a20535)

* include/private/gc_locks.h [!GC_WIN32_THREADS && GC_PTHREADS
&& USE_PTHREAD_LOCKS && !GC_ASSERTIONS && NO_PTHREAD_TRYLOCK
&& USE_SPIN_LOCK] (UNCOND_LOCK): Define to
pthread_mutex_lock(&GC_allocate_ml) instead of GC_lock().

7 years agoDo not enable mprotect-based incremental mode if unmapping is on (gctest)
Ivan Maidanski [Wed, 29 Nov 2017 07:06:34 +0000 (10:06 +0300)]
Do not enable mprotect-based incremental mode if unmapping is on (gctest)
(Cherry-pick commit db26b7e4 from 'master' branch.)

Incremental mode based on mprotect() is not compatible with memory
unmapping for now.

* tests/test.c [!PCR && !GC_WIN32_THREADS && !MAKE_BACK_GRAPH
&& !NO_INCREMENTAL] (main): Do not call GC_enable_incremental() if
MPROTECT_VDB && USE_MUNMAP.

7 years agoEliminate 'value exceeds maximum object size' GCC warning in huge_test
Ivan Maidanski [Wed, 29 Nov 2017 08:44:17 +0000 (11:44 +0300)]
Eliminate 'value exceeds maximum object size' GCC warning in huge_test

* tests/huge_test.c [!GC_ATTR_ALLOC_SIZE] (GC_ATTR_ALLOC_SIZE): Define
to empty (before include gc.h).

7 years agoEliminate 'this statement may fall through' GCC warnings
Ivan Maidanski [Wed, 29 Nov 2017 08:42:47 +0000 (11:42 +0300)]
Eliminate 'this statement may fall through' GCC warnings

* cord/cordprnt.c (extract_conv_spec): Eliminate fall through in
a switch statement.
* cord/tests/de.c (do_command): Replace "fall through:" comment with
"FALLTHRU" formal comment (on a new line).
* win32_threads.c [!GC_PTHREADS && !GC_NO_THREADS_DISCOVERY]
(GC_DllMain): Likewise.

7 years agoFix marking of disclaim-reachable objects in the incremental mode
Petter A. Urkedal [Sun, 3 Dec 2017 11:42:59 +0000 (12:42 +0100)]
Fix marking of disclaim-reachable objects in the incremental mode

Issue #192 (bdwgc).

Unconditional marking is done analogously to marking from uncollectible
blocks, since they are meant to secure access to data for disclaim
notifiers after the data is no longer marked.

* mark.c [ENABLE_DISCLAIM] (GC_push_next_marked_dirty): Honor
MARK_UNCONDITIONALLY when rescanning dirty blocks during incremental
marking.

7 years agoFix data race in do_local_mark when comparing active_count to helper_count
Ivan Maidanski [Fri, 1 Dec 2017 16:38:02 +0000 (19:38 +0300)]
Fix data race in do_local_mark when comparing active_count to helper_count
(Cherry-pick commit 66ae55e3 from 'master' branch.)

* mark.c [PARALLEL_MARK] (has_inactive_helpers): New static function
(which compares GC_active_count to GC_helper_count with the mark lock
held).
* mark.c [PARALLEL_MARK && GC_ASSERTIONS] (GC_do_local_mark): Remove
GC_acquire_mark_lock() with immediate GC_acquire_mark_unlock(); add
the appropriate comment to the function description instead.
* mark.c [PARALLEL_MARK] (GC_do_local_mark): Call has_inactive_helpers()
instead of GC_active_count<GC_helper_count; do not call
has_inactive_helpers() unless local_top>local_mark_stack+1.

7 years agoFix data race in mark_thread when updating mark_no
Ivan Maidanski [Fri, 1 Dec 2017 16:23:13 +0000 (19:23 +0300)]
Fix data race in mark_thread when updating mark_no
(Cherry-pick commit 613ec90c from 'master' branch.)

* mark.c [PARALLEL_MARK] (GC_mark_local, GC_help_marker): Update
description comment; remove GC_acquire_mark_lock() call at the function
beginning; remove GC_release_mark_lock() call on return.
* mark.c [PARALLEL_MARK] (GC_do_parallel_mark): Remove
GC_acquire/release_mark_lock() calls around GC_mark_local() call.
* pthread_support.c [PARALLEL_MARK] (GC_mark_thread): Remove
GC_release_mark_lock() call.
* win32_threads.c [PARALLEL_MARK] (GC_mark_thread): Likewise.

7 years agoFix assertion violation about disabled cancel in try_to_collect_inner
Ivan Maidanski [Wed, 29 Nov 2017 22:10:20 +0000 (01:10 +0300)]
Fix assertion violation about disabled cancel in try_to_collect_inner
(Cherry-pick commit 218bfbfa from 'master' branch.)

* misc.c [!GC_DISABLE_INCREMENTAL && !KEEP_BACK_PTRS]
(GC_enable_incremental): Wrap GC_gcollect_inner and GC_read_dirty calls
into DISABLE/RESTORE_CANCEL.

7 years agoFix data race in make_descriptor when setting explicit_typing_initialized
Ivan Maidanski [Wed, 29 Nov 2017 17:15:49 +0000 (20:15 +0300)]
Fix data race in make_descriptor when setting explicit_typing_initialized
(fix commit 5f350a0)

* typd_mlc.c [AO_HAVE_load_acquire] (GC_explicit_typing_initialized):
Add volatile qualifier.
* typd_mlc.c [AO_HAVE_load_acquire] (GC_make_descriptor): Remove
cast of &GC_explicit_typing_initialized; do not check THREADS macro;
fallback to locked checking of GC_explicit_typing_initialized if
AO_HAVE_store_release is not defined; use AO_store_release to set
GC_explicit_typing_initialized (to true).
* typd_mlc.c (GC_make_descriptor): Reformat code dealing with
GC_explicit_typing_initialized (check whether AO_HAVE_load_acquire is
defined only once).

7 years agoFix lack of barriers to synchronize memory for suspend_handler
Ivan Maidanski [Thu, 23 Nov 2017 23:21:46 +0000 (02:21 +0300)]
Fix lack of barriers to synchronize memory for suspend_handler

pthread_kill is not on the list of functions which synchronize memory.

* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]
(GC_world_is_stopped): Reformat comment.
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]
(GC_suspend_handler_inner): Use AO_load_acquire instead of AO_load
to fetch the value of GC_stop_count; add comment.
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]
(GC_start_world): Use AO_store_release instead of AO_store to reset
GC_world_is_stopped; add comment.

7 years agoFix data race in last_stop_count access (suspend_handler_inner)
Ivan Maidanski [Thu, 23 Nov 2017 17:15:54 +0000 (20:15 +0300)]
Fix data race in last_stop_count access (suspend_handler_inner)
(Cherry-pick commit 11792032 from 'master' branch.)

* include/private/pthread_stop_world.h [!GC_OPENBSD_UTHREADS]
(thread_stop_info.last_stop_count): Do not define if NACL; change the
type from word to AO_t; add volatile qualifier; fix a typo in comment
("GC_stop_count").
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]
(update_last_stop_count): Remove.
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]
(GC_suspend_handler_inner): Replace update_last_stop_count() call with
AO_store_release(&me->stop_info.last_stop_count,my_stop_count).
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]
(GC_suspend_all): Replace p->stop_info.last_stop_count with
AO_load(&p->stop_info.last_stop_count).

7 years agoFix data race in GC_suspend/resume_thread
Ivan Maidanski [Thu, 23 Nov 2017 09:20:18 +0000 (12:20 +0300)]
Fix data race in GC_suspend/resume_thread
(Cherry-pick commits ce09fd557b6576 from 'master' branch.)

* include/private/pthread_support.h [GC_ENABLE_SUSPEND_THREAD
&& !GC_DARWIN_THREADS && !GC_OPENBSD_UTHREADS && !NACL]
(GC_Thread_Rep.suspended_ext): New field.
* include/private/pthread_support.h (SUSPENDED_EXT): Remove macro.
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD
&& !GC_OPENBSD_UTHREADS && !NACL] (GC_suspend_handler_inner): Replace
me->flags & SUSPENDED_EXT with AO_load(&me->suspended_ext).
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD
&& !GC_OPENBSD_UTHREADS && !NACL] (suspend_self_inner): Replace
me->flags & SUSPENDED_EXT with AO_load_acquire(&me->suspended_ext).
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD
&& !GC_OPENBSD_UTHREADS && !NACL] (GC_suspend_thread): Replace
t->flags & SUSPENDED_EXT with t->suspended_ext; replace
t->flags|=SUSPENDED_EXT with AO_store_release(&t->suspended_ext, TRUE);
add comment.
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD
&& !GC_OPENBSD_UTHREADS && !NACL] (GC_resume_thread): Replace
t->flags&=~SUSPENDED_EXT with AO_store(&t->suspended_ext, FALSE).
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD
&& !GC_OPENBSD_UTHREADS && !NACL] (GC_is_thread_suspended,
GC_suspend_all, GC_start_world): Replace t->flags & SUSPENDED_EXT with
t->suspended_ext.
* pthread_support.c (GC_register_my_thread): Remove assertion that uses
SUSPENDED_EXT.

7 years agoFix data race when getting object size in explicitly-typed allocators
Ivan Maidanski [Fri, 10 Nov 2017 17:07:16 +0000 (20:07 +0300)]
Fix data race when getting object size in explicitly-typed allocators

* typd_mlc.c (COMPLEX): Reformat comment.
* typd_mlc.c (GC_malloc_explicitly_typed,
GC_malloc_explicitly_typed_ignore_off_page, GC_calloc_explicitly_typed):
Always use BYTES_TO_GRANULES(GC_size(op)) instead of GC_size_map[lb] to
determine size of the allocated object in granules (because the value
of GC_size_map[lb] might be updated by another thread since the value
use in GC_malloc_kind); add comment.

7 years agoFix data race in a list referenced by A.aa (gctest)
Ivan Maidanski [Fri, 3 Nov 2017 17:08:09 +0000 (20:08 +0300)]
Fix data race in a list referenced by A.aa (gctest)
(Cherry-pick commits 8f5746e0f5a88d from 'master' branch.)

* tests/test.c [!AO_HAVE_load] (AO_load): Remove macro.
* tests/test.c [!AO_HAVE_store] (AO_store): Likewise.
* tests/test.c [!AO_HAVE_load_acquire] (AO_load_acquire): New static
function (which uses FINALIZER_LOCK/FINALIZER_UNLOCK).
* tests/test.c [!AO_HAVE_store_release] (AO_store_release): Likewise.
* tests/test.c [!AO_HAVE_fetch_and_add1] (AO_fetch_and_add1): Add
comment.
* tests/test.c (a_set): Use AO_store_release() instead of AO_store().
* tests/test.c (a_get): Use AO_load_acquire() instead of AO_load().
* tests/test.c (reverse_test_inner): Improve comment about thread
safety of a_set(reverse(reverse(a_get()))).

7 years agoUpdate comment in finalized_disclaim to match FINALIZER_CLOSURE_FLAG
Ivan Maidanski [Wed, 29 Nov 2017 22:24:33 +0000 (01:24 +0300)]
Update comment in finalized_disclaim to match FINALIZER_CLOSURE_FLAG
(fix commit 012da3f)

* fnlz_mlc.c [ENABLE_DISCLAIM] (GC_finalized_disclaim): Update/refine
comment (about the lowest 2 bits of the first word).

7 years agoDocument base and size of objects allocated by finalized_malloc
Ivan Maidanski [Wed, 29 Nov 2017 23:19:10 +0000 (02:19 +0300)]
Document base and size of objects allocated by finalized_malloc

* include/gc_disclaim.h (GC_finalized_malloc): Refine comment (add
a note about GC_base and GC_size).

7 years agoAvoid data race in finalized_count (gctest)
Ivan Maidanski [Fri, 3 Nov 2017 08:03:04 +0000 (11:03 +0300)]
Avoid data race in finalized_count (gctest)

* tests/test.c (FINALIZER_LOCK, FINALIZER_UNLOCK): New macro.
* tests/test.c [GC_PTHREADS] (incr_lock): Move static variable out
of finalizer() and mktree() (use a single lock variable to access
finalized_count in finalizer, mktree and tree_test).
* tests/test.c (dropped_something): Change type back to int; remove
volatile.
* tests/test.c (finalizer, mktree): Use FINALIZER_[UN]LOCK() instead
of PCR_ThCrSec_Enter/ExitSys(), pthread_mutex_[un]lock(),
Enter/LeaveCriticalSection().
* tests/test.c (tree_test): Use FINALIZER_[UN]LOCK() to avoid data
race when accessing finalized_count and dropped_something; do not use
AO_load() and AO_store() to access dropped_something.
* tests/test.c

7 years agoFix typo in a function name in README.sgi
Ivan Maidanski [Thu, 16 Nov 2017 08:20:32 +0000 (11:20 +0300)]
Fix typo in a function name in README.sgi

* doc/README.sgi (4): Fix a typo ("pthread_cond_timedwait").

7 years agoFix typo in 'gcdescr' documentation file
Ivan Maidanski [Fri, 10 Nov 2017 07:33:32 +0000 (10:33 +0300)]
Fix typo in 'gcdescr' documentation file
(Cherry-pick commit 419f4de9 from 'master' branch.)

* doc/gcdescr.html (Allocation): Fix a typo ("the request is rounded").

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Thu, 26 Oct 2017 05:31:47 +0000 (08:31 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.4 changes only)
Ivan Maidanski [Wed, 25 Oct 2017 15:32:35 +0000 (18:32 +0300)]
Update ChangeLog file (v7.4 changes only)

7 years agoTravis CI: Test NO_CLOCK
Ivan Maidanski [Wed, 25 Oct 2017 08:12:34 +0000 (11:12 +0300)]
Travis CI: Test NO_CLOCK

7 years agoRefine should_invoke_finalizers documentation
Ivan Maidanski [Wed, 18 Oct 2017 19:37:30 +0000 (22:37 +0300)]
Refine should_invoke_finalizers documentation

* include/gc.h (GC_should_invoke_finalizers): Add comment that it is
not synchronized.

7 years agoUpdate AUTHORS file (add Erik M. Bray)
Ivan Maidanski [Tue, 17 Oct 2017 08:52:20 +0000 (11:52 +0300)]
Update AUTHORS file (add Erik M. Bray)

7 years agoUse mprotect instead of mmap in GC_unmap() on Cygwin
Erik M. Bray [Tue, 17 Oct 2017 08:50:03 +0000 (11:50 +0300)]
Use mprotect instead of mmap in GC_unmap() on Cygwin

Issue #187 (BDWGC).

* configure.ac [$enable_munmap!="" && $enable_munmap!=no]
(USE_WINALLOC): Replace AC_DEFINE with AH_TEMPLATE; remove comment
about a workaround for Cygwin; remove "if $host=*-*-cygwin*".
* os_dep.c [CYGWIN32 && USE_MUNMAP] (GC_setpagesize): Set GC_page_size
to dwAllocationGranularity (instead of dwPageSize); add comment; add
assertion that dwAllocationGranularity is not less than dwPageSize.
* os_dep.c [USE_MUNMAP && CYGWIN32 && !USE_WINALLOC] (GC_unmap,
GC_unmap_gap): Call mprotect() instead of mmap(); add comment.

7 years agoAllow PKG_CHECK_MODULES in configure.ac to be commented out easily
Ivan Maidanski [Mon, 16 Oct 2017 08:00:53 +0000 (11:00 +0300)]
Allow PKG_CHECK_MODULES in configure.ac to be commented out easily
(Cherry-pick commits 3d34335fbb22e9 from 'master' branch.)

* configure.ac [$with_libatomic_ops!=no && $THREADS!=none]
(missing_libatomic_ops): Set to true (before PKG_CHECK_MODULES).
* configure.ac [$missing_libatomic_ops] (PKG_CHECK_MODULES): Set
missing_libatomic_ops back to false if atomic_ops module is not found;
add comment (about pkg-config and the possibility to comment out
PKG_CHECK_MODULES).

7 years agoNew API function (GC_is_init_called) to check if BDWGC is initialized
Ivan Maidanski [Mon, 16 Oct 2017 07:25:57 +0000 (10:25 +0300)]
New API function (GC_is_init_called) to check if BDWGC is initialized
(Cherry-pick commit 58c5c05 from 'master' branch.)

Issue #186 (bdwgc).

* include/gc.h (GC_is_init_called): New API function declaration.
* misc.c (GC_is_init_called): New API function definition.
* tests/test.c (check_heap_stats): Add a test that GC is initialized.

7 years agoTest GC initialization from non-main thread on FreeBSD and NetBSD
Ivan Maidanski [Thu, 12 Oct 2017 22:38:25 +0000 (01:38 +0300)]
Test GC initialization from non-main thread on FreeBSD and NetBSD

Issue #180 (bdwgc).

* tests/initsecondarythread.c [(FREEBSD || LINUX || NETBSD)
&& !NO_PTHREAD_GETATTR_NP && !NO_PTHREAD_ATTR_GET_NP] (main): Do not
call GC_INIT().

7 years agoFix typos in documentation (for extend_size_map and ews4800)
Ivan Maidanski [Mon, 23 Oct 2017 21:10:12 +0000 (00:10 +0300)]
Fix typos in documentation (for extend_size_map and ews4800)

* doc/README.ews4800: Fix typos ("32-bit", "64-bit").
* misc.c (GC_extend_size_map): Fix typo ("16-byte") in a comment.

7 years ago.gitignore: Do not ignore include/private/config.h
Ivan Maidanski [Tue, 17 Oct 2017 21:20:47 +0000 (00:20 +0300)]
.gitignore: Do not ignore include/private/config.h

config.h was moved to "include" folder in gc-7.4.0.

7 years agoTravis CI: Remove NO_CLONE_LIBATOMIC_OPS for multi-threaded OS X builds
Ivan Maidanski [Thu, 12 Oct 2017 08:13:51 +0000 (11:13 +0300)]
Travis CI: Remove NO_CLONE_LIBATOMIC_OPS for multi-threaded OS X builds
(fix commit 270a547)

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Thu, 12 Oct 2017 08:01:53 +0000 (11:01 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Tue, 10 Oct 2017 22:06:54 +0000 (01:06 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

7 years agoTravis CI: Test also 32-bit build with ASan (on OS X, with unmapping)
Ivan Maidanski [Fri, 6 Oct 2017 18:47:00 +0000 (21:47 +0300)]
Travis CI: Test also 32-bit build with ASan (on OS X, with unmapping)
(Cherry-pick commits 535cf3609c981a from 'master' branch.)

7 years agoTravis CI: Test also with Leak Sanitizer (LSan)
Ivan Maidanski [Fri, 6 Oct 2017 18:31:35 +0000 (21:31 +0300)]
Travis CI: Test also with Leak Sanitizer (LSan)
(Cherry-pick commit 5c8663d from 'master' branch.)

7 years agoSupport GC_init (and get_stack_base) from non-main thread on NetBSD
Ivan Maidanski [Mon, 9 Oct 2017 19:17:15 +0000 (22:17 +0300)]
Support GC_init (and get_stack_base) from non-main thread on NetBSD

Now GC_get_[main_]stack_base uses pthread_getattr_np() and
pthread_attr_getstack() to determine the stack base address on NetBSD.

* include/private/gcconfig.h [NETBSD && !NO_PTHREAD_GETATTR_NP]
(HAVE_PTHREAD_GETATTR_NP): Define.

7 years agoEliminate TSan warnings for all counters and A.aa variable (gctest)
Ivan Maidanski [Mon, 9 Oct 2017 19:07:24 +0000 (22:07 +0300)]
Eliminate TSan warnings for all counters and A.aa variable (gctest)

Now most of the counters in gctest are updated using atomic increment.
And, the values of gctest dropped_something and A.aa variables are
updated and fetch using the atomic primitives.

* tests/test.c [!AO_CLEAR] (AO_t): Define.
* tests/test.c [!AO_HAVE_load] (AO_load): Define (as a non-atomic
operation).
* tests/test.c [!AO_HAVE_store] (AO_store): Likewise.
* tests/test.c [!AO_HAVE_fetch_and_add1] (AO_fetch_and_add1): Likewise.
* tests/test.c (stubborn_count, uncollectable_count,
collectable_count, atomic_count, realloc_count): Change type from int
to AO_t; add volatile qualifier; update comment; remove FIXME.
* tests/test.c (extra_count): Define unconditionally; change type from
int to AO_t; add volatile qualifier; update comment.
* tests/test.c [!VERY_SMALL_CONFIG] (cons): Use AO_fetch_and_add1 to
get and update the values of extra_count and stubborn_count.
* tests/test.c (small_cons_uncollectable): Use AO_fetch_and_add1 to
update the value of uncollectable_count.
* tests/test.c [!DBG_HDRS_ALL] (run_one_test): Likewise.
* tests/test.c [GC_GCJ_SUPPORT] (gcj_cons): Remove obj_cnt static
variable; use extra_count instead of obj_cnt; use AO_fetch_and_add1 to
get and update the value of extra_count.
* tests/test.c (A): Add volatile qualifier; change the type of aa
field from sexpr to AO_t.
* tests/test.c (a): Do not define (and undefine).
* tests/test.c (a_set, a_get): New macro (that uses AO_store/load).
* tests/test.c (reverse_test_inner): Use a_set() and a_get() to store
and fetch the value of a, respectively; use AO_fetch_and_add1 to
update the value of realloc_count.
* tests/test.c (dropped_something): Change type from int to AO_t.
* tests/test.c (counter): Remove.
* tests/test.c (mktree): Use extra_count instead of counter; use
AO_fetch_and_add1 to update the value of extra_count.
* tests/test.c [GC_PTHREADS && !SMALL_CONFIG && !GC_DEBUG]
(alloc8bytes): Use AO_fetch_and_add1 to update the value of
uncollectable_count.
* tests/test.c (alloc_small, run_one_test): Use AO_fetch_and_add1 to
update the value of atomic_count.
* tests/test.c (tree_test): Use AO_load and AO_store to get and set
the value of dropped_something, respectively.
* tests/test.c (check_heap_stats): Cast uncollectable_count,
atomic_count, stubborn_count, realloc_count to int in printf() call.

7 years agoEliminate TSan warnings for print_proc variables assignment (gctest)
Ivan Maidanski [Fri, 6 Oct 2017 08:14:23 +0000 (11:14 +0300)]
Eliminate TSan warnings for print_proc variables assignment (gctest)

Now GC_is_valid_displacement_print_proc and GC_is_visible_print_proc
are set only once (before the first invocation of run_one_test).

* tests/test.c [DBG_HDRS_ALL] (set_print_procs): New macro (defined
to (void)0).
* tests/test.c [!DBG_HDRS_ALL] (set_print_procs): New function (which
sets GC_is_valid_displacement_print_proc and GC_is_visible_print_proc).
* tests/test.c (fail_count, fail_proc1, TEST_FAIL_COUNT): Do not
define if DBG_HDRS_ALL.
* tests/test.c [!DBG_HDRS_ALL] (run_one_test): Do not set
GC_is_valid_displacement_print_proc and GC_is_visible_print_proc.
* tests/test.c (main): Call set_print_procs() before run_one_test().
* tests/test.c [PCR] (test): Likewise.