Ivan Maidanski [Wed, 26 Dec 2018 08:01:21 +0000 (11:01 +0300)]
Update ChangeLog file
Jonas Echterhoff [Tue, 18 Dec 2018 10:14:55 +0000 (11:14 +0100)]
Use atomics on PS4
(a cherry-pick of commit
46615fe1d from Unity-Technologies/bdwgc)
* include/private/gc_priv.h [THREADS && SN_TARGET_ORBIS]: Include
gc_atomic_ops.h too.
Ivan Maidanski [Sun, 23 Dec 2018 20:22:11 +0000 (23:22 +0300)]
Update ChangeLog file (set v8.0.2 release date)
Ivan Maidanski [Sun, 23 Dec 2018 08:56:50 +0000 (11:56 +0300)]
Update ChangeLog file (v8.0 changes)
Ivan Maidanski [Sun, 23 Dec 2018 17:20:56 +0000 (20:20 +0300)]
Update libgc.so version info to differentiate against v8.0.x
There are no API/implementation changes in libcord and libgccpp against
release-8_0 for now, so the corresponding version info is not updated.
There are some implementation changes and new API functions addition in
libgc (without API incompatible changes) against release-8_0, so the
"current" and "age" parts of the version info are incremented.
* Makefile.am (LIBGC_VER_INFO): Change version info to 6:0:5.
Ivan Maidanski [Sun, 23 Dec 2018 07:50:15 +0000 (10:50 +0300)]
Turn on memory unmapping in BCC/DMC/NT/WCC makefiles and Makefile.direct
* BCC_MAKEFILE (defines): Add -D USE_MUNMAP.
* NT_MAKEFILE (CFLAGS_DEFAULT): Likewise.
* WCC_MAKEFILE [MSWIN32] (DEFS): Likewise.
* digimars.mak (DEFINES): Likewise.
* Makefile.direct (CFLAGS): Add -D USE_MMAP -D USE_MUNMAP.
Ivan Maidanski [Sat, 22 Dec 2018 18:55:17 +0000 (21:55 +0300)]
Document HANDLE_FORK macro optional usage in Makefile.direct
* Makefile.direct (CFLAGS): Add comment about -D HANDLE_FORK.
Ivan Maidanski [Sat, 22 Dec 2018 18:49:22 +0000 (21:49 +0300)]
Do not prevent GC from looking at environment variables (BCC_MAKEFILE)
* BCC_MAKEFILE (defines): Remove -D NO_GETENV.
Ivan Maidanski [Sat, 22 Dec 2018 18:27:19 +0000 (21:27 +0300)]
Turn on gcj functionality in BCC, DMC, NT, OS/2, WCC makefiles
* BCC_MAKEFILE (defines): Add -D GC_GCJ_SUPPORT.
* Makefile.direct (CFLAGS): Likewise.
* OS2_MAKEFILE (CFLAGS): Likewise.
* WCC_MAKEFILE (DEFS): Likewise.
* digimars.mak (DEFINES): Likewise.
* BCC_MAKEFILE (XXXOBJS): Add XXXgcj_mlc.obj.
* NT_MAKEFILE (CFLAGS_DEFAULT): New variable (value copied from .c.obj);
add -D GC_GCJ_SUPPORT.
* NT_MAKEFILE (OBJS): Add gcj_mlc.obj.
* OS2_MAKEFILE (OBJS): Likewise.
* WCC_MAKEFILE (OBJS): Likewise.
* digimars.mak (OBJS): Likewise.
* NT_MAKEFILE (.c.obj, .cpp.obj): Use CFLAGS_DEFAULT variable.
Ivan Maidanski [Thu, 20 Dec 2018 23:33:49 +0000 (02:33 +0300)]
Abort with appropriate message if executable pages cannot be allocated
This may happen e.g. if PaX MPROTECT feature is enabled.
* os_dep.c [!OS2 && !PCR && !AMIGA && !USE_WINALLOC && !MACOS
&& !DOS4GW && !NONSTOP && !SN_TARGET_PSP2 && !RTEMS && !__CC_ARM
&& MMAP_SUPPORTED] (GC_unix_mmap_get_mem): Treat result==MAP_FAILED as
unlikely; if the first mmap call returns MAP_FAILED then ABORT with the
appropriate message if GC_pages_executable (and errno is EACCES).
Ivan Maidanski [Thu, 20 Dec 2018 21:54:55 +0000 (00:54 +0300)]
Fix 'mprotect remapping failed' abort on NetBSD with PaX enabled
Issue #255 (bdwgc).
Without this patch, GC_remap() works on NetBSD which has the PaX feature
only if PaX MPROTECT is off (sysctl -w security.pax.mprotect.enabled=0).
* os_dep.c [USE_MUNMAP && !USE_WINALLOC && NETBSD] (GC_remap): Call
mmap() instead of mprotect().
Ivan Maidanski [Thu, 20 Dec 2018 21:30:57 +0000 (00:30 +0300)]
Travis CI: Test with -D TEST_PAGES_EXECUTABLE passed to CFLAGS
Ivan Maidanski [Thu, 20 Dec 2018 08:34:12 +0000 (11:34 +0300)]
Allow to force executable pages allocation in gctest
Pass -D TEST_PAGES_EXECUTABLE to CFLAGS to enable the executable pages
allocation in gctest even if the collector is compiled with
NO_EXECUTE_PERMISSION.
* tests/test.c (INIT_PAGES_EXECUTABLE): New macro (calls
GC_set_pages_executable(1) if TEST_PAGES_EXECUTABLE).
* tests/test.c (GC_COND_INIT): Call INIT_PAGES_EXECUTABLE (before
GC_OPT_INIT).
* tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK]
(main): Remove UNTESTED(GC_set_pages_executable).
Ivan Maidanski [Thu, 20 Dec 2018 08:12:06 +0000 (11:12 +0300)]
Fix executable memory allocation in GC_unix_get_mem
Previously, sbrk() was used for the memory allocation even if the
executable pages were requested.
* os_dep.c [!OS2 && !PCR && !AMIGA && !USE_WINALLOC && !MACOS
&& !DOS4GW && !NONSTOP && !SN_TARGET_PSP2 && !RTEMS && !__CC_ARM
&& MMAP_SUPPORTED] (GC_unix_get_mem): Do not call GC_unix_sbrk_get_mem
if GC_pages_executable; add comment.
Ivan Maidanski [Wed, 19 Dec 2018 23:14:16 +0000 (02:14 +0300)]
Workaround 'nl-result_buf is out of bounds' cppcheck false positive
* os_dep.c [NEED_CALLINFO && LINUX && !SMALL_CONFIG] (GC_print_callers):
Replace nl-result_buf to (word)nl-COVERT_DATAFLOW(result_buf).
Ivan Maidanski [Wed, 19 Dec 2018 23:10:04 +0000 (02:10 +0300)]
Workaround 'argument dummy to GC_noop1 is always 1' cppcheck false positive
* misc.c [!ALWAYS_SMALL_CLEAR_STACK && !STACK_NOT_SCANNED
&& !ASM_CLEAR_CODE && CPPCHECK] (GC_clear_stack_inner): Pass dummy[0]
instead of address of dummy variable.
Ivan Maidanski [Wed, 19 Dec 2018 19:50:57 +0000 (22:50 +0300)]
Eliminate 'stop variable is always 0' compiler warning in print_callers
* os_dep.c [NEED_CALLINFO] (GC_print_callers): Declare (and use value
of) stop local variable only if LINUX && !SMALL_CONFIG; move stop local
variable to the scope of its use.
Ivan Maidanski [Wed, 19 Dec 2018 19:17:25 +0000 (22:17 +0300)]
Workaround '__data_start<_etext is always false' cppcheck false positive
* os_dep.c [SEARCH_FOR_DATA_START && (LINUX || HURD)
&& !IGNORE_PROG_DATA_START && HOST_ANDROID] (GC_init_linux_data_start):
Skip the workaround for "gold" linker if CPPCHECK.
Ivan Maidanski [Wed, 19 Dec 2018 19:11:42 +0000 (22:11 +0300)]
Eliminate 'hash_val value is never used' cppcheck false positive
* specific.c [USE_CUSTOM_SPECIFIC] (GC_setspecific): Change type of
hash_val local variable from int to unsigned.
* specific.c [USE_CUSTOM_SPECIFIC] (GC_slow_getspecific): Remove
hash_val local variable.
Ivan Maidanski [Tue, 18 Dec 2018 23:28:21 +0000 (02:28 +0300)]
Update NO_EXECUTE_PERMISSION documentation
* doc/README.macros (NO_EXECUTE_PERMISSION): Update and refine the
documentation (e.g. mention memory unmapping).
Ivan Maidanski [Tue, 18 Dec 2018 23:17:58 +0000 (02:17 +0300)]
Define GC_ATOMIC_UNCOLLECTABLE and JAVA_FINALIZATION in all make scripts
This matches the policy of configure and CMakeLists.txt.
* BCC_MAKEFILE (defines): Add -D GC_ATOMIC_UNCOLLECTABLE.
* NT_MAKEFILE (.cpp.obj): Likewise.
* Makefile.direct (CFLAGS): Add -D JAVA_FINALIZATION; reorder options.
* NT_MAKEFILE (.c.obj): Add -D GC_ATOMIC_UNCOLLECTABLE
-D JAVA_FINALIZATION.
* OS2_MAKEFILE (CFLAGS): Likewise.
* WCC_MAKEFILE (DEFS): Likewise.
* build/s60v3/libgc.mmp: Likewise.
* digimars.mak (DEFINES): Likewise.
* gc.mak [$CFG=="gc - Win32 Release" || $CFG=="gc - Win32 Debug"]
(CPP_PROJ): Likewise.
* NT_MAKEFILE (.cpp.obj): Remove redundant -I $(AO_INCLUDE_DIR)
-D ALL_INTERIOR_POINTERS.
Ivan Maidanski [Tue, 18 Dec 2018 22:19:53 +0000 (01:19 +0300)]
Remove redundant options for building 'cord' in gc.mak
(code refactoring)
* gc.mak [$CFG=="cord - Win32 Release" || $CFG=="cord - Win32 Debug"]
(CPP_PROJ): Remove -D ALL_INTERIOR_POINTERS -D ENABLE_DISCLAIM
-I libatomic_ops/src.
Ivan Maidanski [Tue, 18 Dec 2018 21:48:13 +0000 (00:48 +0300)]
Default to non-executable memory allocation across all make scripts
This matches the policy of Makefile.direct, configure and CMakeLists.txt.
* BCC_MAKEFILE (defines): Add -D NO_EXECUTE_PERMISSION.
* NT_MAKEFILE (.c.obj): Likewise.
* OS2_MAKEFILE (CFLAGS): Likewise.
* WCC_MAKEFILE (DEFS): Likewise.
* digimars.mak (DEFINES): Likewise.
* gc.mak [$CFG=="gc - Win32 Release" || $CFG=="gc - Win32 Debug"]
(CPP_PROJ): Likewise.
Ivan Maidanski [Thu, 13 Dec 2018 06:47:35 +0000 (09:47 +0300)]
Update ChangeLog file (set v7.6.10 release date)
Ivan Maidanski [Thu, 13 Dec 2018 05:57:24 +0000 (08:57 +0300)]
Update ChangeLog file (set v7.4.16 release date)
Ivan Maidanski [Tue, 11 Dec 2018 19:46:20 +0000 (22:46 +0300)]
Update ChangeLog file (set v7.2m release date)
Ivan Maidanski [Thu, 6 Dec 2018 08:41:33 +0000 (11:41 +0300)]
Remove goto statement in print_callers
(code refactoring)
* os_dep.c [NEED_CALLINFO && LINUX && !SMALL_CONFIG] (GC_print_callers):
Replace "goto out" to "break" statement in a do-while(0) block; remove
"out" label; move ret_code local variable declaration to the scope of
its usage; close pipe immediately after fread().
Ivan Maidanski [Thu, 6 Dec 2018 08:23:52 +0000 (11:23 +0300)]
Eliminate 'assigned value never used' compiler warning in test_cpp WinMain
* tests/test_cpp.cc [(MSWIN32 && !__MINGW32__ || MSWINCE)
&& !NO_WINMAIN_ENTRY] (WinMain): Remove first argv[argc]=cmd (when cmd
points to a space or tab character).
Ivan Maidanski [Thu, 6 Dec 2018 08:14:37 +0000 (11:14 +0300)]
Workaround 'name var reassign before old value use' cppcheck false positive
* os_dep.c [NEED_CALLINFO && LINUX && !SMALL_CONFIG && CPPCHECK]
(GC_print_callers): Call GC_noop1(name[0]) before reassigning name;
add comment.
Ivan Maidanski [Wed, 5 Dec 2018 22:47:19 +0000 (01:47 +0300)]
Do not use 'ifndef AO_CLEAR' in mark, pthread_support and gctest
(code refactoring of commits
272283d5b,
d6c7ee31d,
2178db2b6)
* include/private/gc_priv.h [THREADS && !NN_PLATFORM_CTR
&& !SN_TARGET_ORBIS && !SN_TARGET_PSP2 && !AO_HAVE_compiler_barrier]
(AO_HAVE_compiler_barrier): Define private macro (after include
gc_atomic_ops.h).
* mark.c [!BASE_ATOMIC_OPS_EMULATED] (GC_noop6): Call
AO_compiler_barrier() only if AO_HAVE_compiler_barrier.
* pthread_support.c [(USE_SPIN_LOCK || !NO_PTHREAD_TRYLOCK)
&& !BASE_ATOMIC_OPS_EMULATED] (GC_pause): Likewise.
* tests/test.c (AO_t): Define only if AO_HAVE_compiler_barrier is not
defined.
Ivan Maidanski [Wed, 5 Dec 2018 22:02:30 +0000 (01:02 +0300)]
Do not use 'ifndef AO_CLEAR' in disclaim_weakmap_test
(code refactoring of commit
95e074727)
* tests/disclaim_weakmap_test.c [!GC_PTHREADS] (AO_t): Define (as
GC_word).
* tests/disclaim_weakmap_test.c (AO_t): Do not check whether AO_CLEAR
is defined; remove comment.
Ivan Maidanski [Tue, 4 Dec 2018 21:45:52 +0000 (00:45 +0300)]
Update ChangeLog file
Ivan Maidanski [Tue, 4 Dec 2018 09:06:26 +0000 (12:06 +0300)]
Update ChangeLog file (v8.0 changes)
Ivan Maidanski [Tue, 4 Dec 2018 08:42:54 +0000 (11:42 +0300)]
Update ChangeLog file (v7.6 changes)
Ivan Maidanski [Mon, 3 Dec 2018 22:40:03 +0000 (01:40 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Thu, 29 Nov 2018 09:04:07 +0000 (12:04 +0300)]
Refine HIDE_POINTER documentation for the case of the leak-finding mode
* include/gc.h (GC_HIDE_POINTER, GC_REVEAL_POINTER): Refine comment
(warn about usage in the leak-finding mode).
Ivan Maidanski [Thu, 29 Nov 2018 08:53:21 +0000 (11:53 +0300)]
Fix disclaim_weakmap_test failures in leak-finding mode
Issue #252 (bdwgc).
* tests/disclaim_weakmap_test.c (weakmap_add, weakmap_disclaim): Bypass
GC_REVEAL_POINTER() and GC_HIDE_POINTER() logic if GC_find_leak.
Ivan Maidanski [Thu, 29 Nov 2018 08:46:48 +0000 (11:46 +0300)]
Fix GC_register_disclaim_proc for leak-finding mode
Issue #252 (bdwgc).
This makes the behavior of GC_register_disclaim_proc() and
GC_finalized_malloc() somewhat consistent with
GC_register_disappearing_link() and GC_register_finalizer() when
find-leak is on. The documentation is updated accordingly.
* fnlz_mlc.c [ENABLE_DISCLAIM] (GC_finalized_disclaim): Add assertion
that GC_find_leak is off.
* fnlz_mlc.c [ENABLE_DISCLAIM] (GC_register_disclaim_proc): Do not
assign ok_disclaim_proc, ok_mark_unconditionally fields if GC_find_leak.
* include/gc_disclaim.h (GC_register_disclaim_proc,
GC_finalized_malloc): Refine comment about leak-find mode and GC_free
invocation.
Ivan Maidanski [Wed, 28 Nov 2018 22:05:26 +0000 (01:05 +0300)]
Workaround 'var reassigned before old value use' cppcheck false positive
* extra/AmigaOS.c [!GC_AMIGA_ONLYFAST && CPPCHECK]
(GC_amiga_allocwrapper_any): Add a dummy read of GC_amiga_dontalloc
global variable; add comment.
* pthread_support.c [CPPCHECK] (GC_do_blocking_inner): Add a dummy read
of thread_blocked field of GC_thread.
* pthread_support.c [CPPCHECK] (GC_call_with_gc_active): Add a dummy
read of traced_stack_sect field of GC_thread.
Ivan Maidanski [Wed, 28 Nov 2018 09:09:59 +0000 (12:09 +0300)]
Travis CI: Pass extra/gc.c to cppcheck --enable=unusedFunction
This fixes a dozen of 'the function is never used' cppcheck style
warnings (for GC_core_gcj_malloc, GC_durango_get_mem,
GC_FreeBSDGetDataStart, GC_haiku_get_mem, GC_mprotect_resume,
GC_mprotect_stop, GC_remove_roots_subregion, GC_win32_get_mem,
GC_wince_get_mem).
Ivan Maidanski [Wed, 28 Nov 2018 09:03:04 +0000 (12:03 +0300)]
Prefix internal durango_get_mem symbol with 'GC_'
(code refactoring of commit
d16debf3e)
Issue #173 (bdwgc).
* include/private/gcconfig.h [MSWIN_XBOX1] (durango_get_mem): Rename
to GC_durango_get_mem; change return type from void* to ptr_t; remove
page_size argument.
* os_dep.c [MSWIN_XBOX1] (durango_get_mem): Likewise.
* include/private/gcconfig.h [MSWIN_XBOX1] (GET_MEM): Use
GC_durango_get_mem (instead of durango_get_mem).
Ivan Maidanski [Wed, 28 Nov 2018 08:28:23 +0000 (11:28 +0300)]
Workaround 'GC_get_thr_restart_signal is never used' cppcheck warning
* tests/test.c [GC_PTHREADS && CPPCHECK && (GC_DARWIN_THREADS
|| GC_OPENBSD_UTHREADS)] (main): Add UNTESTED(GC_get_thr_restart_signal).
Ivan Maidanski [Fri, 23 Nov 2018 18:41:07 +0000 (21:41 +0300)]
Travis CI: Test with -D TEST_WITH_SYSTEM_MALLOC passed to CFLAGS
Ivan Maidanski [Fri, 23 Nov 2018 18:36:20 +0000 (21:36 +0300)]
Eliminate 'function is never used' cppcheck warning for calloc/realloc
* tests/test.c [TEST_WITH_SYSTEM_MALLOC] (run_one_test): Call calloc(),
realloc() and free().
Ivan Maidanski [Fri, 23 Nov 2018 11:42:57 +0000 (14:42 +0300)]
Add initial testing of GC_enable/disable, MALLOC[_ATOMIC]_IGNORE_OFF_PAGE
* tests/test.c (run_one_test): Call GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(),
GC_disable(), GC_MALLOC_IGNORE_OFF_PAGE(), GC_enable().
Ivan Maidanski [Fri, 23 Nov 2018 08:57:29 +0000 (11:57 +0300)]
Workaround 'GC_dump function is never used' cppcheck warning
* tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK
&& !NO_DEBUGGING] (main): Add UNTESTED(GC_dump).
Ivan Maidanski [Fri, 23 Nov 2018 08:49:31 +0000 (11:49 +0300)]
Workaround '*_stubborn function is never used' cppcheck warnings
* dbg_mlc.c (GC_debug_malloc_stubborn, GC_debug_change_stubborn): Do
not define if CPPCHECK.
* mallocx.c (GC_malloc_stubborn, GC_end_stubborn_change): Likewise.
* include/gc.h (GC_debug_change_stubborn): Always mark as
GC_ATTR_DEPRECATED (regardless of CPPCHECK).
* tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK]
(main): Remove UNTESTED(GC_debug_change_stubborn).
Ivan Maidanski [Fri, 23 Nov 2018 06:23:02 +0000 (09:23 +0300)]
Fix mutex_trylock failure in disclaim_weakmap_test in leak detection mode
* tests/disclaim_weakmap_test.c (weakmap.links): Add comment.
* tests/disclaim_weakmap_test.c (weakmap_disclaim): If wm->links is
null then return 0 (do not use wm).
* tests/disclaim_weakmap_test.c (weakmap_destroy): Set links to null.
Ivan Maidanski [Thu, 22 Nov 2018 23:22:41 +0000 (02:22 +0300)]
Fix 'collecting from unknown thread' abort in leak-finding mode for Win32
(fix of commit
8e6460052)
* include/private/gc_priv.h [THREADS] (GC_in_thread_creation): Declare
not only for pthreads.
* misc.c [!DONT_USE_ATEXIT && THREADS] (GC_exit_check): Set
GC_in_thread_creation to true before calling GC_gcollect for windows
threads as well.
* win32_threads.c (GC_in_thread_creation): Change STATIC to GC_INNER.
Ivan Maidanski [Thu, 22 Nov 2018 23:10:10 +0000 (02:10 +0300)]
Turn off leak detection mode explicitly in cord/de
* cord/tests/de.c [!WIN32] (main): Call GC_set_find_leak(0) before
GC_INIT() to disable leak detection mode.
* cord/tests/de_win.c [WIN32] (WinMain): Likewise.
Ivan Maidanski [Thu, 22 Nov 2018 22:17:28 +0000 (01:17 +0300)]
Print relevant message in tests not appropriate for leak detection mode
* cord/tests/cordtest.c (main): If GC_get_find_leak() then print a
message that the test is not designed for leak detection mode (i.e.,
plenty of leaks could be reported).
* tests/disclaim_bench.c (main): Likewise.
* tests/disclaim_test.c (main): Likewise.
* tests/disclaim_weakmap_test.c (main): Likewise.
* tests/initsecondarythread.c (main): Likewise.
* tests/middle.c (main): Likewise.
* tests/realloc_test.c (main): Likewise.
* tests/staticrootstest.c (main): Likewise.
* tests/test_cpp.cc (main): Likewise.
* tests/threadkey_test.c (main): Likewise.
* tests/trace_test.c (main): Likewise.
Ivan Maidanski [Thu, 22 Nov 2018 13:39:52 +0000 (16:39 +0300)]
Travis CI: Pass -U GC_PRIVATE_H to cppcheck
Ivan Maidanski [Thu, 22 Nov 2018 11:34:03 +0000 (14:34 +0300)]
Workaround 'nonlocal var will use ptr to local var' cppcheck false positive
* extra/msvc_dbg.c (sym_namebuf_u): New union type.
* extra/msvc_dbg.c (GetSymbolNameFromAddress): Use sym_namebuf_u
instead of anonymous union.
* os_dep.c [MPROTECT_VDB && DARWIN] (mp_reply_s, mp_msg_s): Move struct
type definition out of GC_mprotect_thread (adding mp_ prefix).
Ivan Maidanski [Thu, 22 Nov 2018 10:01:16 +0000 (13:01 +0300)]
Eliminate 'struct member is never used' cppcheck warnings in os_dep
* os_dep.c [SPARC && LINUX] (struct frame): Declare only if
SAVE_CALL_CHAIN.
Ivan Maidanski [Thu, 22 Nov 2018 05:29:31 +0000 (08:29 +0300)]
Workaround 'value of _MAX_PATH is unknown' cppcheck warning
* include/private/gcconfig.h [CPPCHECK] (_MAX_PATH): Undefine.
Ivan Maidanski [Wed, 21 Nov 2018 22:01:46 +0000 (01:01 +0300)]
Travis CI: Test with FIND_LEAK
Ivan Maidanski [Wed, 21 Nov 2018 21:32:50 +0000 (00:32 +0300)]
Fix test_cpp assertion violation in find-leak mode
* tests/test_cpp.cc (C.Test, D.Test, F.Test): Do not fail on
nFreed>=0.8*nAllocated[F] assertion violation if GC_get_find_leak() returns
non-zero; replace .8*nAllocated[F] to (nAllocated[F]/5)*4 to avoid
floating-point operations.
Ivan Maidanski [Wed, 21 Nov 2018 21:09:14 +0000 (00:09 +0300)]
New macro to suppress printing of leaked objects
The macro (SKIP_LEAKED_OBJECTS_PRINTING) might be useful for running
GC general tests in the find-leak mode.
* reclaim.c (GC_print_all_errors): Do not call GC_print_heap_obj
if SKIP_LEAKED_OBJECTS_PRINTING is defined.
Ivan Maidanski [Wed, 21 Nov 2018 09:30:24 +0000 (12:30 +0300)]
Travis CI: Test with AO_USE_PTHREAD_DEFS passed in CFLAGS to configure
Ivan Maidanski [Wed, 21 Nov 2018 09:16:01 +0000 (12:16 +0300)]
Turn off parallel marker, thread-local allocation if used AO ops emulated
* configure.ac (use_parallel_mark, use_thread_local_alloc): New
variable (set to enable_parallel_mark and enable_thread_local_alloc,
respectively, if threads are enabled).
* configure.ac (PARALLEL_MARK, THREAD_LOCAL_ALLOC): Group and move
AC_DEFINE down (the definition depends on the final value of
use_parallel_mark or use_thread_local_alloc, respectively).
* configure.ac (THREAD_LOCAL_ALLOC): Move AM_CONDITIONAL down to use
the final value of use_thread_local_alloc; do not check THREADS.
* configure.ac (handle-fork): Move AC_ARG_ENABLE and its processing
down to use the final value of use_parallel_mark (the latter is used
instead of enable_parallel_mark).
* configure.ac [$with_libatomic_ops!=none && $need_atomic_ops_asm!=true]
(use_thread_local_alloc): Set explicitly to "no" if
BASE_ATOMIC_OPS_EMULATED is defined.
* configure.ac [$with_libatomic_ops!=none && $need_atomic_ops_asm!=true
&& $use_parallel_mark!=no] (use_parallel_mark): Set explicitly to "no"
in case of a failure of AC_TRY_LINK of a code snippet calling
AO_fetch_and_add and AO_compare_and_swap (provided AO_REQUIRE_CAS is
defined).
* include/private/gc_pmark.h [USE_MARK_BYTES && PARALLEL_MARK
&& AO_HAVE_char_store] (SET_MARK_BIT_EXIT_IF_SET): Do not use
AO_char_load() and AO_char_store() if BASE_ATOMIC_OPS_EMULATED.
Ivan Maidanski [Tue, 20 Nov 2018 21:19:20 +0000 (00:19 +0300)]
Fix a deadlock in write_fault_handler if AO_or is emulated
* configure.ac [$with_libatomic_ops!=none && $need_atomic_ops_asm!=true]
(HAVE_LOCKFREE_AO_OR): New AC_DEFINE (defined in case of success of
AC_TRY_LINK of a code snippet calling AO_or).
* include/private/gc_atomic_ops.h [GC_BUILTIN_ATOMIC
&& !NO_LOCKFREE_AO_OR] (HAVE_LOCKFREE_AO_OR): Define (to 1).
* include/private/gc_priv.h [THREADS] (GC_acquire_dirty_lock,
GC_release_dirty_lock): Define to no-op only if HAVE_LOCKFREE_AO_OR
or GC_DISABLE_INCREMENTAL.
* os_dep.c [!GC_DISABLE_INCREMENTAL] (async_set_pht_entry_from_index):
Use set_pht_entry_from_index_concurrent() only if HAVE_LOCKFREE_AO_OR
(or not THREADS).
Ivan Maidanski [Tue, 20 Nov 2018 20:44:08 +0000 (23:44 +0300)]
Do not use spin locks if AO test-and-set is emulated (pthreads)
* include/private/gc_locks.h [BASE_ATOMIC_OPS_EMULATED && GC_PTHREADS]
(USE_PTHREAD_LOCKS): Define.
* include/private/gc_locks.h [BASE_ATOMIC_OPS_EMULATED && GC_PTHREADS]
(USE_SPIN_LOCK): Undefine.
* pthread_support.c [(USE_SPIN_LOCK || !NO_PTHREAD_TRYLOCK)
&& AO_CLEAR] (GC_pause): Do not use AO_compiler_barrier() if
BASE_ATOMIC_OPS_EMULATED.
* pthread_support.c [AO_HAVE_char_load] (is_collecting): Do not use
AO_char_load() if BASE_ATOMIC_OPS_EMULATED.
Ivan Maidanski [Tue, 20 Nov 2018 08:42:52 +0000 (11:42 +0300)]
Fix deadlocks in write and suspend handlers if AO test-and-set is emulated
This could be tested with -D AO_USE_PTHREAD_DEFS passed to CFLAGS.
* configure.ac (AO_TRYLINK_CFLAGS): New variable.
* configure.ac [$with_libatomic_ops!=none && $need_atomic_ops_asm!=true]
(BASE_ATOMIC_OPS_EMULATED): New AC_DEFINE (defined in case of failure
of AC_TRY_LINK of a code snippet calling AO_test_and_set_acquire,
AO_CLEAR, AO_compiler_barrier, AO_store, AO_load, AO_char_store,
AO_char_load, AO_store_release, AO_load_acquire); use AO_TRYLINK_CFLAGS;
add comment.
* include/private/gcconfig.h [BASE_ATOMIC_OPS_EMULATED] (MPROTECT_VDB):
Undefine.
* mark.c [AO_CLEAR] (GC_noop6): Do not call AO_compiler_barrier() if
BASE_ATOMIC_OPS_EMULATED.
* misc.c [!GC_DISABLE_INCREMENTAL] (GC_init, GC_enable_incremental):
Do not set GC_manual_vdb if BASE_ATOMIC_OPS_EMULATED.
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]
(ao_load_acquire_async, ao_load_async, ao_store_release_async,
ao_store_async): New macro; undefine it after the usage.
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]
(GC_store_stack_ptr): Use ao_store_async() instead of AO_store().
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]
(GC_suspend_handler_inner): Use ao_load[_acquire]_async() and
ao_store_release_async() instead of AO_load[_acquire]() and
AO_store_release(), respectively.
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL
&& GC_ENABLE_SUSPEND_THREAD] (suspend_self_inner): Use
ao_load_acquire_async() instead of AO_load_acquire().
Ivan Maidanski [Fri, 16 Nov 2018 21:51:49 +0000 (00:51 +0300)]
Prevent config macros redefinition undefined in gcconfig.h
(fix of commit
4f837f7a7)
* include/private/gc_pmark.h [HAVE_CONFIG_H]: Do not include config.h
if GC_PRIVATE_H is defined; add comment.
Ivan Maidanski [Fri, 16 Nov 2018 17:27:42 +0000 (20:27 +0300)]
Avoid potential 'macro redefinition' errors for config.h macros
If a macro that could be defined in config.h could also be defined in
gc_config_macros.h or gcconfig.h then define it to the same value (1).
* include/gc_config_macros.h [!_REENTRANT && GC_PTHREADS
&& !GC_WIN32_THREADS] (_REENTRANT): Define to 1 instead of a blank.
* include/private/gcconfig.h [SPARC && SOLARIS && !USE_MMAP
&& REDIRECT_MALLOC] (USE_MMAP): Likewise.
* include/private/gcconfig.h [I386 && SOLARIS && !USE_MMAP
&& REDIRECT_MALLOC] (USE_MMAP): Likewise.
* include/private/gcconfig.h [I386 && DGUX && !USE_MMAP] (USE_MMAP):
Likewise.
* include/private/gcconfig.h [I386 && LINUX && __ELF__
&& !GC_NO_SIGSETJMP && (HOST_TIZEN || HOST_ANDROID)] (GC_NO_SIGSETJMP):
Likewise.
* include/private/gcconfig.h [I386 && DARWIN] (DARWIN_DONT_PARSE_STACK):
Likewise.
* include/private/gcconfig.h [AARCH64 && DARWIN]
(DARWIN_DONT_PARSE_STACK): Likewise.
* include/private/gcconfig.h [AARCH64 && NINTENDO_SWITCH]
(NO_HANDLE_FORK): Likewise.
* include/private/gcconfig.h [ARM32 && DARWIN]
(DARWIN_DONT_PARSE_STACK): Likewise.
* include/private/gcconfig.h [ARM32 && SN_TARGET_PSP2] (NO_HANDLE_FORK):
Likewise.
* include/private/gcconfig.h [X86_64 && DARWIN]
(DARWIN_DONT_PARSE_STACK): Likewise.
* include/private/gcconfig.h [X86_64 && SOLARIS && !USE_MMAP
&& REDIRECT_MALLOC] (USE_MMAP): Likewise.
* include/private/gcconfig.h [X86_64 && MSWIN_XBOX1 && !USE_MMAP]
(USE_MMAP): Likewise.
* include/private/gcconfig.h [(MSWIN32 || MSWINCE) && !USE_WINALLOC]
(USE_WINALLOC): Likewise.
* include/private/gcconfig.h [UNIX_LIKE && !NO_GETCONTEXT]
(NO_GETCONTEXT): Likewise.
* include/private/gcconfig.h [(FREEBSD || DARWIN && !_POSIX_C_SOURCE
|| SOLARIS && (!_XOPEN_SOURCE || __EXTENSIONS__) || LINUX)
&& !HAVE_DLADDR] (HAVE_DLADDR): Likewise.
* include/private/gcconfig.h [MAKE_BACK_GRAPH && !DBG_HDRS_ALL]
(DBG_HDRS_ALL): Likewise.
Ivan Maidanski [Thu, 15 Nov 2018 21:30:37 +0000 (00:30 +0300)]
Appveyor CI: Use 'make check-without-test-driver' for Cygwin
Ivan Maidanski [Thu, 15 Nov 2018 09:08:14 +0000 (12:08 +0300)]
Fix tests linkage with internal atomic_ops.o
* tests/tests.am (test_ldadd): Add $(nodist_libgc_la_OBJECTS).
Ivan Maidanski [Thu, 15 Nov 2018 08:54:13 +0000 (11:54 +0300)]
Update AUTHORS file (add Fabrice Fontaine)
Fabrice Fontaine [Mon, 5 Nov 2018 21:50:40 +0000 (22:50 +0100)]
Fix linkage with a system libatomic_ops shared library
Issue #247 (bdwgc).
When bdwgc is linked with the external libatomic_ops, bdw-gc.pc must
contain the needed dynamic libraries (such as -latomic_ops) otherwise
build of applications could fail on the link stage on some hosts:
* libgc.so: undefined reference to 'AO_fetch_compare_and_swap_emulation'
* libgc.so: undefined reference to 'AO_store_full_emulation'
So, this commit sets ATOMIC_OPS_LIBS to "-latomic_ops" when a system
atomic_ops library is used and uses ATOMIC_OPS_LIBS in bdw-gc.pc.in.
* bdw-gc.pc.in (Libs): Add @ATOMIC_OPS_LIBS@.
* configure.ac [$with_libatomic_ops!=no && $with_libatomic_ops!=none
&& $THREADS!=none] (ATOMIC_OPS_LIBS): Set to -latomic_ops; do AC_SUBST.
Ivan Maidanski [Wed, 14 Nov 2018 08:32:34 +0000 (11:32 +0300)]
Fix typo in '#endif' in gcconfig.h
(fix of commit 85422f3)
* include/private/gcconfig.h [CPPCHECK]: Fix typo in pragma ("#endif").
Ivan Maidanski [Wed, 14 Nov 2018 08:02:01 +0000 (11:02 +0300)]
Workaround cppcheck warnings regarding CLOCKS_PER_SEC, REDIRECT_REALLOC
Also, this commit adjusts the workaround for FIXUP_POINTER.
* include/private/gcconfig.h [CPPCHECK] (CLOCKS_PER_SEC, FIXUP_POINTER,
POINTER_MASK, POINTER_SHIFT, REDIRECT_REALLOC): Undefine.
* include/private/gcconfig.h [!FIXUP_POINTER && POINTER_MASK]
(FIXUP_POINTER): Same definition regardless of CPPCHECK.
Ivan Maidanski [Wed, 14 Nov 2018 07:49:27 +0000 (10:49 +0300)]
Use standalone private macro to guard against ptr_t redefinition
(code refactoring)
* include/private/gc_priv.h (ptr_t): Define only if PTR_T_DEFINED is
not defined (previously).
* include/private/gcconfig.h (ptr_t): Likewise.
* include/private/gc_priv.h (PTR_T_DEFINED): Define macro.
* include/private/gcconfig.h (PTR_T_DEFINED): Likewise.
* include/private/gcconfig.h (ptr_t): Change type to char*; remove
void comments.
* include/private/gcconfig.h: Include stddef.h only if sony_news is
not defined (like in gc_priv.h).
Ivan Maidanski [Tue, 13 Nov 2018 22:24:13 +0000 (01:24 +0300)]
Remove redundant header double-inclusion checks in the private headers
(code refactoring)
* include/private/gc_pmark.h [HAVE_CONFIG_H]: Include config.h
regardless of GC_PRIVATE_H.
* include/private/gc_pmark.h: Include gc_mark.h regardless of GC_MARK_H;
include gc_priv.h regardless of GC_PRIVATE_H.
* include/private/gc_priv.h: Include gc_tiny_fl.h regardless of
GC_TINY_FL_H; include gc_mark.h regardless of GC_MARK_H; include
gcconfig.h regardless of GCCONFIG_H; include gc_locks.h regardless
of GC_LOCKS_H.
Ivan Maidanski [Tue, 13 Nov 2018 08:02:49 +0000 (11:02 +0300)]
Workaround 'local address assignment to a global variable' CSA warning
* include/gc.h [(!__GNUC__ || __INTEL_COMPILER) && LINT2]
(GC_reachable_here): Transform ptr in the same way as COVERT_DATAFLOW()
does.
* mach_dep.c (GC_with_callee_saves_pushed): Transform the argument of
GC_noop1() by COVERT_DATAFLOW().
* misc.c [!ASM_CLEAR_CODE] (GC_clear_stack_inner): Likewise.
* misc.c (GC_call_with_stack_base, GC_call_with_gc_active): Likewise.
* pthread_support.c (GC_call_with_gc_active): Likewise.
* win32_threads.c (GC_call_with_gc_active): Likewise.
* misc.c (GC_call_with_gc_active): Transform &stacksect by
COVERT_DATAFLOW() when storing to GC_stackbottom.
* pthread_support.c (GC_call_with_gc_active): Likewise.
Ivan Maidanski [Mon, 12 Nov 2018 18:16:42 +0000 (21:16 +0300)]
Eliminate 'non-virtual destructor for class with inheritors' CSA warning
* tests/test_cpp.cc (A): Add virtual empty destructor.
Ivan Maidanski [Mon, 12 Nov 2018 17:57:32 +0000 (20:57 +0300)]
Guard against potential buffer overflow in CORD_next and CORD_pos_fetch
* cord/cordbscs.c (CORD__pos_fetch, CORD__next): Call ABORT() if
CORD_pos_valid() returns false for the argument (do not compute pe
in this case).
Ivan Maidanski [Mon, 12 Nov 2018 08:12:09 +0000 (11:12 +0300)]
Workaround 'potential non-terminated string' false positive in cordbscs
* cordbscs.c [LINT2] (CORD_cat_char_star): Pass lenx+1 to memcpy()
instead of lenx; add comment.
Ivan Maidanski [Mon, 12 Nov 2018 07:52:01 +0000 (10:52 +0300)]
Fix 'too wide non-owner permissions are set for resource' code defect
* misc.c [(UNIX_LIKE && !GC_ANDROID_LOG || CYGWIN32 || SYMBIAN)
&& !SMALL_CONFIG] (GC_init): Pass 0644 permissions mode instead of 0666
to open (create) a log file.
* os_dep.c [MMAP_SUPPORTED && !USE_MMAP_ANON && SYMBIAN]
(GC_unix_mmap_get_mem): Pass 0644 mode instead of 0666 to open "zero"
file.
Ivan Maidanski [Mon, 12 Nov 2018 07:30:18 +0000 (10:30 +0300)]
Eliminate 'casting signed to bigger unsigned int' CSA warning
* cord/cordprnt.c (CORD_vsprintf): Cast prec, width, max_size, res
local variables to unsigned.
* cord/tests/cordtest.c (test_basics): Change type of i local variable
from int to size_t; cast c local variable to unsigned char.
* dbg_mlc.c (GC_store_debug_info_inner): Do not cast linenum parameter.
* include/private/dbg_mlc.h (oh.oh_string, oh.oh_int): Refine comment.
* include/private/dbg_mlc.h (oh.oh_int): Change type from word to
signed_word.
* misc.c [!GC_GET_HEAP_USAGE_NOT_NEEDED] (fill_prof_stats): Cast
GC_markers_m1 to signed_word first.
* misc.c (GC_init): Cast space_divisor local variable to unsigned
(instead of word).
* misc.c [!MSWIN32 && !MSWINCE && !OS2 && !MACOS && !GC_ANDROID_LOG]
(GC_write): Cast bytes_written local variable to unsigned (instead of
size_t).
Ivan Maidanski [Fri, 9 Nov 2018 18:25:29 +0000 (21:25 +0300)]
Adjust #error messages format
(code refactoring)
Remove double quotes, "-->" prefix and the trailing dot from the error
messages.
* include/private/gcconfig.h [hp9000s300 && !CPPCHECK]: Adjust #error
message format.
* include/private/gcconfig.h [ibm032 && !CPPCHECK]: Likewise.
* include/private/gcconfig.h [!mach_type_known && !CPPCHECK]: Likewise.
* include/private/gcconfig.h [HEXAGON && (!__GLIBC__ || __GLIBC__ < 2
|| !__ELF__ && !CPPCHECK || !LINUX)]: Likewise.
* include/private/gcconfig.h [!ALIGNMENT && !CPPCHECK]: Likewise.
* include/private/gcconfig.h [!STACKBOTTOM && (ECOS || NOSYS)
&& !CPPCHECK]: Likewise.
* include/private/gcconfig.h [!CPPCHECK && (GC_IRIX_THREADS
|| GC_LINUX_THREADS || GC_NETBSD_THREADS || GC_FREEBSD_THREADS
|| GC_SOLARIS_THREADS || GC_HPUX_THREADS || GC_AIX_THREADS
|| GC_WIN32_THREADS || GC_WIN32_PTHREADS)]: Likewise.
* include/private/gcconfig.h [PARALLEL_MARK && !THREADS && !CPPCHECK]:
Likewise.
* include/private/gcconfig.h [!CPPCHECK && (MARK_BIT_PER_GRANULE
&& MARK_BIT_PER_OBJ || STACK_GROWS_UP && STACK_GROWS_DOWN
|| !STACK_GROWS_UP && !STACK_GROWS_DOWN || REDIRECT_MALLOC && THREADS
&& !LINUX && !REDIRECT_MALLOC_IN_HEADER)]: Likewise.
* os_dep.c [(MMAP_SUPPORTED || ADD_HEAP_GUARD_PAGES) && USE_MUNMAP
&& !USE_MMAP && !CPPCHECK]: Likewise.
* win32_threads.c [!I386 && !X86_64 && !ARM32 && !AARCH64 && !SHx
!MIPS && !PPC && !ALPHA && !CPPCHECK] (GC_push_stack_for): Likewise.
Ivan Maidanski [Fri, 9 Nov 2018 17:54:23 +0000 (20:54 +0300)]
Workaround '#error' cppcheck messages in backgraph and private headers
* backgraph.c [!DBG_HDRS_ALL || ALIGNMENT!=CPP_WORDSZ/8]: Skip #error
directive if CPPCHECK.
* include/private/dbg_mlc.h [(KEEP_BACK_PTRS || MAKE_BACK_GRAPH)
&& SHORT_DBG_HDRS]: Likewise.
* include/private/gc_atomic_ops.h [!GC_BUILTIN_ATOMIC && (!AO_HAVE_load
|| !AO_HAVE_store)]: Likewise.
* include/private/gc_hdrs.h [CPP_WORDSZ!=32 && CPP_WORDSZ<36]: Likewise.
* include/private/gc_priv.h [HBLKSIZE]: Likewise.
* include/private/gcconfig.h [SPARC && LINUX && !__ELF__]: Likewise.
* include/private/gcconfig.h [I386 && (__LP64__ || _WIN64)]: Likewise.
* include/private/gcconfig.h [IA64 && HPUX && !_ILP32 && !_LP64]:
Likewise.
* include/private/gcconfig.h [CPP_WORDSZ!=32 && CPP_WORDSZ!=64]:
Likewise.
Ivan Maidanski [Fri, 9 Nov 2018 17:08:20 +0000 (20:08 +0300)]
Eliminate 'uninitialized var' cppcheck false positive in mach_dep, os_dep
* mach_dep.c (GC_with_callee_saves_pushed): Change type of "context"
local variable from void* volatile to volatile ptr_t.
* os_dep.c [(SVR4 || AIX || DGUX || (LINUX && SPARC)) && !PCR]
(GC_SysVGetDataStart): Change type of "result" local variable from
char* volatile to volatile ptr_t.
Ivan Maidanski [Fri, 9 Nov 2018 08:35:37 +0000 (11:35 +0300)]
Workaround 'AST broken' syntax error reported by cppcheck in GC_mark_some
Cppcheck does not support GNU-specific "&&label" syntax currently.
* mark.c [WRAP_MARK_SOME && (MSWIN32 || MSWINCE) && __GNUC__
&& !GC_GNUC_PREREQ(4,7) && !GC_CLANG_PREREQ(3,3)] (GC_mark_some): Skip
"er.alt_path=&&handle_ex" statement if CPPCHECK.
Ivan Maidanski [Fri, 9 Nov 2018 08:14:02 +0000 (11:14 +0300)]
Workaround 'local variable obj_displ shadows outer symbol' cppcheck warning
(fix of commit
8d64dbd10)
* include/private/gc_pmark.h [MARK_BIT_PER_OBJ] (GC_push_contents_hdr):
Do not declare obj_displ if MARK_BIT_PER_GRANULE.
Ivan Maidanski [Fri, 9 Nov 2018 07:35:36 +0000 (10:35 +0300)]
Workaround 'local variable end shadows outer symbol' cppcheck warnings
* include/private/gcconfig.h [SPARC && FREEBSD] (end): Do not declare
external variable if CPPCHECK.
* include/private/gcconfig.h [MIPS && EWS4800 && (!_MIPS_SZPTR
|| _MIPS_SZPTR!=64)] (end): Likewise.
* include/private/gcconfig.h [ALPHA && FREEBSD] (end): Likewise.
* include/private/gcconfig.h [!DATAEND] (end): Likewise.
* include/private/gcconfig.h [I386 && RTEMS] (end): Do not declare
(because it automatically declared in DATAEND is undefined).
* include/private/gcconfig.h [I386 && RTEMS] (DATAEND): Do not define.
* include/private/gcconfig.h [MIPS && EWS4800]: Adjust indentation.
Ivan Maidanski [Fri, 9 Nov 2018 07:14:09 +0000 (10:14 +0300)]
Fix 'set_pht_entry_from_index_concurrent value is unknown' cppcheck warning
(fix of commit
cdc201f40)
* blacklst.c [PARALLEL_MARK && THREAD_SANITIZER]
(backlist_set_pht_entry_from_index): Assume
set_pht_entry_from_index_concurrent is always defined.
* include/private/gc_priv.h [!THREADS || !AO_HAVE_or]
(set_pht_entry_from_index_concurrent): Define (to
set_pht_entry_from_index).
* include/private/gc_priv.h [THREADS && AO_HAVE_or]
(GC_acquire_dirty_lock, GC_release_dirty_lock): Define to empty.
* os_dep.c [!GC_DISABLE_INCREMENTAL && (!THREADS || AO_HAVE_or)]
(async_set_pht_entry_from_index): Define to
set_pht_entry_from_index_concurrent.
Ivan Maidanski [Thu, 8 Nov 2018 22:05:51 +0000 (01:05 +0300)]
Eliminate redundant check in backwards_height
This eliminates 'the condition pred!=NULL is redundant' cppcheck warning.
* backgraph.c [MAKE_BACK_GRAPH] (backwards_height): Remove duplicate
pred!=NULL check (the case of NULL is already handled by
"if(NULL==pred)return 1" statement).
Ivan Maidanski [Thu, 8 Nov 2018 21:45:14 +0000 (00:45 +0300)]
Reduce scope of local variables in GC_remove_all_threads_but_me
This eliminates 'the scope of the variable can be reduced' cppcheck
warning in GC_remove_all_threads_but_me.
* pthread_support.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me):
Move p, next, me local variables to an inner scope there they are used.
* win32_threads.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me):
Move p, next local variables to an inner scope.
Ivan Maidanski [Thu, 8 Nov 2018 21:30:33 +0000 (00:30 +0300)]
Prevent double inclusion of javaxfc.h and private/specific.h
* include/javaxfc.h [GC_JAVAXFC_H]: Skip the whole header file.
* include/private/specific.h [GC_SPECIFIC_H]: Likewise.
* include/new_gc_alloc.h (GC_ALLOC_H): Rename to GC_NEW_ALLOC_H.
* include/private/dbg_mlc.h (_DBG_MLC_H): Rename to GC_DBG_MLC_H.
Ivan Maidanski [Thu, 8 Nov 2018 09:22:04 +0000 (12:22 +0300)]
Travis CI: Execute cppcheck without sudo and -U long
Ivan Maidanski [Wed, 7 Nov 2018 20:34:04 +0000 (23:34 +0300)]
Use GC_WORD_MAX macro across all C source files
(code refactoring)
* alloc.c (GC_collect_at_heapsize, GC_compute_heap_usage_percent,
GC_add_to_heap, GC_expand_hp_inner): Use GC_WORD_MAX instead of
(word)-1.
* dyn_load.c [DATASTART_IS_FUNC]
(GC_register_dynamic_libraries_dl_iterate_phdr): Likewise.
* finalize.c [KEEP_BACK_PTRS] (GC_notify_or_invoke_finalizers):
Likewise.
* headers.c (GC_install_counts): Likewise.
* include/private/thread_local_alloc.h [GC_GCJ_SUPPORT] (ERROR_FL):
Likewise.
* os_dep.c [NEED_FIND_LIMIT || USE_PROC_FOR_LIBRARIES] (GC_find_limit):
Likewise.
* os_dep.c [MPROTECT_VDB && DARWIN] (GC_mprotect_thread): Likewise.
* pthread_support.c [PARALLEL_MARK] (GC_mark_thread): Likewise.
* win32_threads.c (ADDR_LIMIT): Likewise.
* win32_threads.c [PARALLEL_MARK] (GC_mark_thread): Likewise.
* alloc.c (GC_least_plausible_heap_addr): Use GC_WORD_MAX instead of
ONES macro.
* include/private/gc_priv.h [STACK_GROWS_DOWN] (MAKE_COOLER): Likewise.
* mark.c (GC_set_hdr_marks): Likewise.
* alloc.c (GC_WORD_MAX): Remove definition (in this file).
* headers.c (GC_install_counts): Reformat code.
* include/private/gc_priv.h (ONES): Rename to GC_WORD_MAX.
Ivan Maidanski [Wed, 7 Nov 2018 20:01:31 +0000 (23:01 +0300)]
Add comment about hbp overflow in GC_install_counts
(fix of commit 6a32bb4)
Issue #245 (bdwgc).
* headers.c (GC_install_counts): Better comment for the case of
overflow.
Ivan Maidanski [Wed, 7 Nov 2018 19:47:02 +0000 (22:47 +0300)]
Eliminate 'unreferenced formal parameter' compiler warning in msvc_dbg
* extra/msvc_dbg.c (GetDescriptionFromAddress): Cast format argument
to void.
* extra/msvc_dbg.c (GetDescriptionFromStack): Pass format argument to
GetDescriptionFromAddress (instead of NULL).
Ivan Maidanski [Wed, 7 Nov 2018 07:15:31 +0000 (10:15 +0300)]
Workaround 'pointer addition with NULL pointer' cppcheck error in msvc_dbg
* extra/msvc_dbg.c (GetDescriptionFromStack): Change type of begin,
end, buffer local variables from char* to GC_ULONG_PTR; do not update
size local variable value; do not store elements to description[]
if description is NULL (instead of checking of size is non-zero).
Ivan Maidanski [Wed, 7 Nov 2018 07:00:21 +0000 (10:00 +0300)]
Remove strlen calls with a constant string argument in msvc_dbg
(code refactoring)
* extra/msvc_dbg.c (GetDescriptionFromAddress): Replace
strlen(<literal_str>) to sizeof(<literal_str>)-1.
Ivan Maidanski [Tue, 6 Nov 2018 22:11:23 +0000 (01:11 +0300)]
Use macro to operate on a flag residing in GC_stop_count
(code refactoring of commit
295a2f24e)
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]
(THREAD_RESTARTED): New macro.
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL] (GC_stop_count):
Refine comment.
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]
(GC_suspend_handler_inner, GC_stop_world, GC_restart_all): Use
THREAD_RESTARTED.
Ivan Maidanski [Tue, 6 Nov 2018 21:48:21 +0000 (00:48 +0300)]
Document assertion in the setters that used to return old value
(code refactoring)
* misc.c (GC_set_finalize_on_demand, GC_set_java_finalization,
GC_set_dont_expand, GC_set_no_dls, GC_set_max_retries,
GC_set_dont_precollect, GC_set_time_limit): Add comment about GC_ASSERT.
Ivan Maidanski [Tue, 6 Nov 2018 21:30:18 +0000 (00:30 +0300)]
Remove redundant type casts in backgraph HEIGHT_UNKNOWN/IN_PROGRESS
(code refactoring)
* backgraph.c [MAKE_BACK_GRAPH] (HEIGHT_UNKNOWN, HEIGHT_IN_PROGRESS):
Remove unneeded type cast (to signed_word).
Ivan Maidanski [Sun, 4 Nov 2018 09:10:40 +0000 (12:10 +0300)]
Appveyor CI: Test with cygwin (32-bit) configuration
Ivan Maidanski [Sun, 4 Nov 2018 08:59:11 +0000 (11:59 +0300)]
Fix hbp overflow in GC_install_counts
Issue #245 (bdwgc).
The overflow resulted in an infinite loop in GC_install_counts on Win32.
* headers.c (GC_install_counts): If hbp+=BOTTOM_SZ overflow is expected
then break the first loop.