platform/upstream/libgc.git
7 years agoSimplify THREAD_TABLE_INDEX expression for Win32/64
Ivan Maidanski [Fri, 25 Aug 2017 06:53:07 +0000 (09:53 +0300)]
Simplify THREAD_TABLE_INDEX expression for Win32/64
(fix commit 85fce54)

Windows thread Id rarely has non-zero highest half of DWORD, so
it is OK to use only the lowest one for hash value computation.

* win32_threads.c (THREAD_TABLE_INDEX): Remove (id>>16) from the
expression.

7 years agoAdd debug logging to new_thread about GC_threads hash table collisions
Ivan Maidanski [Thu, 24 Aug 2017 22:05:16 +0000 (01:05 +0300)]
Add debug logging to new_thread about GC_threads hash table collisions

* pthread_support.c [DEBUG_THREADS] (GC_new_thread): Call GC_log_printf
(with the appropriate message) if a GC_threads[] entry already exists
at the given hv index (excluding the detached threads those id is
already reused).
* win32_threads.c [DEBUG_THREADS] (GC_new_thread): Call GC_log_printf
to report that a new thread is created; call GC_log_printf (with the
appropriate message) if a GC_threads[] entry already exists at the
given hv index; remove useless comment about the result of
GC_INTERNAL_MALLOC.

7 years agoEliminate most of collisions in GC_threads on Linux/x64
Ivan Maidanski [Thu, 24 Aug 2017 08:34:05 +0000 (11:34 +0300)]
Eliminate most of collisions in GC_threads on Linux/x64

On some targets (e.g., Linux/x64) pthread_t values always have zero
in the lowest byte (e.g. if pthread_t is actually a page-aligned
pointer) thus causing all the created thread descriptors to have
a collision at GC_threads[0].  This commit mixes 3 lowest bytes
of thread id with a XOR operation (thus greatly reduces the
probability of collisions in GC_threads).

* include/private/pthread_support.h (THREAD_TABLE_SZ): Do not
define if already defined; refine comment.
* pthread_support.c (THREAD_TABLE_INDEX): New macro (similar to that
in win32_threads.c).
* pthread_support.c (GC_new_thread, GC_delete_thread,
GC_delete_gc_thread, GC_lookup_thread): Replace
NUMERIC_THREAD_ID(id)%THREAD_TABLE_SZ to THREAD_TABLE_INDEX(id).
* pthread_support.c (GC_lookup_thread): Remove hv local variable.
* win32_threads.c (THREAD_TABLE_INDEX): Replace (id>>2) to
((id>>16)^(id>>8)^id).
* win32_threads.c [GC_PTHREADS] (GC_lookup_pthread): Define win32_id
local variable to pass it to THREAD_TABLE_INDEX() instead of passing
GET_PTHREAD_MAP_CACHE(id) directly.

7 years agoChange type of THREAD_TABLE_INDEX result to int in win32_threads.c
Ivan Maidanski [Wed, 23 Aug 2017 08:46:41 +0000 (11:46 +0300)]
Change type of THREAD_TABLE_INDEX result to int in win32_threads.c
(code refactoring)

* win32_threads.c (THREAD_TABLE_INDEX): Cast result to int; remove cast
of argument to word type; add comment.
* win32_threads.c (GC_new_thread, GC_delete_gc_thread_no_free,
GC_delete_thread): Change type of hv local variable from word to int.
* win32_threads.c (GC_lookup_thread_inner): Remove hv local variable;
remove "register" keyword for p local variable.
* win32_threads.c (GC_lookup_pthread): Change type of hv_guess local
variable from word to int.

7 years agoFix deadlock in GC_help_marker caused by use of mark_cv of parent process
Ivan Maidanski [Tue, 22 Aug 2017 08:23:27 +0000 (11:23 +0300)]
Fix deadlock in GC_help_marker caused by use of mark_cv of parent process

The marker threads of the parent process are blocked on mark_cv at
fork.  So pthread_cond_wait() malfunction (hang) is possible in the
child process without mark_cv state cleanup (reinitialization).

* pthread_support.c [PARALLEL_MARK] (mark_cv): Move static variable
definition upper to be before GC_start_mark_threads_inner).
* win32_threads.c [GC_PTHREADS_PARAMARK] (mark_cv): Likewise.
* pthread_support.c [PARALLEL_MARK && CAN_HANDLE_FORK] (mark_cv):
Do not initialize statically; add comment.
* win32_threads.c [GC_PTHREADS_PARAMARK && CAN_HANDLE_FORK] (mark_cv):
Likewise.
* pthread_support.c [PARALLEL_MARK && CAN_HANDLE_FORK]
(GC_start_mark_threads_inner): Initialize mark_cv to
PTHREAD_COND_INITIALIZER (unless available_markers_m1 <= 0 or
GC_parallel); add comment.
* win32_threads.c [GC_PTHREADS_PARAMARK && CAN_HANDLE_FORK]
(GC_start_mark_threads_inner): Likewise.
* pthread_support.c [PARALLEL_MARK] (GC_wait_marker,
GC_notify_all_marker): Add assertion that GC_parallel is true (so
mark_cv is initialized).
* win32_threads.c [GC_PTHREADS_PARAMARK] (GC_wait_marker,
GC_notify_all_marker): Likewise.

7 years agoTravis CI: Test some --enable-munmap configurations with disable incremental collection
Ivan Maidanski [Tue, 22 Aug 2017 06:09:04 +0000 (09:09 +0300)]
Travis CI: Test some --enable-munmap configurations with disable incremental collection

7 years agoAvoid busy waiting in mark_thread while GC_parallel is false
Ivan Maidanski [Tue, 22 Aug 2017 05:56:31 +0000 (08:56 +0300)]
Avoid busy waiting in mark_thread while GC_parallel is false

