Ivan Maidanski [Fri, 22 Mar 2019 21:02:55 +0000 (00:02 +0300)]
Remove 'current users' section from overview.md
Information about known BDWGC clients is moved to
https://github.com/ivmai/bdwgc/wiki/Known-clients
* doc/overview.md (Current users): Remove section.
* doc/overview.md (Information provided on the BDWGC site): Add a link
to the list of known clients.
Ivan Maidanski [Fri, 22 Mar 2019 16:44:35 +0000 (19:44 +0300)]
Use KB/MB/GB abbreviations uniformly across entire documentation
* README.md (Installation and Portability): Precede MB with a space.
* doc/README.amiga (WHATS NEW): Likewise.
* doc/debugging.md: Likewise.
* README.md (The C Interface to the Allocator): Replace Kbytes to KB.
* doc/gc.man: Likewise.
* README.Mac: Replace k to KB with a preceding space.
* doc/debugging.md: Likewise.
* doc/README.amiga: Precede MHz with a space.
* doc/debugging.md: Precede KB with a space.
* include/gc.h (GC_malloc_ignore_off_page): Replace K to KB with
a preceding space in a comment.
* tests/test.c (BIG): Likewise.
* include/private/gc_priv.h (ALL_INTERIOR_POINTERS, HBLKSIZE,
CPP_LOG_HBLKSIZE, LOG_PHT_ENTRIES): Likewise.
* include/private/gc_priv.h (LOG_PHT_ENTRIES): Replace M to MB with
a preceding space in a comment.
* include/private/gc_priv.h (LOG_PHT_ENTRIES): Replace G to GB with
a preceding space in a comment.
* os_dep.c [GC_USE_MEM_TOP_DOWN && USE_WINALLOC] (GC_mem_top_down):
Likewise.
* include/gc_priv.h (GC_printf): Replace k to KB with a preceding
space in a comment.
* include/private/specific.h (quick_thread_id): Likewise.
* os_dep.c [MSWINCE] (GC_wince_get_mem): Likewise.
* os_dep.c [USE_WINALLOC && !MSWIN_XBOX1 || CYGWIN32]
(GC_win32_get_mem): Likewise.
* include/private/gcconfig.h [I386 && LINUX] (HEAP_START): Precede GB
with a space in a comment.
Ivan Maidanski [Thu, 21 Mar 2019 07:43:12 +0000 (10:43 +0300)]
Remove documentation specific to particular old BDWGC releases
* doc/README.Mac: Remove mentioning of particular GC versions; adjust
the information (if needed) to match the current GC functionality.
* doc/README.amiga: Likewise.
* doc/README.arm.cross: Likewise.
* doc/README.autoconf: Likewise.
* doc/README.linux: Likewise.
* doc/README.macros (FINALIZE_ON_DEMAND, JAVA_FINALIZATION): Likewise.
* doc/README.sgi: Likewise.
* doc/README.solaris2 (SOLARIS THREADS): Likewise.
* doc/README.symbian: Likewise.
* doc/README.win32 (Threads): Likewise.
* doc/README.win64: Likewise.
* doc/gcdescr.md (Allocation, Thread support,
Thread-local allocation): Likewise.
* doc/gcinterface.md (GC_INIT): Likewise.
* doc/leak.md: Likewise.
* doc/porting.md (Additional requirements for a basic port,
Thread support): Likewise.
* doc/scale.md (Options for enhanced scalability, Performance):
Likewise.
* doc/simple_example.md (Debugging): Do not mention removed
`--enable-full-debug` option of configure.
* include/gc.h (GC_parallel, GC_dont_gc, GC_use_entire_heap,
GC_set_handle_fork): Remove comment that the behavior has changed in
a particular GC version.
* include/gc_inline.h (GC_MALLOC_WORDS_KIND): Likewise.
* include/gc.h (GC_set_free_space_divisor, GC_warn_proc): Reword
comment about ABI incompatible change in some GC version.
* include/gc.h (GC_get_heap_usage_safe): Remove comment that the API
was introduced in a particular GC version.
* include/gc_cpp.h (UseGC): Likewise.
* os_dep.c [LINUX_STACKBOTTOM && IA64] (GC_get_register_stack_base):
Remove mentioning of a particular GC version (and of an old behavior
on an ancient kernel) in a comment.
* win32_threads.c [!GC_PTHREADS && !GC_NO_THREADS_DISCOVERY]
(GC_DllMain): Likewise.
* OS2_MAKEFILE: Likewise.
Ivan Maidanski [Tue, 26 Feb 2019 22:32:53 +0000 (01:32 +0300)]
Avoid potential race in hb_sz access between realloc and reclaim_block
Issue #240 (bdwgc).
GC_realloc might be changing the block size while GC_reclaim_block
is examining it. The change to the size field is benign, i.e.
GC_reclaim would work correctly with either value, since we are not
changing the number of objects in the block. But seeing a half-updated
value (though unlikely to occur in practice) could be probably bad.
Using unordered atomic fetch of hb_sz field should solve the issue.
* reclaim.c (GC_block_nearly_full, GC_reclaim_small_nonempty_block):
Add sz argument; use sz instead of hhdr->hb_sz.
* reclaim.c (GC_reclaim_clear, GC_reclaim_uninit, GC_reclaim_check):
Skip the assertion about hhdr->hb_sz if THREADS.
* reclaim.c [ENABLE_DISCLAIM] (GC_disclaim_and_reclaim): Likewise.
* reclaim.c [AO_HAVE_load] (GC_reclaim_block): Use AO_load to access
hhdr->hb_sz; add comments.
* reclaim.c (GC_reclaim_block): Pass sz to
GC_reclaim_small_nonempty_block() and GC_block_nearly_full().
* reclaim.c (GC_continue_reclaim, GC_reclaim_all): Pass hhdr->hb_sz to
GC_reclaim_small_nonempty_block().
* reclaim.c [!EAGER_SWEEP && ENABLE_DISCLAIM]
(GC_reclaim_unconditionally_marked): Likewise.
Ivan Maidanski [Tue, 26 Feb 2019 21:48:12 +0000 (00:48 +0300)]
Fix 'duplicate symbol' error for tests using multiple static libs (OS X)
Issue #263 (bdwgc).
If configured with --enable-static, libtool passes libgc.a to gcc
twice (with a relative path and with an absolute one) when linking
tests that depend on libcord.a, libgccpp.a or libstaticrootslib_test.a
which, in turn, depends on libgc.a. Double specification of libgc.a
seems to confuse ld tool of MacOS 10.14.
The workaround is to omit libgc.la in *_LDADD specification of the
mentioned tests when the shared libraries are not requested, at least.
* configure.ac (ENABLE_SHARED): New AM_CONDITIONAL.
* cord/cord.am (cordtest_LDADD): Do not add libgc.la unless
ENABLE_SHARED; add comment.
* tests/tests.am (staticrootstest_LDADD): Likewise.
* tests/tests.am [CPLUSPLUS && !AVOID_CPP_LIB] (test_cpp_LDADD):
Likewise.
Ivan Maidanski [Fri, 15 Feb 2019 20:40:49 +0000 (23:40 +0300)]
Avoid unexpected heap growth in gctest caused by GC_disable
(fix of commit 8fc1ebf6d)
Issue #264 (bdwgc).
This commit eliminates the scenario when one thread disables garbage
collections while other threads intensively allocate memory objects.
* tests/test.c (run_one_test): Do not call GC_disable and GC_enable.
* tests/test.c (run_single_threaded_test): New function (which tests
GC_disable and GC_enable).
* tests/test.c (main): Call run_single_threaded_test() (before
check_heap_stats).
Ivan Maidanski [Thu, 14 Feb 2019 19:55:20 +0000 (22:55 +0300)]
Fix thread_info() count argument value (OS X)
* darwin_stop_world.c [DEBUG_THREADS || GC_ASSERTIONS]
(GC_thread_resume): Set outCount to THREAD_BASIC_INFO_COUNT (instead
of THREAD_INFO_MAX) to match the size of info passed to thread_info().
Ivan Maidanski [Wed, 13 Feb 2019 14:41:51 +0000 (17:41 +0300)]
Adjust printf calls in gctest check_heap_stats so that each has new-line
This is useful if GC_printf uses Android logging.
* tests/test.c (finalizable_count): Do not define if
GC_NO_FINALIZATION.
* tests/test.c (mktree): Do not increment finalizable_count if
GC_NO_FINALIZATION.
* tests/test.c (check_heap_stats): Do not print finalization counts
if GC_NO_FINALIZATION or GC_get_find_leak() is true; call GC_printf
to output finalization counts and the check result just once (i.e.
the whole line is printed in a single GC_printf call).
* tests/test.c [!NO_CLOCK] (check_heap_stats): Call GC_printf just
once to output "Completed <N> collections" together with the total
GC time value and the number of marker threads (i.e. the whole line
is printed in a single GC_printf call).
Hamayama [Thu, 7 Feb 2019 21:51:25 +0000 (00:51 +0300)]
Fix GetThreadContext stale register values use if WoW64 (Win32)
Issue #262 (bdwgc).
* misc.c [MSWIN32 && !MSWINRT_FLAVOR && !MSWIN_XBOX1]
(GC_win32_MessageBoxA): Do not define unless SMALL_CONFIG.
* misc.c [MSWIN32 && !_WIN64 && GC_WIN32_THREADS && CHECK_NOT_WOW64]
(GC_init): Do not call IsWow64Process() and GC_win32_MessageBoxA().
* win32_threads.c [I386] (isWow64): New static variable.
* win32_threads.c [I386] (GC_push_stack_for): If isWow64 then set also
CONTEXT_EXCEPTION_REQUEST and CONTEXT_SEGMENTS bits in ContextFlags;
if isWow64, and CONTEXT_EXCEPTION_REPORTING and
CONTEXT_EXCEPTION_ACTIVE are set on return from GetThreadContext then
call GetThreadSelectorEntry and use StackLimit of FS selector to set
sp local variable (instead of context.Esp); add comment.
* win32_threads.c [I386 && DEBUG_THREADS] (GC_push_stack_for): Call
GC_log_printf() to report TIB stack limit/base and the case when
CONTEXT_EXCEPTION_REQUEST is not supported.
* win32_threads.c [I386] (GC_thr_init): Set isWow64 by IsWow64Process()
if the later is available.
Ivan Maidanski [Mon, 21 Jan 2019 22:01:45 +0000 (01:01 +0300)]
Fix 'unexpected mark stack overflow' abort in push_all_stack
Issue #260 (bdwgc).
* mark.c [!NEED_FIXUP_POINTER] (GC_push_all_stack): Call
GC_push_all_eager() instead of GC_push_all() if GC_mark_stack_top is
rather close to GC_mark_stack_limit.
Ivan Maidanski [Fri, 4 Jan 2019 16:37:50 +0000 (19:37 +0300)]
Fix BSD_TIME variant of MS_TIME_DIFF for the case of a.tv_usec < b.tv_usec
(fix of commit 6b2796b69)
* include/private/gc_priv.h [!NO_CLOCK && BSD_TIME] (MS_TIME_DIFF):
Cast the result of a.tv_usec-b.tv_usec to long (so that the result of
the division should be negative if a.tv_usec is less than b.tv_usec).
Ivan Maidanski [Sat, 5 Jan 2019 08:52:53 +0000 (11:52 +0300)]
Fix invalid initializer of CLOCK_TYPE variables if BSD_TIME
(fix of commits 7e59301c1, 06ecaefca)
* alloc.c [!NO_CLOCK] (GC_start_time): Initialize to
CLOCK_TYPE_INITIALIZER (instead of 0).
* alloc.c [!NO_CLOCK] (GC_try_to_collect_inner, GC_stopped_mark,
GC_finish_collection): Initialize local variable of CLOCK_TYPE type to
CLOCK_TYPE_INITIALIZER (instead of 0); remove comment (duplicating that
in gc_priv.h).
* reclaim.c [!NO_CLOCK] (GC_reclaim_all): Likewise.
* include/private/gc_priv.h [!NO_CLOCK] (CLOCK_TYPE_INITIALIZER):
Define macro.
Ivan Maidanski [Sat, 29 Dec 2018 07:12:44 +0000 (10:12 +0300)]
Workaround 'me assigned value never used' cppcheck FP in register_my_thread
* pthread_support.c [CPPCHECK] (GC_register_my_thread): Call
GC_noop1(me->flags) after reassigning me to the result of
GC_register_my_thread_inner(sb,self).
* win32_threads.c [CPPCHECK] (GC_register_my_thread): Likewise.
Ivan Maidanski [Fri, 28 Dec 2018 21:50:34 +0000 (00:50 +0300)]
Travis CI: Workaround timeout of 'cppcheck --enable=unusedFunction --force'
"cppcheck --enable=unusedFunction --force extra/gc.c" takes longer than
the Travis CI timeout (50m), so gc.c is checked for unused functions
without --force option for now.
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 [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.
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: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.