Peter Wang [Thu, 22 Jun 2017 21:25:41 +0000 (00:25 +0300)]
Fix gctest failure if PARALLEL_MARK (musl)
Issue #159 (bdwgc).
The default stack size of threads in musl is not large enough for
GC with parallel markers enabled. This commit increases the stack
of the created threads to the required minimum.
* include/private/gcconfig.h [PARALLEL_MARK && (HPUX
|| GC_DGUX386_THREADS || NO_GETCONTEXT)] (DEFAULT_STACK_MAYBE_SMALL):
New macro; add TODO item.
* include/private/gcconfig.h [PARALLEL_MARK || THREADS] (MIN_STACK_SIZE):
New macro.
* pthread_support.c (MIN_STACK_SIZE): Do not define.
* pthread_support.c (GC_start_mark_threads_inner): Check
DEFAULT_STACK_MAYBE_SMALL macro instead of HPUX or GC_DGUX386_THREADS.
* pthread_support.c [DEFAULT_STACK_MAYBE_SMALL]
(GC_start_mark_threads_inner): Do not set stack size if old_size is 0.
* pthread_support.c [GC_ASSERTIONS] (WRAP_FUNC(pthread_create)): Use
MIN_STACK_SIZE in GC_ASSERT.
* tests/test.c [GC_PTHREADS && DEFAULT_STACK_MAYBE_SMALL]
(fork_a_thread): Set stack size of the created thread to MIN_STACK_SIZE.
* tests/test.c [GC_PTHREADS] (main): Set size of the created thread
also if DEFAULT_STACK_MAYBE_SMALL is defined.
Ivan Maidanski [Tue, 20 Jun 2017 22:07:12 +0000 (01:07 +0300)]
Better document minimum value of size argument for typed allocations
* include/gc_typed.h (GC_make_descriptor): Provide a better argument
name (in comment).
* include/gc_typed.h (GC_malloc_explicitly_typed,
GC_calloc_explicitly_typed): Explicitly state in comment that the
size of the object in words should not be less than the number of
significant bits in the specified descriptor.
Ivan Maidanski [Tue, 20 Jun 2017 21:42:44 +0000 (00:42 +0300)]
Add minimal testing of GC_set_bit (gctest)
* tests/test.c (typed_test): Initialize bm3, bm2 local variables to zero;
call GC_set_bit to setup bm3 and bm2 (instead of direct hard-coding of
bm3 and bm2 values during their initialization).
Hamayama [Tue, 20 Jun 2017 21:30:24 +0000 (00:30 +0300)]
Fix typed_test to prevent fails in malloc_explicitly_typed (64-bit)
Issue #166 (bdwgc).
* tests/test.c (typed_test): Pass 320*sizeof(word)+some_number instead
of 2000 to GC_malloc_explicitly_typed, so that to satisfy the size
argument requirement of the latter regardless of word size).
Ivan Maidanski [Tue, 20 Jun 2017 14:05:20 +0000 (17:05 +0300)]
Prevent abort in register_data_segments for Symbian and Emscripten
Issue #163 (bdwgc).
DATASTART is tested to have a non-null value in GC_register_data_segments,
so the macro should not be defined to null even if it is not really
used (null value typically means that the corresponding weak symbol
is not resolved).
* include/private/gcconfig.h [SYMBIAN || __EMSCRIPTEN__] (DATASTART,
DATAEND): Change to a non-null value (ALIGNMENT).
Ivan Maidanski [Tue, 20 Jun 2017 07:50:45 +0000 (10:50 +0300)]
Fix text formatting in gcinterface.md
(fix commit 0ac938d)
* doc/gcinterface.md (GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE): Do not break
"void *" with a new line.
* doc/gcinterface.md (C++ Interface, C interface): Use "##" (to
identify section title) instead of "#" (or "**").
Ivan Maidanski [Tue, 20 Jun 2017 07:31:44 +0000 (10:31 +0300)]
Convert overview.html, tree.html to Markdown format
* README.md: Replace overview.html with overview.md.
* doc/doc.am (dist_doc_DATA): Likewise.
* doc/doc.am (dist_doc_DATA): Replace tree.html with tree.md.
* doc/gcdescr.md (Mark phase): Likewise.
* doc/overview.html: Change file suffix to .md; convert text format
from HTML to Markdown.
* doc/tree.html: Likewise.
Ivan Maidanski [Fri, 16 Jun 2017 15:32:05 +0000 (18:32 +0300)]
Fix compiler intrinsics support check failure in 'make distcheck'
(fix commit 4c6be54)
* configure.ac [with_libatomic_ops=check] (CFLAGS): Add
-I${srcdir}/include -I${srcdir}/tests (instead of -Iinclude).
* configure.ac [with_libatomic_ops=check] (AC_TRY_RUN): Do not
specify folder in #include.
Ivan Maidanski [Fri, 16 Jun 2017 08:24:35 +0000 (11:24 +0300)]
Update bdwgc mailing list online archive link in documentation
* README.md (Feedback, Contribution, Questions and Notifications):
Update information about accessing the mailing list archive (add link
to that at Narkive site).
* doc/overview.html (Contacts and new release announcements): Replace
link to the mailing list archive at Gmane.org to that at Narkive.
Ivan Maidanski [Fri, 16 Jun 2017 07:45:02 +0000 (10:45 +0300)]
Update GCJ link in documentation
* doc/gcdescr.html: Replace http://gcc.gnu.org/java link (which now
points to GCC itself) with https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcj/
one.
* doc/overview.html: Likewise.
Ivan Maidanski [Thu, 15 Jun 2017 08:30:57 +0000 (11:30 +0300)]
Use compiler atomic intrinsics by default if available (configure)
* README.md (Installation and Portability): Update information about
libatomic_ops usage.
* configure.ac [with_libatomic_ops=check]: AC_TRY_RUN(test_atomic_ops.c)
(before PKG_CHECK_MODULES(ATOMIC_OPS)) with -D GC_BUILTIN_ATOMIC
added to CFLAGS; set with_libatomic_ops to none if test_atomic_ops
succeeds (unless cross-compiling).
Ivan Maidanski [Wed, 14 Jun 2017 09:16:00 +0000 (12:16 +0300)]
Add test_atomic_ops to perform minimal testing of used atomic primitives
The main purpose of test_atomic_ops is to be able to check whether
it is safe to use compiler atomic intrinsics (enabled by defining
GC_BUILTIN_ATOMIC macro).
* tests/test_atomic_ops.c: New file.
* tests/tests.am [THREADS] (TESTS, check_PROGRAMS): Add
test_atomic_ops.
* tests/tests.am [THREADS] (test_atomic_ops_SOURCES,
test_atomic_ops_LDADD): New variable.
* tests/tests.am (check-without-test-driver): Run test_atomic_ops (if
available).
Ivan Maidanski [Tue, 13 Jun 2017 18:31:52 +0000 (21:31 +0300)]
Update Download information in GC overview document
* doc/overview.html: Change Download page link to that on GitHub; add
BDWGC acronym; remove link to gc.tar.gz; recommend to download
"recent stable" version; remove link to ancient boehm-gc in gcc;
provide link to the list of changes (for each version).
* configure.ac (pthread_start_standalone): New variable.
* configure.ac [*-*-*linux* && THREADS=posix] (pthread_start_standalone):
Set to yes (instead of AM_CONDITIONAL(PTHREAD_START_STANDALONE) directly).
* configure.ac (PTHREAD_START_STANDALONE): AM_CONDITIONAL if
pthread_start_standalone.
Ivan Maidanski [Wed, 7 Jun 2017 21:42:30 +0000 (00:42 +0300)]
Support configure --disable-thread-local-alloc option (similar for CMake)
* CMakeLists.txt (enable_thread_local_alloc): New option (on by
default).
* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT
|| CMAKE_USE_WIN32_THREADS_INIT] (SRC): Add thread_local_alloc.c only
if enable_thread_local_alloc.
* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT
|| CMAKE_USE_WIN32_THREADS_INIT]: Define THREAD_LOCAL_ALLOC macro only
if enable_thread_local_alloc.
* Makefile.am (libgc_la_SOURCES): Add thread_local_alloc.c only if
THREAD_LOCAL_ALLOC.
* configure.ac (thread-local-alloc): New option.
* configure.ac: AC_DEFINE(THREAD_LOCAL_ALLOC) only if
enable_thread_local_alloc is yes or unset.
* configure.ac (THREAD_LOCAL_ALLOC): New AM_CONDITIONAL.
Ivan Maidanski [Wed, 7 Jun 2017 07:18:28 +0000 (10:18 +0300)]
Eliminate 'unused variable' compiler warning in remove_all_threads_but_me
(fix commit 0fc61f2)
* pthread_support.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me):
Declare "res" local variable only if THREAD_LOCAL_ALLOC and
not USE_CUSTOM_SPECIFIC.
Ivan Maidanski [Tue, 6 Jun 2017 07:30:50 +0000 (10:30 +0300)]
Update documentation about bugs reporting and new releases notification
* README.md (Download): Add link to BDWGC Download page on GitHub.
* README.md (Overview): Change link (for the further information) from
hboehm.info/gc to doc/overview.html.
* README.md (Bugs): Remove information about bugs reporting from this
section.
* README.md (Feedback, Contribution, Questions and Notifications): New
section.
* configure.ac (AC_INIT): Change URI for reporting bugs.
* doc/gc.man (SEE ALSO): Add link to the BDWGC main page on GitHub.
* doc/gcdescr.html: Remove information how to provide feedback.
* doc/overview.html (Contacts and Mailing List): Update information
(recommend use of GitHub and Stack Overflow, provide links to the
archives of the former mailing lists).
Ivan Maidanski [Tue, 30 May 2017 08:08:14 +0000 (11:08 +0300)]
Allow configure --with-libatomic-ops=none to use GCC atomic intrinsics
* configure.ac (libatomic-ops): Allow "none" value for
--with-libatomic-ops option; update help message; use "none" as the
default value if THREADS=none.
* configure.ac [with_libatomic_ops!=no]: Refine comment; call
PKG_CHECK_MODULES(ATOMIC_OPS) only if with_libatomic_ops!=none.
* configure.ac [with_libatomic_ops!=no] (which libatomic_ops to use):
If with_libatomic_ops = none and THREADS != none then
AC_MSG_RESULT(none) and AC_DEFINE(GC_BUILTIN_ATOMIC).
Fall back to AC_CHECK_HEADER-based detection of libatomic_ops library
if PKG_CHECK_MODULES failed to find the library.
* configure.ac [missing_libatomic_ops=true]: Call
AC_CHECK_HEADER(atomic_ops.h) and set missing_libatomic_ops=false if
atomic_ops.h is found; add comment.
Ivan Maidanski [Mon, 29 May 2017 07:37:12 +0000 (10:37 +0300)]
Do not require libatomic_ops for single-threaded builds (configure)
* configure.ac [with_libatomic_ops!=no]: Do not call
PKG_CHECK_MODULES(ATOMIC_OPS) if THREADS = none
* configure.ac [with_libatomic_ops!=no] (which libatomic_ops to use):
Report "none" if if THREADS = none.
uClibc defines __GLIBC__ but does not contain libc-version.h file.
* include/private/gcconfig.h [(I386 || X86_64) && LINUX && __GLIBC__]
(GLIBC_2_19_TSX_BUG): Do not define (and do not include
gnu/libc-version.h) if __UCLIBC__.
Ivan Maidanski [Tue, 23 May 2017 06:23:54 +0000 (09:23 +0300)]
Workaround 'comparison of identical expressions' false code defects
* thread_local_alloc.c [THREAD_LOCAL_ALLOC] (GC_init_thread_local):
New local variable (res); save result of GC_setspecific and
GC_key_create to res; replace res!=0 with COVERT_DATAFLOW(res)!=0.
* pthread_support.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me):
Likewise.
Ivan Maidanski [Mon, 22 May 2017 22:01:08 +0000 (01:01 +0300)]
Workaround 'array compared to 0', 'untrusted loop bound' false defects
* dyn_load.c [SOLARISDL && !USE_PROC_FOR_LIBRARIES]
(GC_FirstDLOpenedLinkMap): Wrap access to dynStructureAddr (which value
obtained from a weak symbol) into COVERT_DATAFLOW() in comparison to 0.
* dyn_load.c [HAVE_DL_ITERATE_PHDR && !DL_ITERATE_PHDR_STRONG]
(GC_register_main_static_data): Wrap access to dl_iterate_phdr weak
symbol into COVERT_DATAFLOW() in comparison to 0.
* dyn_load.c [HAVE_DL_ITERATE_PHDR] (GC_FirstDLOpenedLinkMap): Wrap
access to _DYNAMIC weak symbol into COVERT_DATAFLOW() in comparison to 0.
* include/private/gc_priv.h (TRUSTED_STRING): Pass the argument through
COVERT_DATAFLOW.
* include/private/gcconfig.h (COVERT_DATAFLOW): New macro.
* os_dep.c [SEARCH_FOR_DATA_START] (GC_init_linux_data_start): Wrap
access to __data_start and GC_data_start into COVERT_DATAFLOW() in
comparison to 0.
* tests/disclaim_bench.c: Update comment for include gc_priv.h.
* tests/disclaim_bench.c (main): Pass the integer value obtained from
command-line argument (and which is used as a loop boundary) through
COVERT_DATAFLOW().
* tests/test_cpp.cc (main): Likewise.
Ivan Maidanski [Mon, 22 May 2017 06:06:24 +0000 (09:06 +0300)]
Remove duplicated sample code in leak.md
* doc/leak.md (Example): Remove code snippets which are similar to
that of include/leak_detector.h and leak_test.c; replace
GC_find_leak=1 with GC_set_find_leak(1).
Ivan Maidanski [Fri, 19 May 2017 15:55:29 +0000 (18:55 +0300)]
Convert some (small) .html files to Markdown format
The "doc" files converted: debugging.html, finalization.html,
leak.html, porting.html, scale.html, simple_example.html.
* README.md: Replace leak.html with leak.md; replace debugging.html with
debugging.md.
* doc/debugging.html: Change file suffix to .md; convert text format
from HTML to Markdown.
* doc/finalization.html: Likewise.
* doc/leak.html: Likewise.
* doc/porting.html: Likewise.
* doc/scale.html: Likewise.
* doc/simple_example.html: Likewise.
* doc/gcdescr.html: Replace scale.html with scale.md; replace
finalization.html with finalization.md.
* doc/gcinterface.html: Likewise.
* doc/doc.am (dist_doc_DATA): Rename doc/debugging.html to
doc/debugging.md, finalization.html to finalization.md, leak.html to
leak.md, porting.html to porting.md, scale.html to scale.md,
simple_example.html to simple_example.md.
* doc/overview.html: Replace simple_example.html with
simple_example.md; replace leak.html with leak.md; replace scale.html
with scale.md; replace finalization.html with finalization.md; replace
debugging.html with debugging.md.
Ivan Maidanski [Fri, 5 May 2017 18:04:25 +0000 (21:04 +0300)]
Update documentation as parallel mark is now on by default in configure
(fix commit c7f2147)
* configure.ac (parallel-mark): Provide information about
--disable-parallel-mark option instead of --enable-parallel-mark.
* doc/README.autoconf (Important options): Likewise.
* doc/README.solaris2: Likewise.
* doc/simple_example.html: Likewise.
* doc/README.DGUX386: Remove configure --enable-parallel-mark option
(as it is on by default now).
* doc/README.autoconf (Important options): Do not provide information
about --enable-full-debug which is no longer supported (since v7.0).
* doc/gcinterface.html: update information about parallel marker mode
in configure.
* doc/README.solaris2: Provide information about --disable-threads
option instead of --enable-threads=posix.
* doc/simple_example.html: Likewise.
Ivan Maidanski [Thu, 4 May 2017 11:17:37 +0000 (14:17 +0300)]
Align IRIX/OSF1_THREADS definition in gc_config_macros.h with gcconfig.h
The condition of defining GC_IRIX_THREADS and GC_OSF1_THREADS
(if GC_THREADS) in gc_config_macros.h is now the same as that of
IRIX5 and OSF1 macros in gcconfig.h, respectively.
* include/gc_config_macros.h [GC_THREADS] (GC_HPUX_THREADS,
GC_SOLARIS_THREADS): Replace !defined(__linux__) with "#elif".
* include/gc_config_macros.h [GC_THREADS] (GC_OPENBSD_THREADS,
GC_FREEBSD_THREADS, GC_NETBSD_THREADS): Handle the case before
GC_OSF1_THREADS, GC_IRIX_THREADS, GC_SOLARIS_THREADS, GC_DARWIN_THREADS;
remove FIXME.
* include/gc_config_macros.h [GC_THREADS] (GC_IRIX_THREADS): Check
mips and _mips predefined macros in addition to __mips; do not define
if any of [_]nec_ews, [__]ultrix predefined macro is defined.
Ivan Maidanski [Thu, 27 Apr 2017 07:56:08 +0000 (10:56 +0300)]
Update GC compilation and usage notes for Win32
* doc/README.win32: Remove note that cord test is not ported; do not
refer to GC 6.1alpha4.
* doc/README.win32 (Microsoft Tools): Eliminate gctest description
duplication; remove outdated note that static library is normal in
case of absence of thread support.
* doc/README.win32 (GNU Tools): Add note that MinGW build could be
performed on a Windows host; update information about parallel marker
(it is on by default now).
* doc/README.win32 (Threads): Update information about the default
status of threads support in ./configure; mention CMakeLists.txt as
well; refine information about pthread_create/exit calls in Cygwin;
refine information about GC_CreateThread and GC_INIT.
Ivan Maidanski [Sat, 22 Apr 2017 15:21:09 +0000 (18:21 +0300)]
Turn on parallel marker by default for all multi-threaded builds
Note: if some target does not support PARALLEL_MARK, it should be
fixed (or a workaround should be added).
* CMakeLists.txt (enable_parallel_mark): Change default value to ON.
* CMakeLists.txt [enable_parallel_mark] (PARALLEL_MARK): Define only
along with GC_LINUX_THREADS, or GC_AIX_THREADS, or GC_HPUX_THREADS, or
GC_OPENBSD_THREADS, or GC_FREEBSD_THREADS, or GC_NETBSD_THREADS, or
GC_SOLARIS_THREADS, or GC_IRIX_THREADS, or GC_THREADS, or
GC_DARWIN_THREADS, or GC_OSF1_THREADS.
* configure.ac (PARALLEL_MARK): Always define unless threads are
disabled or enable_parallel_mark is "no".