* mark.c [PARALLEL_MARK] (GC_help_marker): Add assertion that
GC_parallel is true (i.e. GC_markers_m1 is non-zero).
* pthread_support.c [PARALLEL_MARK && CAN_HANDLE_FORK]
(GC_start_mark_threads_inner): Set GC_markers_m1 value before starting
the first marker thread (it is already set if fork handling is off).
* win32_threads.c [GC_PTHREADS_PARAMARK && CAN_HANDLE_FORK]
(GC_start_mark_threads_inner): Likewise.
* pthread_support.c [PARALLEL_MARK] (GC_start_mark_threads_inner):
Adjust GC_markers_m1 value only if pthread_create failed.
* win32_threads.c [GC_PTHREADS_PARAMARK] (GC_start_mark_threads_inner):
Likewise.

7 years agoEliminate unsigned fl_builder_count underflow in mark_thread
Ivan Maidanski [Mon, 21 Aug 2017 22:09:59 +0000 (01:09 +0300)]
Eliminate unsigned fl_builder_count underflow in mark_thread
(refactor commit 0ca6d3f)

* include/private/gc_priv.h [PARALLEL_MARK] (GC_fl_builder_count):
Change type from word to signed_word.
* reclaim.c [PARALLEL_MARK] (GC_fl_builder_count): Likewise.
* mark.c [PARALLEL_MARK] (GC_wait_for_markers_init): Change type of
count local variable to signed_word; add assertion that count is
non-negative.
* pthread_support.c [PARALLEL_MARK] (GC_mark_thread): Add comment that
GC_fl_builder_count can be negative here.
* win32_threads.c [PARALLEL_MARK] (GC_mark_thread): Likewise.
* reclaim.c [PARALLEL_MARK] (GC_fl_builder_count): Refine comment.

7 years agoAdd assertion that no hb_n_marks underflow occurs
Ivan Maidanski [Sat, 19 Aug 2017 15:46:59 +0000 (18:46 +0300)]
Add assertion that no hb_n_marks underflow occurs

Issue #177 (bdwgc).

* alloc.c (GC_clear_fl_marks): Add GC_ASSERT that hhdr->hb_n_marks
is non-zero before decrementing it.
* mark.c (GC_clear_mark_bit): Likewise.

7 years agoFix hb_n_marks underflow in clear_fl_marks if MARK_BIT_PER_OBJ
Ivan Maidanski [Sat, 19 Aug 2017 15:22:37 +0000 (18:22 +0300)]
Fix hb_n_marks underflow in clear_fl_marks if MARK_BIT_PER_OBJ

Issue #177 (bdwgc).

* mark.c [MARK_BIT_PER_OBJ] (GC_set_hdr_marks): Set hhdr->hb_n_marks
exactly to n_marks value (without a decrement by one).

7 years agoUse MARK_BIT_PER_GRANULE instead of MARK_BIT_PER_OBJ where appropriate
Ivan Maidanski [Sat, 19 Aug 2017 14:43:11 +0000 (17:43 +0300)]
Use MARK_BIT_PER_GRANULE instead of MARK_BIT_PER_OBJ where appropriate
(code refactoring)

* allchblk.c (setup_header): Use "ifdef MARK_BIT_PER_GRANULE" instead
of "ifndef MARK_BIT_PER_OBJ".
* mallocx.c (GC_realloc): Likewise.

7 years agoUpdate ChangeLog file
Ivan Maidanski [Thu, 17 Aug 2017 21:06:37 +0000 (00:06 +0300)]
Update ChangeLog file

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Thu, 17 Aug 2017 20:13:47 +0000 (23:13 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Thu, 17 Aug 2017 07:54:27 +0000 (10:54 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

7 years agoFix visibility of __asan_default_options in case of shared library
Ivan Maidanski [Wed, 16 Aug 2017 22:39:16 +0000 (01:39 +0300)]
Fix visibility of __asan_default_options in case of shared library
(fix commit ce75cf1)

* os_dep.c [ADDRESS_SANITIZER && (UNIX_LIKE || NEED_FIND_LIMIT
|| MPROTECT_VDB)] (__asan_default_options): Do not define if
CUSTOM_ASAN_DEF_OPTIONS is defined; export it (use GC_API).

7 years agoEliminate '-pedantic is not an option that controls warnings' GCC message
Ivan Maidanski [Wed, 16 Aug 2017 08:23:49 +0000 (11:23 +0300)]
Eliminate '-pedantic is not an option that controls warnings' GCC message
(fix commit 84c0313)

* mark.c [WRAP_MARK_SOME && (MSWIN32 || MSWINCE) && __GNUC__]
(GC_mark_some): Use "-Wpedantic" instead of "-pedantic" (in pragma
GCC diagnostic) if GCC v7+.

7 years agoRemove redundant check that clear_fl_marks argument is non-null
Ivan Maidanski [Mon, 14 Aug 2017 08:01:57 +0000 (11:01 +0300)]
Remove redundant check that clear_fl_marks argument is non-null
(code refactoring)

* alloc.c (GC_clear_fl_marks): Do not check that q is not null (because
it is checked by the caller).

7 years agoAllow gctest and thread_leak_test with zero NTHREADS
Ivan Maidanski [Wed, 9 Aug 2017 21:47:18 +0000 (00:47 +0300)]
Allow gctest and thread_leak_test with zero NTHREADS

* tests/test.c [GC_PTHREADS || GC_WIN32_THREADS] (reverse_test_inner):
Do not call fork_a_thread() if NTHREADS is 0.
* tests/test.c (MAX_FINALIZED): Increase to be correct for the case of
NTHREADS is 0.
* tests/test.c [GC_PTHREADS] (main): Do not declare and do not use th,
i local variables if NTHREADS is 0.
* tests/thread_leak_test.c (NTHREADS): Do not define if already defined.
* tests/thread_leak_test.c (main):  Do not declare and do not use i,
code, t, thread_id local variables if NTHREADS is 0.

7 years agoFix array_mark_proc to request global mark stack growth on overflow
Ivan Maidanski [Wed, 9 Aug 2017 08:35:25 +0000 (11:35 +0300)]
Fix array_mark_proc to request global mark stack growth on overflow
(fix commit 3f06655)

* typd_mlc.c [PARALLEL_MARK] (GC_array_mark_proc): Set
GC_mark_stack_too_small to true if GC_push_complex_descriptor()
returned null and mark_stack_limit belongs to the global mark stack
(even if GC_parallel is true).

7 years agoDo not call BCOPY and BZERO if size is zero
Ivan Maidanski [Wed, 9 Aug 2017 08:10:38 +0000 (11:10 +0300)]
Do not call BCOPY and BZERO if size is zero

* dbg_mlc.c (GC_debug_strndup): Do not call BCOPY() if elements count
is zero.
* dbg_mlc.c (GC_debug_realloc): Likewise.
* finalize.c [!GC_TOGGLE_REFS_NOT_NEEDED] (ensure_toggleref_capacity):
Likewise.
* malloc.c [REDIRECT_MALLOC && !strndup] (strndup): Likewise.
* mallocx.c (GC_strndup): Likewise.
* misc.c [!GC_GET_HEAP_USAGE_NOT_NEEDED] (GC_get_prof_stats): Likewise.
* os_dep.c [SAVE_CALL_CHAIN && GC_HAVE_BUILTIN_BACKTRACE]
(GC_save_callers): Likewise.
* reclaim.c (GC_print_all_errors): Likewise.
* malloc.c (GC_free): Do not call BZERO() if elements count is zero.
* malloc.c [THREADS] (GC_free_inner): Likewise.
* reclaim.c (GC_print_all_errors): Likewise.
* misc.c [!GC_GET_HEAP_USAGE_NOT_NEEDED && THREADS]
(GC_get_prof_stats_unsafe): Do not call fill_prof_stats() and BCOPY()
if stats_sz is zero.

7 years agoFix leak_test crash in print_callers if free() is redirected
Ivan Maidanski [Mon, 7 Aug 2017 08:37:30 +0000 (11:37 +0300)]
Fix leak_test crash in print_callers if free() is redirected

* dbg_mlc.c [REDIRECT_MALLOC && (GC_LINUX_THREADS || GC_SOLARIS_THREADS
|| MSWIN32 || NEED_CALLINFO && GC_HAVE_BUILTIN_BACKTRACE)]
(GC_debug_free): If the object is not in the GC heap then just return
(instead of ABORT).
* malloc.c [REDIRECT_MALLOC && NEED_CALLINFO
&& GC_HAVE_BUILTIN_BACKTRACE] (GC_free): If hhdr is null (i.e. the
object is not in the GC heap) then return without the object
deallocation; add comment.
* os_dep.c [NEED_CALLINFO && GC_HAVE_BUILTIN_BACKTRACE
&& !GC_BACKTRACE_SYMBOLS_BROKEN] (GC_print_callers): Adjust comment
for free().

7 years agoRefine collect_a_little documentation (better explain when 0 is returned)
Ivan Maidanski [Thu, 3 Aug 2017 22:09:34 +0000 (01:09 +0300)]
Refine collect_a_little documentation (better explain when 0 is returned)

Issue #64 (bdwgc).

* include/gc.h (GC_collect_a_little): Refine comment.

7 years agoTravis CI: Test configure --disable-docs
Ivan Maidanski [Thu, 3 Aug 2017 21:49:57 +0000 (00:49 +0300)]
Travis CI: Test configure --disable-docs

7 years agoDo not install documentation if configure --disable-docs (new option)
Ivan Maidanski [Thu, 3 Aug 2017 21:47:56 +0000 (00:47 +0300)]
Do not install documentation if configure --disable-docs (new option)

* configure.ac (docs): New AC_ARG_ENABLE.
* configure.ac (ENABLE_DOCS): New AM_CONDITIONAL.
* doc/doc.am (dist_doc_DATA): Define only if ENABLE_DOCS.

7 years agoFix undefined HEAP_START in register_dynamic_libraries
Ivan Maidanski [Wed, 2 Aug 2017 21:37:09 +0000 (00:37 +0300)]
Fix undefined HEAP_START in register_dynamic_libraries

* include/private/gcconfig.h [!HEAP_START] (HEAP_START): Define to 0 by
default (if not previously defined in the file).
* os_dep.c (HEAP_START): Remove.

7 years agoFix bytes count passed to add_to_our_memory in backgraph new_back_edges
Ivan Maidanski [Wed, 2 Aug 2017 08:13:23 +0000 (11:13 +0300)]
Fix bytes count passed to add_to_our_memory in backgraph new_back_edges
(fix commit 180b56c)

* backgraph.c [MAKE_BACK_GRAPH] (new_back_edges): Pass bytes_to_get to
GC_add_to_our_memory() (i.e. pass the same number of bytes as passed
to GET_MEM() even in case of MMAP_SUPPORTED).

7 years agoUse heap-allocated memory for local mark stack of non-marker thread
Ivan Maidanski [Tue, 1 Aug 2017 22:13:37 +0000 (01:13 +0300)]
Use heap-allocated memory for local mark stack of non-marker thread

Issue #159 (bdwgc).

The memory is allocated using GET_MEM to avoid to make sure that
it is not accidentally scanned by the collector.

* include/private/gcconfig.h [!PARALLEL_MARK && THREADS]
(MIN_STACK_SIZE): Do not define.
* include/private/gcconfig.h [PARALLEL_MARK] (MIN_STACK_SIZE): Add
comment.
* mark.c [PARALLEL_MARK] (main_local_mark_stack): New static variable.
* mark.c [PARALLEL_MARK] (GC_wait_for_markers_init): Declare bytes_to_get
local variable; allocate local mark stack (using GET_MEM) and set
main_local_mark_stack (if not yet allocated by the parent process).
* mark [PARALLEL_MARK] (GC_do_parallel_mark): Remove local_mark_stack
huge local variable; use main_local_mark_stack instead of
local_mark_stack.
* pthread_support.c [GC_ASSERTIONS] (WRAP_FUNC(pthread_create)): Use
hard-coded value (65536) instead of MIN_STACK_SIZE in GC_ASSERT.
* tests/test.c [GC_PTHREADS && DEFAULT_STACK_MAYBE_SMALL]
(fork_a_thread): Do not set stack size for the created threads.
* tests/test.c [GC_PTHREADS] (main): Do not check
DEFAULT_STACK_MAYBE_SMALL.

7 years agoFix 'use' word omission in ChangeLog
Ivan Maidanski [Mon, 31 Jul 2017 08:02:13 +0000 (11:02 +0300)]
Fix 'use' word omission in ChangeLog
(fix commit 1784ac2)

7 years agoDo not use asm in GC_pause
Ivan Maidanski [Mon, 31 Jul 2017 07:57:14 +0000 (10:57 +0300)]
Do not use asm in GC_pause

* pthread_support.c [GC_PTHREADS && !GC_WIN32_THREADS
&& (USE_SPIN_LOCK || !NO_PTHREAD_TRYLOCK)] (GC_PAUSE_SPIN_CYCLES): New
macro.
* pthread_support.c [GC_PTHREADS && !GC_WIN32_THREADS
&& (USE_SPIN_LOCK || !NO_PTHREAD_TRYLOCK)] (GC_pause): Replace "10"
with GC_PAUSE_SPIN_CYCLES; remove "dummy" local variable; use
AO_compiler_barrier() instead of __asm__("") and GC_noop1(++dummy).

7 years agoNew API function (GC_is_incremental_mode)
Ivan Maidanski [Fri, 21 Jul 2017 18:42:18 +0000 (21:42 +0300)]
New API function (GC_is_incremental_mode)

* alloc.c (GC_is_incremental_mode): New public function definition.
* include/gc.h (GC_full_freq): Update comment.
* include/gc.h (GC_is_incremental_mode): New public function
declaration.
* tests/test.c [!GC_WIN32_THREADS && !GC_PTHREADS] (main): Print
"Switched to incremental mode" and friend messages only if
GC_is_incremental_mode().
* tests/test.c [!GC_PTHREADS] (main): Likewise.

7 years agoFix GC_incremental declaration/definition type mismatch
Ivan Maidanski [Fri, 21 Jul 2017 17:59:55 +0000 (20:59 +0300)]
Fix GC_incremental declaration/definition type mismatch

* alloc.c [!GC_DISABLE_INCREMENTAL] (GC_incremental): Change variable
type from int to GC_bool (to match that of the declaration in
gc_priv.h).

7 years agoFix deadlock in GC_suspend_thread when thread is rebuilding free list
Ivan Maidanski [Fri, 21 Jul 2017 17:27:12 +0000 (20:27 +0300)]
Fix deadlock in GC_suspend_thread when thread is rebuilding free list
(fix commits 62097c3, 59e2bcf)

* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD] (GC_suspend_thread):
Move DISABLE_CANCEL() upper to cover also GC_wait_for_reclaim() and
RAISE_SIGNAL() calls.
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD && PARALLEL_MARK]
(GC_suspend_thread): If GC_parallel then call GC_wait_for_reclaim()
holding the allocation lock before RAISE_SIGNAL() call; add comment.

7 years agoWorkaround false 'uninitialized var use' code defect (initsecondarythread)
Ivan Maidanski [Fri, 21 Jul 2017 16:34:10 +0000 (19:34 +0300)]
Workaround false 'uninitialized var use' code defect (initsecondarythread)

* tests/initsecondarythread.c [GC_PTHREADS && LINT2] (main): Initialize
"t" local variable to some value (e.g. result of pthread_create()).

7 years agoEliminate CSA warning of non-virtual destructor in test_cpp base class
Ivan Maidanski [Fri, 21 Jul 2017 15:32:22 +0000 (18:32 +0300)]
Eliminate CSA warning of non-virtual destructor in test_cpp base class

* tests/test_cpp.cc (B::~B): Make the destructor virtual.

7 years agoEliminate CSA warning about incorrect cast applied to HBLK_OBJS
Ivan Maidanski [Fri, 21 Jul 2017 15:17:06 +0000 (18:17 +0300)]
Eliminate CSA warning about incorrect cast applied to HBLK_OBJS

HBLK_OBJS() expects the argument value and has the result value of
size_t type.

* reclaim.c (GC_print_block_descr): Cast result of HBLK_OBJS() to
unsigned int instead of casting its argument.

7 years agoEliminate CSA warning about narrowing cast in CleanUp of test_cpp
Ivan Maidanski [Fri, 21 Jul 2017 14:21:02 +0000 (17:21 +0300)]
Eliminate CSA warning about narrowing cast in CleanUp of test_cpp

* tests/test_cpp.cc (D::CleanUp): Cast self->i to word instead of
casting (word)data to int in comparison.

7 years agoEliminate CSA warning of staticroot that can be a local variable (tests)
Ivan Maidanski [Fri, 21 Jul 2017 08:01:01 +0000 (11:01 +0300)]
Eliminate CSA warning of staticroot that can be a local variable (tests)

* tests/staticrootstest.c (staticroot): Remove redundant initialization
to zero; add comment.
* tests/staticrootstest.c (init_staticroot): New function; move
staticroot=libsrl_init() from main(); add comment.
* tests/staticrootstest.c (main): Call init_staticroot().

7 years agoEliminate CSA warning of unmodified non-const static var (disclaim_test)
Ivan Maidanski [Thu, 20 Jul 2017 21:44:05 +0000 (00:44 +0300)]
Eliminate CSA warning of unmodified non-const static var (disclaim_test)
(fix commit 7b0be48)

* tests/disclaim_test.c (pair_magic): Make it const itself.

7 years agoDo not use tkill (Android)
Ivan Maidanski [Thu, 20 Jul 2017 09:11:22 +0000 (12:11 +0300)]
Do not use tkill (Android)

tkill() has been deprecated in Android.  Starting from NDK r11 (which
introduced android-23 API), the call exists only in libc.a (but not
in libc.so).  The comment in Bionic says that tkill exists only for
Mono clients (and only for 32-bit targets).

* include/private/gcconfig.h [PLATFORM_ANDROID && CPP_WORDSZ==32]
(USE_TKILL_ON_ANDROID): Do not define if __ANDROID_API__ >= 23; add
comment.

7 years agoSpecify that unused select() result is intentional
Ivan Maidanski [Thu, 20 Jul 2017 08:50:04 +0000 (11:50 +0300)]
Specify that unused select() result is intentional
(fix commit 62097c3)

* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD]
(GC_brief_async_signal_safe_sleep): Cast select() result to void.

7 years agoReplace deprecated rewind to fseek in cordxtra
Ivan Maidanski [Thu, 20 Jul 2017 08:39:29 +0000 (11:39 +0300)]
Replace deprecated rewind to fseek in cordxtra

rewind (unlike fseek) does not report whether the operation failed.

* cord/cordxtra.c (CORD_from_file_lazy_inner, CORD_from_file_lazy,
CORD_from_file): Replace rewind(f) to fseek(f, 0l, SEEK_SET) with
error checking; adjust ABORT message in case of fseek and ftell failure.

7 years agoUpdate AUTHORS file
Ivan Maidanski [Wed, 19 Jul 2017 22:11:19 +0000 (01:11 +0300)]
Update AUTHORS file

7 years agoPublic API (GC_deinit) to allow Win32 critical sections deletion
Tautvydas Zilys [Wed, 19 Jul 2017 21:53:43 +0000 (00:53 +0300)]
Public API (GC_deinit) to allow Win32 critical sections deletion

Public GC_deinit allows the clients to avoid a leak of two critical
sections on GC shutdown.

* include/gc.h (GC_deinit): New public function declaration.
* include/private/gc_priv.h [MSWIN32 || MSWINCE] (GC_deinit): Remove.
* misc.c (GC_deinit): Make it public; define it unconditionally; call
DeleteCriticalSection(GC_allocate_ml) if GC_is_initialized; set
GC_is_initialized to false.
DeleteCriticalSection(GC_allocate_ml)
* tests/test.c [!GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK] (main):
Add UNTESTED(GC_deinit).
* win32_threads.c [GC_WINMAIN_REDIRECT && MSWINCE] (WinMain): Do not
call DeleteCriticalSection(GC_allocate_ml).
* win32_threads.c [!GC_NO_THREADS_DISCOVERY && !GC_PTHREADS]
(GC_DllMain): Likewise.

7 years agoTravis CI: Test with --enable-static
Ivan Maidanski [Tue, 18 Jul 2017 22:12:58 +0000 (01:12 +0300)]
Travis CI: Test with --enable-static

Now only shared libraries are built by default.

7 years agoBuild only shared libraries by default (configure)
Ivan Maidanski [Tue, 18 Jul 2017 21:32:40 +0000 (00:32 +0300)]
Build only shared libraries by default (configure)

This is to speed up the build and compile all libgc source files into
a single .o file (to enable more compiler optimizations).

* configure.ac (LT_INIT): Pass disable-static; add comment.

7 years agoRefactoring of USE_MMAP/USE_MMAP_ANON pairs definition in gcconfig.h
Ivan Maidanski [Fri, 14 Jul 2017 17:02:44 +0000 (20:02 +0300)]
Refactoring of USE_MMAP/USE_MMAP_ANON pairs definition in gcconfig.h

* include/private/gcconfig.h [POWERPC && (DARWIN || AIX) || NACL
|| I386 && (HURD || DARWIN) || (AARCH64 || ARM32 || X86_64) && DARWIN]
(USE_MMAP): Do not define explicitly (as USE_MMAP_ANON is defined
explicitly).
* include/private/gcconfig.h [NACL] (USE_MMAP_FIXED): Do not undefine
explicitly (as it is not defined by default).
* include/private/gcconfig.h [I386 && NACL] (HEAP_START): Do not define
value for the case of no USE_MMAP (as the latter is always defined).
* include/private/gcconfig.h [USE_MMAP_ANON && !USE_MMAP] (USE_MMAP):
Define.

7 years agoFix SIGSEGV in GC_is_marked when gc_cleanup is used in leak-finding mode
Ivan Maidanski [Fri, 14 Jul 2017 08:11:13 +0000 (11:11 +0300)]
Fix SIGSEGV in GC_is_marked when gc_cleanup is used in leak-finding mode

Issue #162 (bdwgc).

Now finalizers and disappearing links registration is a no-op in case
of the leak-finding mode.

*  finalize.c (GC_register_disappearing_link_inner): Do nothing (return
GC_UNIMPLEMENTED) if GC_find_leak.
* finalize.c (GC_register_finalizer_inner): Do nothing if GC_find_leak.
* include/gc.h (GC_find_leak): More verbose comment.
* include/gc.h (GC_debug_register_finalizer,
GC_general_register_disappearing_link): Document the case of
GC_find_leak.

7 years agoFix atomic_ops build in Makefile.direct for Solaris
Ivan Maidanski [Thu, 13 Jul 2017 20:27:15 +0000 (23:27 +0300)]
Fix atomic_ops build in Makefile.direct for Solaris

* Makefile.direct (atomic_ops.o, atomic_ops_sysdeps.o): Expand "$<"
macro manually; add comment.

7 years agoRemove name of optional arguments of operator new and new[] in gc_cpp.h
Ivan Maidanski [Thu, 13 Jul 2017 20:17:39 +0000 (23:17 +0300)]
Remove name of optional arguments of operator new and new[] in gc_cpp.h
(code refactoring)

* include/gc_cpp.h (operator new): Comment out cleanup and clientData
argument names.
* include/gc_cpp.h [GC_OPERATOR_NEW_ARRAY] (operator new[]): Likewise.

7 years agoFix push_complex_descriptor to avoid unlimited global mark stack growth
Ivan Maidanski [Tue, 11 Jul 2017 23:04:30 +0000 (02:04 +0300)]
Fix push_complex_descriptor to avoid unlimited global mark stack growth

Global mark stack should not grow in parallel marker mode (as
fixed-size local_mark_stack is used instead).

* typd_mlc.c [PARALLEL_MARK] (GC_array_mark_proc): Do not set
GC_mark_stack_too_small if GC_parallel (and new_mark_stack_ptr is
null); add comment.

7 years agoFix deadlock in GC_suspend_thread when thread is finished
Ivan Maidanski [Tue, 11 Jul 2017 22:10:42 +0000 (01:10 +0300)]
Fix deadlock in GC_suspend_thread when thread is finished
(fix commits 62097c3, 59e2bcf)

* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD] (GC_suspend_thread):
Do not call RAISE_SIGNAL() and sem_wait() if thread has FINISHED flag
set; do not handle ESRCH error result of RAISE_SIGNAL(); add comment.

7 years ago.gitignore: Ignore .log and .trs files for test_atomic_ops
Ivan Maidanski [Tue, 11 Jul 2017 21:39:41 +0000 (00:39 +0300)]
.gitignore: Ignore .log  and .trs files for test_atomic_ops

7 years agoTravis CI: Workaround 'real_malloc is never called' cppcheck warning
Ivan Maidanski [Mon, 10 Jul 2017 21:49:14 +0000 (00:49 +0300)]
Travis CI: Workaround 'real_malloc is never called' cppcheck warning
(fix commit 0027759)

7 years agoWorkaround 'GCC_ATOMIC_TEST_AND_SET_TRUEVAL unknown' cppcheck info message
Ivan Maidanski [Mon, 10 Jul 2017 21:41:53 +0000 (00:41 +0300)]
Workaround 'GCC_ATOMIC_TEST_AND_SET_TRUEVAL unknown' cppcheck info message
(fix commit 46a2411)

* include/private/gc_atomic_ops.h [__GCC_ATOMIC_TEST_AND_SET_TRUEVAL]
(AO_TS_SET): Do not use __GCC_ATOMIC_TEST_AND_SET_TRUEVAL if CPPCHECK.

7 years agoUpdate ChangeLog file
Ivan Maidanski [Sat, 8 Jul 2017 18:52:57 +0000 (21:52 +0300)]
Update ChangeLog file

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Sat, 8 Jul 2017 18:35:48 +0000 (21:35 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Sat, 8 Jul 2017 18:03:00 +0000 (21:03 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

7 years agoTravis CI: Change --with-checksums to --enable-checksums in CONF_OPTIONS
Ivan Maidanski [Thu, 6 Jul 2017 17:18:02 +0000 (20:18 +0300)]
Travis CI: Change --with-checksums to --enable-checksums in CONF_OPTIONS

7 years agoRename with_checksums to enable_checksums option in CMake script
Ivan Maidanski [Thu, 6 Jul 2017 17:25:29 +0000 (20:25 +0300)]
Rename with_checksums to enable_checksums option in CMake script
(refactoring of commit 4530166)

* CMakeLists.txt (with_checksums): Rename to enable_checksums.

7 years agoChange configure --with-checksums to --enable-checksums option
Ivan Maidanski [Thu, 6 Jul 2017 17:11:09 +0000 (20:11 +0300)]
Change configure --with-checksums to --enable-checksums option
(refactoring of commit bfd8345)

* configure.ac (checksums): Replace AC_ARG_WITH with AC_ARG_ENABLE;
update AS_HELP_STRING accordingly.
* configure.ac (with_checksums): Replace with enable_checksums.

7 years agowindows-untested: Do not build checksums.c
Ivan Maidanski [Thu, 29 Jun 2017 18:31:09 +0000 (21:31 +0300)]
windows-untested: Do not build checksums.c

7 years agoTravis CI: Test --disable-munmap
Ivan Maidanski [Thu, 29 Jun 2017 18:23:10 +0000 (21:23 +0300)]
Travis CI: Test --disable-munmap

7 years agoFix configure --disable-munmap handling
Ivan Maidanski [Thu, 29 Jun 2017 18:19:33 +0000 (21:19 +0300)]
Fix configure --disable-munmap handling
(fix commits d564f15, bfd8345)

* configure.ac (USE_MUNMAP, MUNMAP_THRESHOLD): Do not define if
enable_munmap is "no" (or a blank value).
* configure.ac [with_checksums=yes]: Do not report AC_MSG_ERROR if
enable_munmap is "no".

7 years agoCall WARN() if GC_mprotect_dirty_init cannot succeed (Darwin)
Ivan Maidanski [Thu, 29 Jun 2017 09:38:06 +0000 (12:38 +0300)]
Call WARN() if GC_mprotect_dirty_init cannot succeed (Darwin)
(fix commit 6bfc840)

* os_dep.c [MPROTECT_VDB && DARWIN && CAN_HANDLE_FORK]
(GC_mprotect_dirty_init): Replace GC_COND_LOG_PRINTF() with WARN()
which is called before return FALSE; refine WARN message.

7 years agoTravis CI: Test --enable-munmap with OS X
Ivan Maidanski [Thu, 29 Jun 2017 09:01:40 +0000 (12:01 +0300)]
Travis CI: Test --enable-munmap with OS X

7 years agoTravis CI: Test --enable-handle-fork
Ivan Maidanski [Thu, 29 Jun 2017 08:56:12 +0000 (11:56 +0300)]
Travis CI: Test --enable-handle-fork

7 years agoDecide between memory unmapping and mprotect-based dirty bits at runtime
Ivan Maidanski [Thu, 29 Jun 2017 07:47:50 +0000 (10:47 +0300)]
Decide between memory unmapping and mprotect-based dirty bits at runtime

* allchblk.c [USE_MUNMAP && MPROTECT_VDB] (GC_has_unmapped_memory): New
function.
* include/private/gcconfig.h [USE_MUNMAP] (MPROTECT_VDB): Do not
undefine unless GWW_VDB; update comment.
* os_dep.c [MPROTECT_VDB && USE_MUNMAP] (GC_has_unmapped_memory,
GC_mprotect_dirty_init): Declare function.
* os_dep.c [MPROTECT_VDB && USE_MUNMAP] (GC_dirty_init): Ensure
mprotect-based virtual dirty bits and memory unmapping are not both
turned on (disable on of them and call WARN with the appropriate
message), and call GC_mprotect_dirty_init (unless memory unmapping is
requested or some pages are already unmapped).
* os_dep.c [MPROTECT_VDB && !USE_MUNMAP] (GC_mprotect_dirty_init):
Define as a macro (to GC_dirty_init).
* os_dep.c [MPROTECT_VDB] (GC_dirty_init): Rename to
GC_mprotect_dirty_init.

7 years agoFix gctest crash if configure --enable-handle-fork on Darwin
Ivan Maidanski [Wed, 28 Jun 2017 22:04:35 +0000 (01:04 +0300)]
Fix gctest crash if configure --enable-handle-fork on Darwin
(fix commit a7817bc)

* include/private/gc_priv.h [!GC_DISABLE_INCREMENTAL] (GC_incremental):
Refine comment.
* include/private/gc_priv.h [!GC_DISABLE_INCREMENTAL]
(GC_dirty_maintained): Remove variable declaration.
* include/private/gc_priv.h [!GC_DISABLE_INCREMENTAL] (GC_dirty_init):
Change return type from void to GC_bool; update comment.
* mark.c [!GC_DISABLE_INCREMENTAL || CHECKSUMS] (GC_initiate_gc):
Replace GC_dirty_maintained with GC_incremental.
* mark.c [!GC_DISABLE_INCREMENTAL && PROC_VDB] (GC_push_conditional):
Likewise.
* mark.c [!GC_DISABLE_INCREMENTAL] (GC_push_next_marked_dirty): Likewise.
* misc.c [!GC_DISABLE_INCREMENTAL && !KEEP_BACK_PTRS]
(GC_enable_incremental): Likewise.
* os_dep.c [MPROTECT_VDB] (GC_remove_protection): Likewise.
* pthread_support.c [CAN_HANDLE_FORK && GC_DARWIN_THREADS
&& MPROTECT_VDB] (GC_atfork_prepare): Likewise.
* win32_threads.c [MPROTECT_VDB] (UNPROTECT_THREAD): Likewise.
* misc.c [!GC_DISABLE_INCREMENTAL] (GC_init): Set GC_incremental value
to the result of GC_dirty_init().
* misc.c [!GC_DISABLE_INCREMENTAL && !KEEP_BACK_PTRS]
(GC_enable_incremental): Likewise.
* misc.c [!GC_DISABLE_INCREMENTAL && !KEEP_BACK_PTRS]
(GC_enable_incremental): Set GC_incremental to true just before GC_init
call (to indicate the intention to turn on GC incremental mode).
* os_dep.c [!GC_DISABLE_INCREMENTAL] (GC_dirty_maintained): Remove
global variable.
* os_dep.c [GWW_VDB && !MPROTECT_VDB] (GC_gww_dirty_init): Define macro
to GC_dirty_init.
* os_dep.c [GWW_VDB && !MPROTECT_VDB] (GC_dirty_init): Remove function.
* os_dep.c [DEFAULT_VDB || MANUAL_VDB || MPROTECT_VDB || PCR_VDB]
(GC_dirty_init): Change return type to GC_bool; return true; remove
assignment of GC_dirty_maintained.
* os_dep.c [PROC_VDB] (GC_dirty_init): Replace ABORT with WARN and
return false if "pagedata" file open failed.
* os_dep.c [MPROTECT_VDB && DARWIN] (GC_dirty_init): Return false if
GC_handle_fork; add TODO item to replace ABORT with WARN (and return
false).

7 years agoImply configure --single-obj-compilation if --disable-static
Ivan Maidanski [Tue, 27 Jun 2017 21:33:11 +0000 (00:33 +0300)]
Imply configure --single-obj-compilation if --disable-static

* configure.ac (single-obj-compilation): Set default value to yes
if enable_static=no; update help message.
* configure.ac (single_obj_compilation): Rename variable to
enable_single_obj_compilation.

7 years agoMake GC_INIT optional for clients even if thread-local allocations enabled
Ivan Maidanski [Fri, 23 Jun 2017 11:06:11 +0000 (14:06 +0300)]
Make GC_INIT optional for clients even if thread-local allocations enabled

* tests/test.c (GC_OPT_INIT): Do not define to GC_INIT() even if
THREAD_LOCAL_ALLOC; force define to GC_INIT() if TEST_EXPLICIT_GC_INIT
macro defined.
* thread_local_alloc.c [USE_PTHREAD_SPECIFIC || USE_WIN32_SPECIFIC]
(GC_malloc_kind): Check keys_initialized before GC_getspecific call
(fall back to GC_malloc_kind_global if keys_initialized is false).

7 years agoCheck thread_local is initialized before accessing thread_key
Ivan Maidanski [Fri, 23 Jun 2017 08:18:16 +0000 (11:18 +0300)]
Check thread_local is initialized before accessing thread_key

* thread_local_alloc.c [GC_GCJ_SUPPORT] (GC_gcj_malloc): Move
GC_ASSERT(GC_gcj_malloc_initialized) to be before accessing
GC_thread_key.

7 years agoEnsure GC initialized when atfork_prepare is called by client
Ivan Maidanski [Fri, 23 Jun 2017 06:13:15 +0000 (09:13 +0300)]
Ensure GC initialized when atfork_prepare is called by client

Otherwise, if THREAD_LOCAL_ALLOC, GC_remove_all_threads_but_me would
not find the current thread descriptor in GC_threads.

* pthread_support.c [CAN_HANDLE_FORK] (GC_atfork_prepare): Call GC_init
if not GC_is_initialized.
* win32_threads.c [CAN_HANDLE_FORK] (GC_atfork_prepare): Likewise.

7 years agoTravis CI: Test explicit -D DEFAULT_STACK_MAYBE_SMALL"
Ivan Maidanski [Fri, 23 Jun 2017 05:36:19 +0000 (08:36 +0300)]
Travis CI: Test explicit -D DEFAULT_STACK_MAYBE_SMALL"

7 years agoFix gctest failure if PARALLEL_MARK (musl)
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.

7 years agoUpdate AUTHORS file
Ivan Maidanski [Wed, 21 Jun 2017 07:25:16 +0000 (10:25 +0300)]
Update AUTHORS file

7 years agoDocument STACK_NOT_SCANNED macro in gcconfig.h (Emscripten)
Jukka Jylanki [Wed, 21 Jun 2017 07:22:04 +0000 (10:22 +0300)]
Document STACK_NOT_SCANNED macro in gcconfig.h (Emscripten)

Issue #163 (bdwgc).

* include/private/gcconfig.h [__EMSCRIPTEN__] (STACK_NOT_SCANNED): Add
comment (explaining the reason of defining this macro).

7 years agoBetter document minimum value of size argument for typed allocations
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.

7 years agoAdd minimal testing of GC_set_bit (gctest)
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).

7 years agoFix typed_test to prevent fails in malloc_explicitly_typed (64-bit)
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).

7 years agoFix compilation error in get_main_stack_base (Emscripten)
Ivan Maidanski [Tue, 20 Jun 2017 18:22:53 +0000 (21:22 +0300)]
Fix compilation error in get_main_stack_base (Emscripten)

Issue #163 (bdwgc).

* os_dep.c [!BEOS && !AMIGA && !OS2 && !MSWIN32 && !MSWINCE && !CYGWIN32
&& !GC_OPENBSD_THREADS && !STACKBOTTOM && !HEURISTIC1 && !HEURISTIC2
&& !LINUX_STACKBOTTOM && !FREEBSD_STACKBOTTOM] (GC_get_main_stack_base):
Set result to null if STACK_NOT_SCANNED (instead of #error).

7 years agoPrevent abort in register_data_segments for Symbian and Emscripten
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).

7 years agoUpdate AUTHORS file (add Hamayama)
Ivan Maidanski [Tue, 20 Jun 2017 08:58:15 +0000 (11:58 +0300)]
Update AUTHORS file (add Hamayama)

7 years agoFix null dereference in reclaim_block if DONT_ADD_BYTE_AT_END
Hamayama [Tue, 20 Jun 2017 08:56:20 +0000 (11:56 +0300)]
Fix null dereference in reclaim_block if DONT_ADD_BYTE_AT_END

Issue #167 (bdwgc).

* reclaim.c (GC_reclaim_block): If ok->ok_reclaim_list is null then
do not update hhdr->hb_next (and *rlh).

7 years agoFix text formatting in gcinterface.md
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 "**").

7 years agoTravis CI: Add test with -D DONT_ADD_BYTE_AT_END
Ivan Maidanski [Tue, 20 Jun 2017 07:38:35 +0000 (10:38 +0300)]
Travis CI: Add test with -D DONT_ADD_BYTE_AT_END

7 years agoConvert overview.html, tree.html to Markdown format
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.

7 years agoConvert gcdescr.html, gcinterface.html to Markdown format
Ivan Maidanski [Fri, 16 Jun 2017 16:00:07 +0000 (19:00 +0300)]
Convert gcdescr.html, gcinterface.html to Markdown format

* README.QUICK: Replace gcinterface.html with gcinterface.md.
* doc/doc.am (dist_doc_DATA): Likewise.
* doc/gc.man: Likewise.
* doc/overview.html: Likewise.
* doc/doc.am (dist_doc_DATA): Replace gcdescr.html with gcdescr.md.
* doc/overview.html: Likewise.
* doc/gcdescr.html: Change file suffix to .md; convert text format
from HTML to Markdown.
* doc/gcinterface.html: Likewise.

7 years agoFix compiler intrinsics support check failure in 'make distcheck'
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.

7 years agoFix ALL_INTERIOR_POINTERS name in comments and documentation
Ivan Maidanski [Fri, 16 Jun 2017 15:16:07 +0000 (18:16 +0300)]
Fix ALL_INTERIOR_POINTERS name in comments and documentation

* doc/gcdescr.html (Mark phase): Replace ALL_INTERIOR_PTRS with
ALL_INTERIOR_POINTERS.
* doc/tree.html: Likewise.
* include/private/gc_hdrs.h (HC_GET_HDR): Replace GC_all_interior_ptrs
with GC_all_interior_pointers in comment.

7 years agoConsistently use 'msec' instead of 'ms' in comments in pthread_support
Ivan Maidanski [Fri, 16 Jun 2017 14:48:37 +0000 (17:48 +0300)]
Consistently use 'msec' instead of 'ms' in comments in pthread_support

* pthread_support.c [USE_SPIN_LOCK] (GC_lock): Replace "ms" with "msecs"
in comment; put a space between number and "msec" (in comment).

7 years agoUpdate bdwgc mailing list online archive link in documentation
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.

7 years agoUpdate GCJ link in documentation
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.

7 years agoDocument GWW_VDB in gcdescr.html
Ivan Maidanski [Fri, 16 Jun 2017 07:39:16 +0000 (10:39 +0300)]
Document GWW_VDB in gcdescr.html

* doc/gcdescr.html (Generational Collection and Dirty Bits): Document
GWW_VDB.

7 years agoTravis CI: Update after changing configure to use atomic intrinsics
Ivan Maidanski [Thu, 15 Jun 2017 09:10:09 +0000 (12:10 +0300)]
Travis CI: Update after changing configure to use atomic intrinsics

7 years agoUse compiler atomic intrinsics by default if available (configure)
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).

7 years agoAdd test_atomic_ops to perform minimal testing of used atomic primitives
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).

7 years ago.gitignore: Ignore test_atomic_ops
Ivan Maidanski [Wed, 14 Jun 2017 07:57:15 +0000 (10:57 +0300)]
.gitignore: Ignore test_atomic_ops

7 years agoTravis CI: Scan pcr_interface.c, real_malloc.c in extra (CSA, cppcheck)
Ivan Maidanski [Tue, 13 Jun 2017 20:57:51 +0000 (23:57 +0300)]
Travis CI: Scan pcr_interface.c, real_malloc.c in extra (CSA, cppcheck)

7 years agoMove pcr_interface.c, real_malloc.c to 'extra' folder
Ivan Maidanski [Tue, 13 Jun 2017 20:41:10 +0000 (23:41 +0300)]
Move pcr_interface.c, real_malloc.c to 'extra' folder
(code refactoring)

* Makefile.am (EXTRA_DIST): Add extra/ prefix to pcr_interface.c,
real_malloc.c.
* PCR-Makefile (CSRC): Likewise.
* PCR-Makefile (COBJ): Add extra/ prefix to pcr_interface.o,
real_malloc.o.
* extra/gc.c: Remove include pcr_interface.c; update comment about
files which are not included.
* pcr_interface.c: Move to "extra" folder.
* real_malloc.c: Likewise.
* include/private/gc_priv.h (GC_INNER, GC_EXTERN): Update comment.

7 years agoUpdate Download information in GC overview document
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).