platform/upstream/libgc.git
5 years agoWorkaround 'duplicate expression for condition and assignment' cppcheck FP
Ivan Maidanski [Tue, 23 Apr 2019 19:21:54 +0000 (22:21 +0300)]
Workaround 'duplicate expression for condition and assignment' cppcheck FP

The entitled cppcheck warnings are false positives.

* alloc.c (GC_should_collect): Move reassignment of the global variable
which is checked in the conditional expression to the end of the
conditional block statement.
* finalize.c (GC_notify_or_invoke_finalizers): Likewise.
* mark.c [WRAP_MARK_SOME] (GC_mark_some): Likewise.

5 years agoFix save_callers for multi-threaded case if built-in backtrace unavailable
Ivan Maidanski [Mon, 22 Apr 2019 21:44:52 +0000 (00:44 +0300)]
Fix save_callers for multi-threaded case if built-in backtrace unavailable

GC_stackbottom could be used only in the single-threaded case.

* os_dep.c [SAVE_CALL_CHAIN && (NARGS!=0 || NFRAMES%2!=0
|| !GC_HAVE_BUILTIN_BACKTRACE) && THREADS] (GC_save_callers): Do not
compare fp to GC_stackbottom.
* os_dep.c [SAVE_CALL_CHAIN && (NARGS!=0 || NFRAMES%2!=0
|| !GC_HAVE_BUILTIN_BACKTRACE) && THREADS && STACK_GROWS_UP]
(GC_save_callers): Break the loop if fp is NULL.

5 years agoRemove Win32 main_thread static variable if threads discovery is disabled
Ivan Maidanski [Fri, 19 Apr 2019 05:07:52 +0000 (08:07 +0300)]
Remove Win32 main_thread static variable if threads discovery is disabled
(code refactoring)

* win32_threads.c (GC_main_thread): Do not define static variable if
GC_NO_THREADS_DISCOVERY.
* win32_threads.c [!GC_NO_THREADS_DISCOVERY] (GC_attached_thread):
Reformat comment; move the definition to be near GC_please_stop.
* win32_threads.c [GC_NO_THREADS_DISCOVERY] (GC_thr_init): Define
GC_main_thread as a macro (and undefine it at the end of the function).

5 years agoSimplify logged message in scratch_recycle
Ivan Maidanski [Wed, 17 Apr 2019 19:43:16 +0000 (22:43 +0300)]
Simplify logged message in scratch_recycle

* mark.c (GC_scratch_recycle_inner): Do not pass bytes variable to
GC_COND_LOG_PRINTF().

5 years agoEnable true incremental collection even if parallel marker is on
Ivan Maidanski [Tue, 16 Apr 2019 21:52:59 +0000 (00:52 +0300)]
Enable true incremental collection even if parallel marker is on

Issue #151 (bdwgc).

Because of the current limitation of the parallel marker implementation,
it is not possible to interrupt the collection when performed by the
parallel marker.  This change allows to have the true incremental mode
at the expense of disabling the parallel marker during most collection
phases.  By default, the old behavior (a generational collection with
the parallel marker enabled) is preserved unless the client sets
GC_time_limit to a value other than GC_TIME_UNLIMITED.

* alloc.c [(!GC_TIME_LIMIT || CPPCHECK) && PARALLEL_MARK]
(GC_time_limit): Set to GC_TIME_UNLIMITED; add comment.
* alloc.c [PARALLEL_MARK] (GC_collect_a_little_inner): Temporarily
set GC_parallel_mark_disabled to TRUE before GC_mark_some repeated
invocation if GC_time_limit is not GC_TIME_UNLIMITED.
* alloc.c [PARALLEL_MARK] (GC_stopped_mark): Temporarily set
GC_parallel_mark_disabled to TRUE before GC_mark_some repeated
invocation if stop_func is not GC_never_stop_func; add verbose logging
if parallel marking is disabled temporarily.
* doc/README.environment (GC_PAUSE_TIME_TARGET): Update the description
(remove the limitation for the case when parallel marking is on).
* doc/scale.md (The Parallel Marking Algorithm): Update the
documentation regarding incremental mode.
* include/gc.h (GC_parallel, GC_enable_incremental): Update the comment
(remove the limitation on the incremental mode when parallel marking
is on).
* include/private/gc_priv.h [PARALLEL_MARK] (GC_parallel_mark_disabled):
Declare global variable.
* mark.c [PARALLEL_MARK] (GC_parallel_mark_disabled): Define.
* mark.c [PARALLEL_MARK] (GC_mark_some_inner): Do not call
GC_do_parallel_mark() if GC_parallel_mark_disabled; update comment.
* pthread_support.c [PARALLEL_MARK] (GC_thr_init): Do not set
GC_time_limit to GC_TIME_UNLIMITED if available_markers_m1 > 0; remove
comment.
* win32_threads.c [PARALLEL_MARK] (GC_thr_init): Likewise.

5 years agoComments reformatting in mark.c to properly delimit sentences
Ivan Maidanski [Tue, 16 Apr 2019 07:19:53 +0000 (10:19 +0300)]
Comments reformatting in mark.c to properly delimit sentences
(code refactoring)

* mark.c (GC_clear_hdr_marks, clear_marks_for_block, GC_set_mark_bit,
GC_clear_marks, GC_initiate_gc, GC_mark_from, alloc_mark_stack,
GC_push_all, GC_push_all_eager, GC_push_marked1, GC_push_marked2,
GC_push_marked4): Add training dot to comment sentences (where missing);
capitalize the first letter of comment sentences (where needed);
reformat some comments.
* mark.c [WRAP_MARK_SOME] (GC_mark_some): Likewise.
* mark.c [PARALLEL_MARK] (GC_do_parallel_mark, GC_help_wanted,
GC_helper_count, GC_active_count, GC_steal_mark_stack, GC_mark_local):
Likewise.
* mark.c [!GC_DISABLE_INCREMENTAL] (GC_push_next_marked_dirty):
Likewise.

5 years agoSimplify loops of collect_a_little/stopped_mark invoking mark_some
Ivan Maidanski [Tue, 16 Apr 2019 06:29:42 +0000 (09:29 +0300)]
Simplify loops of collect_a_little/stopped_mark invoking mark_some
(code refactoring)

* alloc.c (GC_collect_a_little_inner, GC_stopped_mark): If
GC_mark_some() returns true then just break to quit the loop; move the
logic that is needed to funish the collection outside the loop.
* alloc.c (GC_stopped_mark): Change i local variable type from unsigned
to int.

5 years agoAllow GC_PAUSE_TIME_TARGET environment variable values smaller than 5 ms
Ivan Maidanski [Fri, 12 Apr 2019 17:25:47 +0000 (20:25 +0300)]
Allow GC_PAUSE_TIME_TARGET environment variable values smaller than 5 ms

All time limit values starting from 1 ms are now accepted.

* misc.c [!GC_DISABLE_INCREMENTAL] (GC_init): Do not set GC_time_limit
if NO_CLOCK; allow all non-zero time_limit values (instead of >4);
do not call WARN() if time_limit value is incorrect.

5 years agoRefine flags field comment in pthread_support.h
Ivan Maidanski [Fri, 12 Apr 2019 16:51:02 +0000 (19:51 +0300)]
Refine flags field comment in pthread_support.h

* include/private/pthread_support.h (GC_Thread_Rep.flags): Add comment
that the field is accessed only by the GC lock owner.

5 years agoFix 'USE_MUNMAP requires USE_MMAP' compilation error on Cygwin
Ivan Maidanski [Wed, 10 Apr 2019 20:42:11 +0000 (23:42 +0300)]
Fix 'USE_MUNMAP requires USE_MMAP' compilation error on Cygwin
(fix of commit fdb655334)

* include/private/gcconfig.h [CYGWIN32] (MMAP_SUPPORTED): Do not define
if USE_WINALLOC.

5 years agoFix MPROTECT_VDB definition for single-threaded GC builds
Ivan Maidanski [Wed, 10 Apr 2019 20:33:39 +0000 (23:33 +0300)]
Fix MPROTECT_VDB definition for single-threaded GC builds
(fix of commit 6d9eec852)

* include/private/gcconfig.h [MPROTECT_VDB && !MSWIN32 && !MSWINCE]:
Include signal.h.

5 years agoFix 'un-mprotect failed' gctest error on Cygwin
Ivan Maidanski [Wed, 10 Apr 2019 20:25:50 +0000 (23:25 +0300)]
Fix 'un-mprotect failed' gctest error on Cygwin
(fix of commit fa7f7a72b)

Issue #272 (bdwgc).

* include/private/gcconfig.h [(I386 || X86_64) && CYGWIN32]
(MPROTECT_VDB): Do not define if USE_WINALLOC.
* os_dep.c [CYGWIN32 && MPROTECT_VDB] (GC_setpagesize): Set
GC_page_size to dwAllocationGranularity.

5 years agoTravis CI: Add a test of configure --enable-mmap (Linux)
Ivan Maidanski [Tue, 9 Apr 2019 21:49:54 +0000 (00:49 +0300)]
Travis CI: Add a test of configure --enable-mmap (Linux)

5 years agoAdjust macro def/usage for AVR32, CRIS, NETBSD, OPENBSD, SH4 in gcconfig.h
Ivan Maidanski [Tue, 9 Apr 2019 21:42:23 +0000 (00:42 +0300)]
Adjust macro def/usage for AVR32, CRIS, NETBSD, OPENBSD, SH4 in gcconfig.h
(code refactoring)

* include/private/gcconfig.h [__vax__ || __MIPSEL__ || __sparc__
|| i386 || __i386__ || __x86_64__ || sparc && unix && !sun && !linux]:
Replace __NetBSD__ to NETBSD.
* include/private/gcconfig.h [sparc && unix && !sun && !linux]: Replace
__FreeBSD__ || __DragonFly__ to FREEBSD.
* include/private/gcconfig.h [sparc && unix && !sun && !linux
|| __powerpc__ || i386 || __i386__]: Replace __OpenBSD__ to OPENBSD;
do not redefine OPENBSD macro.
* include/private/gcconfig.h [CRIS] (OS_TYPE, DYNAMIC_LOADING,
LINUX_STACKBOTTOM, SEARCH_FOR_DATA_START, DATAEND): Define only if
LINUX.
* include/private/gcconfig.h [AVR32] (OS_TYPE, DYNAMIC_LOADING,
LINUX_STACKBOTTOM, SEARCH_FOR_DATA_START, DATAEND): Likewise.
* include/private/gcconfig.h [SH4] (OS_TYPE, DATAEND): Define only if
MSWINCE.

5 years agoMove QNX and Emscripten macro definitions to proper place in gcconfig.h
Ivan Maidanski [Tue, 9 Apr 2019 19:50:09 +0000 (22:50 +0300)]
Move QNX and Emscripten macro definitions to proper place in gcconfig.h
(code refactoring)

* include/private/gcconfig.h [__QNX__] (I386, mach_type_known): Move
macro definition down (to be in a group where mach_type_known is
defined for most platforms).
* include/private/gcconfig.h [__QNX__] (OS_TYPE, SA_RESTART,
HEURISTIC1, DATASTART, DATAEND): Move macro definition down; define
only if I386.
* include/private/gcconfig.h [__EMSCRIPTEN__] (OS_TYPE, CPP_WORDSZ,
ALIGNMENT, DATASTART, DATAEND, STACK_NOT_SCANNED): Likewise.

5 years agoEnable sbrk-to-mmap fallback on major supported Unix-like platforms
Ivan Maidanski [Tue, 9 Apr 2019 06:38:44 +0000 (09:38 +0300)]
Enable sbrk-to-mmap fallback on major supported Unix-like platforms

This only affects --disable-munmap configuration.

* include/private/gcconfig.h [CYGWIN32 || DARWIN || HAIKU || NETBSD
|| OPENBSD] (MMAP_SUPPORTED): Define macro; add comment.

5 years agoUpdate ChangeLog file
Ivan Maidanski [Sat, 6 Apr 2019 18:07:19 +0000 (21:07 +0300)]
Update ChangeLog file

5 years agoUpdate ChangeLog file (v8.0 changes)
Ivan Maidanski [Sat, 6 Apr 2019 17:58:10 +0000 (20:58 +0300)]
Update ChangeLog file (v8.0 changes)

5 years agoUpdate ChangeLog file (v7.6 changes)
Ivan Maidanski [Sat, 6 Apr 2019 07:05:33 +0000 (10:05 +0300)]
Update ChangeLog file (v7.6 changes)

5 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Sat, 6 Apr 2019 07:01:41 +0000 (10:01 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

5 years agoAppveyor/Travis CI: Test with GC time limit set to 10 ms
Ivan Maidanski [Fri, 5 Apr 2019 18:27:20 +0000 (21:27 +0300)]
Appveyor/Travis CI: Test with GC time limit set to 10 ms

5 years agoFix typos in documentation (regarding 'non-incremental')
Ivan Maidanski [Thu, 4 Apr 2019 21:47:37 +0000 (00:47 +0300)]
Fix typos in documentation (regarding 'non-incremental')

* doc/gcdescr.md (Introduction): Fix typos ("non-incremental",
"this operation").
* mark.c (GC_collection_in_progress): Fix a typo in comment
("non-incremental").

5 years agoUpdate documentation about the incremental collector support
Ivan Maidanski [Thu, 4 Apr 2019 21:34:04 +0000 (00:34 +0300)]
Update documentation about the incremental collector support

* doc/README.darwin (Important Usage Notes): Remove outdated note about
flaky incremental mode.
* doc/README.darwin (Implementation Information): Remove information
about old incremental collector implementation.
* doc/README.win32 (Watcom compiler): Refine information about the
incremental mode support.
* doc/scale.md (Options for enhanced scalability): Refine when the
dedicated marker threads are created.

5 years agoRefine GC_parallel documentation in gc.h
Ivan Maidanski [Wed, 3 Apr 2019 08:09:37 +0000 (11:09 +0300)]
Refine GC_parallel documentation in gc.h

* include/gc.h [GC_THREADS] (GC_parallel): Refine comment about the
case when it is non-zero.

5 years agoFix a typo (GC_NPROCS spelling) in a comment in gc.h
Ivan Maidanski [Wed, 3 Apr 2019 08:00:00 +0000 (11:00 +0300)]
Fix a typo (GC_NPROCS spelling) in a comment in gc.h

* include/gc.h [GC_THREADS] (GC_parallel): Fix a typo in comment
("GC_NPROCS").

5 years agoRemove a misleading comment about Solaris in gc.h
Ivan Maidanski [Wed, 3 Apr 2019 07:49:59 +0000 (10:49 +0300)]
Remove a misleading comment about Solaris in gc.h

* include/gc.h: Remove a comment about Solaris.

5 years agoAllow memory unmapping in case of MPROTECT_VDB
Ivan Maidanski [Wed, 3 Apr 2019 06:47:14 +0000 (09:47 +0300)]
Allow memory unmapping in case of MPROTECT_VDB

Issue #271 (bdwgc).

* allchblk.c [USE_MUNMAP && MPROTECT_VDB] (GC_has_unmapped_memory):
Remove function definition.
* os_dep.c [MPROTECT_VDB && USE_MUNMAP] (GC_dirty_init): Likewise.
* doc/README.macros (USE_MUNMAP): Update the description.
* include/private/gc_priv.h [MPROTECT_VDB && USE_MUNMAP]
(GC_mprotect_dirty_init, GC_has_unmapped_memory): Remove prototype.
* include/private/gcconfig.h [USE_MUNMAP && GWW_VDB] (MPROTECT_VDB):
Do not undefine; remove TODO; remove comment.
* include/private/gcconfig.h: Remove comment that PARALLEL_MARK does
not cause undefine MPROTECT_VDB.
* os_dep.c [MPROTECT_VDB && !USE_MUNMAP] (GC_mprotect_dirty_init):
Remove macro.
* os_dep.c [MPROTECT_VDB] (GC_mprotect_dirty_init): Rename to
GC_dirty_init.
* tests/test.c [!GC_DISABLE_INCREMENTAL && (TEST_DEFAULT_VDB
|| !DEFAULT_VDB)] (main): Call GC_enable_incremental() even in case of
both MPROTECT_VDB and USE_MUNMAP are defined.

5 years agoAppveyor CI: Do not use GC_PREFER_MPROTECT_VDB together with USE_MUNMAP
Ivan Maidanski [Wed, 3 Apr 2019 06:12:11 +0000 (09:12 +0300)]
Appveyor CI: Do not use GC_PREFER_MPROTECT_VDB together with USE_MUNMAP
(fix of commit b7d83aaf6)

5 years agoAllow incremental GC on Cygwin
Ivan Maidanski [Tue, 2 Apr 2019 22:00:57 +0000 (01:00 +0300)]
Allow incremental GC on Cygwin

Both GWW- and mprotect-based implementations should work. The first one
works only if the collector is compiled with -D USE_WINALLOC passed to
CFLAGS.

* include/private/gcconfig.h [(I386 || X86_64) && CYGWIN32]
(MPROTECT_VDB): Define.
* include/private/gcconfig.h [(I386 || X86_64) && CYGWIN32
&& USE_WINALLOC] (GWW_VDB): Define.
* include/private/gcconfig.h [(I386 || X86_64) && CYGWIN32 && USE_MMAP]
(NEED_FIND_LIMIT, USE_MMAP_ANON): Do not define if USE_WINALLOC.
* include/private/gcconfig.h [GWW_VDB && !USE_WINALLOC && !CPPCHECK]:
Produce an invalid config error.

5 years agoRemove unused STACK_GRAN macro definitions
Ivan Maidanski [Tue, 2 Apr 2019 20:37:33 +0000 (23:37 +0300)]
Remove unused STACK_GRAN macro definitions
(code refactoring)

* include/private/gcconfig.h [I386 && CYGWIN32] (STACK_GRAN): Remove
macro redefinition.
* include/private/gcconfig.h [(ARM32 || M32R) && LINUX
&& LINUX_STACKBOTTOM] (STACK_GRAN): Likewise.
* os_dep.c [!STACKBOTTOM] (GC_get_main_stack_base): Define
STACKBOTTOM_ALIGNMENT_M1 macro only if HEURISTIC1.

5 years agoFix OS_TYPE and USE_MMAP_ANON definitions for Cygwin/x64
Ivan Maidanski [Tue, 2 Apr 2019 20:11:41 +0000 (23:11 +0300)]
Fix OS_TYPE and USE_MMAP_ANON definitions for Cygwin/x64
(fix of commit 6c535e8d6)

* include/private/gcconfig.h [IA64 && CYGWIN32] (OS_TYPE, DATASTART,
DATAEND, STACK_GRAN, NEED_FIND_LIMIT, USE_MMAP_ANON): Do not define.
* include/private/gcconfig.h [X86_64 && CYGWIN32] (OS_TYPE): Define.
* include/private/gcconfig.h [X86_64 && CYGWIN32 && USE_MMAP]
(USE_MMAP_ANON): Define.

5 years agoAvoid rare 'Unexpected heap growth' in multi-threaded gctest on Cygwin/x64
Ivan Maidanski [Tue, 2 Apr 2019 19:59:54 +0000 (22:59 +0300)]
Avoid rare 'Unexpected heap growth' in multi-threaded gctest on Cygwin/x64

* tests/test.c [!VERY_SMALL_CONFIG && CPP_WORDSZ==64]
(check_heap_stats): Change 25000000 (max_heap_sz value) to 26000000.

5 years agoAppveyor CI: Test MinGW with -D GC_PREFER_MPROTECT_VDB
Ivan Maidanski [Tue, 2 Apr 2019 08:53:23 +0000 (11:53 +0300)]
Appveyor CI: Test MinGW with -D GC_PREFER_MPROTECT_VDB

5 years agoAvoid compiler warning about unused d in GC_CALLOC/MALLOC_EXPLICITLY_TYPED
Ivan Maidanski [Mon, 1 Apr 2019 19:21:54 +0000 (22:21 +0300)]
Avoid compiler warning about unused d in GC_CALLOC/MALLOC_EXPLICITLY_TYPED

Even if GC_DEBUG is defined, "d" argument of GC_CALLOC_EXPLICITLY_TYPED
and GC_MALLOC_EXPLICITLY_TYPED should be used anyway.

* include/gc_typed.h [GC_DEBUG] (GC_MALLOC_EXPLICITLY_TYPED,
GC_CALLOC_EXPLICITLY_TYPED): Cast d to void.

5 years agoAdd testing of GC_CALLOC/MALLOC_EXPLICITLY_TYPED (gctest)
Ivan Maidanski [Mon, 1 Apr 2019 19:13:18 +0000 (22:13 +0300)]
Add testing of GC_CALLOC/MALLOC_EXPLICITLY_TYPED (gctest)

* tests/test.c (typed_test): Call GC_MALLOC_EXPLICITLY_TYPED()
instead of GC_malloc_explicitly_typed(); call
GC_CALLOC_EXPLICITLY_TYPED() instead of GC_calloc_explicitly_typed().

5 years agoUpdate ChangeLog file
Ivan Maidanski [Wed, 27 Mar 2019 18:29:19 +0000 (21:29 +0300)]
Update ChangeLog file

5 years agoUpdate ChangeLog file (v8.0 changes)
Ivan Maidanski [Wed, 27 Mar 2019 18:13:55 +0000 (21:13 +0300)]
Update ChangeLog file (v8.0 changes)
(a cherry-pick of commit f74ff85f from 'release-8_0')

5 years agoUpdate ChangeLog file (v7.6 changes)
Ivan Maidanski [Wed, 27 Mar 2019 17:59:20 +0000 (20:59 +0300)]
Update ChangeLog file (v7.6 changes)
(a cherry-pick of commit 3b645a40 from 'release-7_6')

5 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Wed, 27 Mar 2019 17:44:00 +0000 (20:44 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
(a cherry-pick of commit 0c7bb67e from 'release-7_4')

5 years agoAdjust highlighting of API prototypes in gcinterface.md
Ivan Maidanski [Tue, 26 Mar 2019 21:31:25 +0000 (00:31 +0300)]
Adjust highlighting of API prototypes in gcinterface.md

* doc/gcinterface.md: Properly highlight listed API functions
(GC_MALLOC, GC_MALLOC_ATOMIC, GC_MALLOC_UNCOLLECTABLE, GC_REALLOC,
GC_FREE, GC_MALLOC_IGNORE_OFF_PAGE, GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE,
GC_INIT, GC_gcollect, GC_enable_incremental, GC_set_warn_proc,
GC_REGISTER_FINALIZER).

5 years agoFix a typo in gcinterface.md after recent documentation update
Ivan Maidanski [Tue, 26 Mar 2019 20:28:18 +0000 (23:28 +0300)]
Fix a typo in gcinterface.md after recent documentation update
(fix of commit 6f8f39af5)

* doc/gcinterface.md (GC_MALLOC_IGNORE_OFF_PAGE): Fix a typo
("inheritance").

5 years agoFix printf format specifier in simple_example.md
Ivan Maidanski [Tue, 26 Mar 2019 20:09:49 +0000 (23:09 +0300)]
Fix printf format specifier in simple_example.md

* doc/simple_example.md (Writing the program): Adjust printf format
specifier to match the argument type.

5 years agoReformat gc.man (wrap long lines)
Ivan Maidanski [Tue, 26 Mar 2019 06:27:22 +0000 (09:27 +0300)]
Reformat gc.man (wrap long lines)

* doc/gc.man: Wrap lines longer than 78 characters.

5 years agoUpdate the documentation to match the current GC implementation
Ivan Maidanski [Tue, 26 Mar 2019 05:37:11 +0000 (08:37 +0300)]
Update the documentation to match the current GC implementation

* README.md: Update the documentation to match the current
implementation of the collector.
* doc/README.Mac: Likewise.
* doc/README.autoconf: Likewise.
* doc/README.darwin: Likewise.
* doc/README.hp: Likewise.
* doc/README.linux: Likewise.
* doc/README.macros: Likewise.
* doc/README.solaris2: Likewise.
* doc/README.win32: Likewise.
* doc/debugging.md: Likewise.
* doc/finalization.md: Likewise.
* doc/gc.man: Likewise.
* doc/gcdescr.md: Likewise.
* doc/gcinterface.md: Likewise.
* doc/leak.md: Likewise.
* doc/overview.md: Likewise.
* doc/porting.md: Likewise.
* doc/scale.md: Likewise.

5 years agoAdjust formatting of numbered lists in README.md to match other .md files
Ivan Maidanski [Mon, 25 Mar 2019 15:50:26 +0000 (18:50 +0300)]
Adjust formatting of numbered lists in README.md to match other .md files

* README.md (Installation and Portability,
The C Interface to the Allocator, Incremental/Generational Collection):
Reformat numbered lists.

5 years agoFix incorrect markup formatting in documentation
Ivan Maidanski [Mon, 25 Mar 2019 13:51:37 +0000 (16:51 +0300)]
Fix incorrect markup formatting in documentation

* doc/gcdescr.md (Mark phase): Terminate list at a proper sentence.
* doc/leak.md: Likewise.
* doc/scale.md (Performance): Fix markup table format.

5 years agoFix configure message about 'AIX gcc optimization fix'
Ivan Maidanski [Sun, 24 Mar 2019 09:03:01 +0000 (12:03 +0300)]
Fix configure message about 'AIX gcc optimization fix'

* configure.ac [$host=*aix*]: Update comment and AC_MSG_CHECKING
message to match the checked condition.

5 years agoRefine GC_INIT documentation about its multiple invocation
Ivan Maidanski [Sun, 24 Mar 2019 08:30:40 +0000 (11:30 +0300)]
Refine GC_INIT documentation about its multiple invocation

* include/gc.h (GC_INIT): Add comment about GC_INIT() multiple calls.

5 years agoRemove 'distributed ports', 'scalable versions' sections from overview.md
Ivan Maidanski [Fri, 22 Mar 2019 21:15:53 +0000 (00:15 +0300)]
Remove 'distributed ports', 'scalable versions' sections from overview.md

* doc/overview.md (Separately distributed ports,
Scalable multiprocessor versions): Remove.

5 years agoRemove 'current users' section from overview.md
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.

5 years agoUpdate the ASCII diagrams describing the tree structure for pointer lookups
Ivan Maidanski [Fri, 22 Mar 2019 17:23:47 +0000 (20:23 +0300)]
Update the ASCII diagrams describing the tree structure for pointer lookups

* doc/tree.md (A picture): Update the Dave Barrett's ASCII diagrams
(from v3.7, 1994) to match the current BDWGC version.

5 years agoUse KB/MB/GB abbreviations uniformly across entire documentation
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.

5 years agoFix various typos mostly in documentation files
Ivan Maidanski [Fri, 22 Mar 2019 07:04:52 +0000 (10:04 +0300)]
Fix various typos mostly in documentation files

* OS2_MAKEFILE: Fix a typo in comment ("it is there").
* README.md: Fix typos ("is not", "gc_inline.h", "bytes from",
"processed").
* doc/README.OS2: Fix typos ("how", "linking").
* doc/README.amiga: Fix typos ("GC", "e.g.", "GC_*_typed", "i.e.",
"SMakefile.amiga", "communications").
* doc/README.cmake: Fix a typo ("go to").
* doc/README.ews4800: Fix a typo ("a unique").
* doc/README.solaris2: Fix a typo ("toolchain").
* doc/finalization.md: Fix incorrect number of markup '#' symbols to
denote H2 header.
* doc/overview.md: Likewise.
* doc/gcdescr.md: Fix typos ("collects", "then advances", "is not",
"treated by").
* doc/gcinterface.md: Fix typos ("Build it", "Allocates",
"deallocates", "forces", "Causes", "Replaces", "Registers",
"traceable_alloc", "single_client_traceable_alloc").
* doc/leak.md: Fix typos ("there is", "provides").
* doc/overview.md (Further reading): Replace "&" with "and".
* doc/porting.md: Add missing ")" symbol; add missing comma; fix typos
("region_start", "region_end", "collector's", "are needed",
"GC_save_callers").
* include/private/gc_priv.h: Fix a typo in comment ("gc_inline.h").
* os_dep.c [GWW_VDB] (detect_GetWriteWatch, GC_gww_read_dirty): Fix
abbreviation ("Win2K") in a comment.
* os_dep.c [MSWIN32] (GC_wnt): Likewise.
* os_dep.c [GWW_VDB] (GC_gww_read_dirty): Fix a typo in comment
("behavior").

5 years agoTravis CI: Do not scan real_malloc.c to workaround cppcheck false positive
Ivan Maidanski [Thu, 21 Mar 2019 08:15:39 +0000 (11:15 +0300)]
Travis CI: Do not scan real_malloc.c to workaround cppcheck false positive

cppcheck reports "Allocation with malloc, return doesn't release it"
error (which is a false positive) in real_malloc().

5 years agoRemove documentation specific to particular old BDWGC releases
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.

5 years agoRemove unused sparc_sunos4_mach_dep.s file
Ivan Maidanski [Wed, 20 Mar 2019 07:42:52 +0000 (10:42 +0300)]
Remove unused sparc_sunos4_mach_dep.s file

Issue #269 (bdwgc).

It had been used only by OpenBSD/sparc in Makefile.direct previously.

* Makefile.am (EXTRA_libgc_la_SOURCES): Remove sparc_sunos4_mach_dep.s.
* Makefile.direct (SRCS): Likewise.
* sparc_sunos4_mach_dep.s: Remove file.

5 years agoUpdate AUTHORS file (add Alaskan Emily)
Ivan Maidanski [Wed, 20 Mar 2019 07:31:49 +0000 (10:31 +0300)]
Update AUTHORS file (add Alaskan Emily)

5 years agoFix compiling by Makefile.direct on OpenBSD/UltraSparc
Alaskan Emily [Fri, 15 Mar 2019 04:07:13 +0000 (21:07 -0700)]
Fix compiling by Makefile.direct on OpenBSD/UltraSparc

Issue #269 (bdwgc).

* Makefile.direct (mach_dep.o): Remove sparc_sunos4_mach_dep.s
dependency.
* Makefile.direct [SPARC OPENBSD] (mach_dep.o): Use $CC instead of $AS;
compile sparc_mach_dep.S instead of sparc_sunos4_mach_dep.s.

5 years agoUpdate copyright information (year) in alloc.c and README.QUICK
Ivan Maidanski [Wed, 20 Mar 2019 06:57:40 +0000 (09:57 +0300)]
Update copyright information (year) in alloc.c and README.QUICK

* README.QUICK (Copyright): Update year (2018 to 2019).
* alloc.c (Copyright): Likewise.
* alloc.c (GC_copyright): Update copyright year.

5 years agoSupport MSYS builds by CMake
Ivan Maidanski [Wed, 20 Mar 2019 06:23:45 +0000 (09:23 +0300)]
Support MSYS builds by CMake

* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT && HOST=.*-.*-msys.*]
(GC_THREADS, _REENTRANT): Define macro.
* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT && HOST=.*-.*-msys.*
&& enable_parallel_mark] (PARALLEL_MARK): Likewise.
* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT && HOST=.*-.*-msys.*
&& enable_thread_local_alloc] (THREAD_LOCAL_ALLOC): Likewise.
* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT && HOST=.*-.*-msys.*
&& enable_thread_local_alloc] (SRC): Add thread_local_alloc.c.
* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT && HOST=.*-.*-msys.*] (SRC):
Add win32_threads.c.

5 years agoUpdate AUTHORS file (add Peter Budai)
Ivan Maidanski [Wed, 20 Mar 2019 06:15:00 +0000 (09:15 +0300)]
Update AUTHORS file (add Peter Budai)

5 years agoSupport MSYS builds in configure
Peter Budai [Sat, 15 Sep 2018 09:35:20 +0000 (11:35 +0200)]
Support MSYS builds in configure

* configure.ac [$THREADS=pthreads && $host=*-*-msys*] (GC_THREADS,
_REENTRANT): Define AC macro.
* configure.ac [$THREADS=pthreads && $host=*-*-msys*]
(use_parallel_mark, use_thread_local_alloc, THREADDLLIBS,
win32_threads): Set variable.
* configure.ac [$host=*-*-msys*]: Do not AC_CHECK_LIB(dl).
* configure.ac [$GCC=yes && $enable_cplusplus=yes && $host=*-*-msys*
&& $SUPC!="libsupc++.a"] (CXXLIBS): Set variable.

5 years agoUpdate AUTHORS file (add Richard Zidlicky)
Ivan Maidanski [Tue, 19 Mar 2019 19:54:11 +0000 (22:54 +0300)]
Update AUTHORS file (add Richard Zidlicky)

5 years agowindows-untested: Update after include/gc_inl.h removal
Ivan Maidanski [Tue, 19 Mar 2019 19:46:30 +0000 (22:46 +0300)]
windows-untested: Update after include/gc_inl.h removal

5 years agoUpdate ChangeLog file
Ivan Maidanski [Sat, 2 Mar 2019 07:20:42 +0000 (10:20 +0300)]
Update ChangeLog file

5 years agoUpdate ChangeLog file (v8.0 changes)
Ivan Maidanski [Fri, 1 Mar 2019 21:47:38 +0000 (00:47 +0300)]
Update ChangeLog file (v8.0 changes)

5 years agoUpdate ChangeLog file (set v7.4.18 release date)
Ivan Maidanski [Fri, 1 Mar 2019 16:39:55 +0000 (19:39 +0300)]
Update ChangeLog file (set v7.4.18 release date)

5 years agoUpdate ChangeLog file (set v7.2n release date)
Ivan Maidanski [Fri, 1 Mar 2019 07:26:55 +0000 (10:26 +0300)]
Update ChangeLog file (set v7.2n release date)

5 years agoAppVeyor CI: Log pid of gctest forked processes (cygwin)
Ivan Maidanski [Thu, 28 Feb 2019 18:21:31 +0000 (21:21 +0300)]
AppVeyor CI: Log pid of gctest forked processes (cygwin)

5 years agoRemove dash characters comprising prefix of some verbose logs (gctest)
Ivan Maidanski [Thu, 28 Feb 2019 18:07:48 +0000 (21:07 +0300)]
Remove dash characters comprising prefix of some verbose logs (gctest)

* tests/test.c (run_one_test): Remove a prefix consisting of 13 '-'
characters in logged messages.

5 years agoNew macro (GCTEST_PRINT_VERBOSE) to enable verbose logging in test.c only
Ivan Maidanski [Thu, 28 Feb 2019 17:50:46 +0000 (20:50 +0300)]
New macro (GCTEST_PRINT_VERBOSE) to enable verbose logging in test.c only

* tests/test.c [GCTEST_PRINT_VERBOSE] (print_stats): Define to VERBOSE.

5 years agoPrint pid of child processes if verbose logging (gctest)
Ivan Maidanski [Thu, 28 Feb 2019 17:29:36 +0000 (20:29 +0300)]
Print pid of child processes if verbose logging (gctest)

* tests/test.c [!NO_TEST_HANDLE_FORK] (run_one_test): Print pid of the
forked process (if print_stats).
* tests/test.c [!NO_TEST_HANDLE_FORK && THREADS] (run_one_test): Log
tiny_reverse_test() invocation (if print_stats).

5 years agoAvoid potential race in hb_sz access between realloc and reclaim_block
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.

5 years agoFix 'duplicate symbol' error for tests using multiple static libs (OS X)
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.

5 years ago.gitignore: Ignore /out folder
Ivan Maidanski [Tue, 26 Feb 2019 20:11:29 +0000 (23:11 +0300)]
.gitignore: Ignore /out folder

5 years agoFix assertion violation about the number of freed objects in test_cpp
Ivan Maidanski [Mon, 25 Feb 2019 21:51:45 +0000 (00:51 +0300)]
Fix assertion violation about the number of freed objects in test_cpp
(fix of commit 6e0590ef1)

Issue Unity-Technologies#37 (bdwgc).

* tests/test_cpp.cc (C::Test): Call GC_gcollect() if incremental mode
and nFreed is too low.

5 years agoAvoid a full GC when growing finalizer tables if in incremental mode
Jonas Echterhoff [Thu, 21 Feb 2019 10:49:16 +0000 (11:49 +0100)]
Avoid a full GC when growing finalizer tables if in incremental mode

Issue Unity-Technologies#37 (bdwgc).

* finalize.c (GC_grow_table): Do not call GC_try_to_collect_inner
if GC_incremental; add comment.

5 years agoUpdate ChangeLog file
Ivan Maidanski [Sun, 17 Feb 2019 18:41:02 +0000 (21:41 +0300)]
Update ChangeLog file

5 years agoUpdate ChangeLog file (v8.0 changes)
Ivan Maidanski [Sun, 17 Feb 2019 17:09:02 +0000 (20:09 +0300)]
Update ChangeLog file (v8.0 changes)
(a cherry-pick of commit 011e159e from 'release-8_0')

5 years agoUpdate ChangeLog file (v7.6 changes)
Ivan Maidanski [Sun, 17 Feb 2019 16:53:15 +0000 (19:53 +0300)]
Update ChangeLog file (v7.6 changes)
(a cherry-pick of commit 1d3beb1c from 'release-7_6')

5 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Sat, 16 Feb 2019 22:49:24 +0000 (01:49 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
(a cherry-pick of commit dd4558f0 from 'release-7_4')

5 years agoAvoid unexpected heap growth in gctest caused by GC_disable
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).

5 years agoAppVeyor CI: Fix 'no source or binary dir provided' cmake error
Ivan Maidanski [Fri, 15 Feb 2019 20:22:58 +0000 (23:22 +0300)]
AppVeyor CI: Fix 'no source or binary dir provided' cmake error

The error is fixed by passing "." argument to cmake.

5 years agoWorkaround 'uninitialized variable: info' cppcheck false positive (OS X)
Ivan Maidanski [Thu, 14 Feb 2019 20:17:36 +0000 (23:17 +0300)]
Workaround 'uninitialized variable: info' cppcheck false positive (OS X)

* darwin_stop_world.c [DEBUG_THREADS && CPPCHECK] (GC_thread_resume):
Initialize info.run_state value (to 0) before thread_info() call.

5 years agoFix thread_info() count argument value (OS X)
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().

5 years agoFix 'wrong __data_start/_end pair' error on Android
Ivan Maidanski [Wed, 13 Feb 2019 22:06:26 +0000 (01:06 +0300)]
Fix 'wrong __data_start/_end pair' error on Android
(fix of commits b746e637b5e73ff184a25965b5f)

Issue #259 (bdwgc).

* include/gc.h [(HOST_ANDROID || __ANDROID__)
&& IGNORE_DYNAMIC_LOADING] (_etext, __data_start, __end__, _end): Do
not declare weak symbols.
* os_dep.c [SEARCH_FOR_DATA_START && (LINUX || HURD) && HOST_ANDROID]
(etext, __dso_handle): Likewise.
* include/gc.h [(HOST_ANDROID || __ANDROID__)
&& IGNORE_DYNAMIC_LOADING] (GC_find_limit): Declare function as public.
* include/gc.h [(HOST_ANDROID || __ANDROID__)
&& IGNORE_DYNAMIC_LOADING] (GC_INIT_CONF_ROOTS): Update comment;
do not use _etext, __data_start, __end__, _end symbols; use
GC_find_limit(__dso_handle,1) as the end of the added GC data root.
* include/private/gc_priv.h [SEARCH_FOR_DATA_START
|| NETBSD && __ELF__] (GC_find_limit): Change ptr_t type to void*,
GC_bool to int.
* include/private/gcconfig.h [(SPARC || ALPHA) && FREEBSD]
(GC_find_limit): Likewise.
* os_dep.c [NEED_FIND_LIMIT || USE_PROC_FOR_LIBRARIES] (GC_find_limit):
Likewise.
* include/private/gcconfig.h [(SPARC || ALPHA) && FREEBSD]
(DATAEND): Cast the result to ptr_t.
* include/private/gcconfig.h [AARCH64 && LINUX && HOST_ANDROID]
(SEARCH_FOR_DATA_START): Remove outdated comment about __data_start.
* os_dep.c [SEARCH_FOR_DATA_START && (LINUX || HURD)
&& !IGNORE_PROG_DATA_START && HOST_ANDROID && !CPPCHECK]
(GC_init_linux_data_start): Do not compare __dso_handle to _etext and
do not use __dso_handle as data start.
* os_dep.c [SEARCH_FOR_DATA_START] (GC_init_linux_data_start): Cast the
result of GC_find_limit() to ptr_t.
* os_dep.c [NETBSD && __ELF__] (GC_init_netbsd_elf): Likewise.
* os_dep.c [LINUX_STACKBOTTOM && IA64] (GC_get_register_stack_base):
Likewise.
* os_dep.c [!AMIGA && !HAIKU && !OS2 && !MSWIN32 && !MSWINCE
&& !CYGWIN32 && !GC_OPENBSD_THREADS && (!GC_SOLARIS_THREADS
|| _STRICT_STDC)] (GC_get_main_stack_base): Likewise.
* os_dep.c [DATASTART_USES_BSDGETDATASTART] (GC_FreeBSDGetDataStart):
Likewise.

5 years agoAdjust printf calls in gctest check_heap_stats so that each has new-line
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).

5 years agoUpdate AUTHORS file
Ivan Maidanski [Tue, 12 Feb 2019 20:28:33 +0000 (23:28 +0300)]
Update AUTHORS file

5 years agoUse atomic primitives for Sony PlayStation Portable 2
Michael Herring [Mon, 28 Jan 2019 03:44:20 +0000 (12:44 +0900)]
Use atomic primitives for Sony PlayStation Portable 2
(a cherry-pick of commit e08e069bc from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* include/private/gc_priv.h [THREADS]: Include gc_atomic_ops.h also
if SN_TARGET_PSP2.

5 years agoFix GetThreadContext stale register values use if WoW64 (Win32)
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.

5 years agoWorkaround 'checking if unsigned expression < 0' cppcheck warnings
Ivan Maidanski [Thu, 7 Feb 2019 17:43:13 +0000 (20:43 +0300)]
Workaround 'checking if unsigned expression < 0' cppcheck warnings

* alloc.c [CPPCHECK] (GC_compute_heap_usage_percent): Replace
GC_WORD_MAX/100 with (GC_WORD_MAX>>1)/50; add comment.
* os_dep.c [!AMIGA && !HAIKU && !OPENBSD && !OS2 && !MSWIN32]
(GC_get_main_stack_base): Skip assertion on result if CPPCHECK.

5 years agoTravis CI: Test --disable-shared on OS X (x86_64)
Ivan Maidanski [Thu, 7 Feb 2019 06:38:56 +0000 (09:38 +0300)]
Travis CI: Test --disable-shared on OS X (x86_64)

5 years agoEnable mprotect-based incremental GC for Linux/arm and Linux/aarch64
Ivan Maidanski [Fri, 25 Jan 2019 08:42:43 +0000 (11:42 +0300)]
Enable mprotect-based incremental GC for Linux/arm and Linux/aarch64

* include/private/gcconfig.h [AARCH64 && LINUX && !(GC_LINUX_THREADS
&& REDIRECT_MALLOC)] (MPROTECT_VDB): Define macro (similar to X86_64
and I386 cases).
* include/private/gcconfig.h [ARM32 && LINUX && !(GC_LINUX_THREADS
&& REDIRECT_MALLOC)] (MPROTECT_VDB): Likewise.

5 years agoFix 'undefined reference to __data_start' linker error (Android/aarch64)
Ivan Maidanski [Fri, 25 Jan 2019 07:44:25 +0000 (10:44 +0300)]
Fix 'undefined reference to __data_start' linker error (Android/aarch64)

As of NDK r18b, __data_start symbol is only provided by bfd linker.

* include/private/gcconfig.h [AARCH64 && LINUX && HOST_ANDROID]
(__data_start): Do not declare extern variable.
* include/private/gcconfig.h [AARCH64 && LINUX && HOST_ANDROID]
(SEARCH_FOR_DATA_START): Define (instead of DATASTART); add comment.

5 years agoWorkaround 'wrong __data_start/_end' if __end__ is incorrect (Android)
Ivan Maidanski [Thu, 24 Jan 2019 21:54:18 +0000 (00:54 +0300)]
Workaround 'wrong __data_start/_end' if __end__ is incorrect (Android)

Issue #259 (bdwgc).

To prevent use of __end__ symbol, "-D BROKEN_UUENDUU_SYM" should be
passed to CFLAGS.

* include/private/gcconfig.h [HOST_ANDROID && __clang__] (DATAEND):
Do not redefine to __end__ if BROKEN_UUENDUU_SYM.

5 years agoFix 'unexpected mark stack overflow' abort in push_all_stack
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.

5 years agoWorkaround 'local t shadows outer var' cppcheck warning in disclaim_bench
Ivan Maidanski [Tue, 15 Jan 2019 20:36:55 +0000 (23:36 +0300)]
Workaround 'local t shadows outer var' cppcheck warning in disclaim_bench
(fix of commit 4880d09f6)

Issue #258 (bdwgc).

* include/private/gc_priv.h [!NO_CLOCK && (MSWINRT_FLAVOR
|| WINXP_USE_PERF_COUNTER)] (GET_TIME): Rename t local variable to tc.

5 years agoWorkaround 'if condition is the same as the previous one' cppcheck warnings
Ivan Maidanski [Tue, 15 Jan 2019 16:52:15 +0000 (19:52 +0300)]
Workaround 'if condition is the same as the previous one' cppcheck warnings

* alloc.c [THREAD_LOCAL_ALLOC] (GC_stopped_mark): Set GC_world_stopped
to FALSE after GC_on_collection_event(GC_EVENT_PRE_START_WORLD).
* alloc.c [THREAD_LOCAL_ALLOC] (GC_stopped_mark): Collapse adjacent
"if" statements.
* mark.c [!GC_DISABLE_INCREMENTAL] (GC_initiate_gc): Likewise.
* pthread_stop_world.c [!NACL && !GC_OPENBSD_UTHREADS
&& !GC_NETBSD_THREADS_WORKAROUND] (GC_start_world): Likewise.

5 years agoAppveyor CI: Test MinGW with -D WINXP_USE_PERF_COUNTER
Ivan Maidanski [Mon, 14 Jan 2019 22:01:38 +0000 (01:01 +0300)]
Appveyor CI: Test MinGW with -D WINXP_USE_PERF_COUNTER

5 years agoUse better precision Windows timers
Jonas Echterhoff [Fri, 19 Oct 2018 10:56:45 +0000 (12:56 +0200)]
Use better precision Windows timers
(a cherry-pick of commits 2fe2d43, 4d2d250, f72b9cf, 583af80
from Unity-Technologies/bdwgc)

Issue #258 (bdwgc).

The feature is enabled if MSWINRT_FLAVOR or WINXP_USE_PERF_COUNTER.

* include/private/gc_priv.h [!NO_CLOCK && !BSD_TIME
&& WINXP_USE_PERF_COUNTER]: Include windows.h and winbase.h.
* include/private/gc_priv.h [!NO_CLOCK && !BSD_TIME && (MSWINRT_FLAVOR
|| WINXP_USE_PERF_COUNTER)] (CLOCK_TYPE): Define ULONGLONG (instead of
DWORD).
* include/private/gc_priv.h [!NO_CLOCK && !BSD_TIME && (MSWINRT_FLAVOR
|| WINXP_USE_PERF_COUNTER)] (GET_TIME): Use QueryPerformanceFrequency()
and QueryPerformanceCounter() to get the current time (instead of
GetTickCount64()).
* include/private/gc_priv.h [!NO_CLOCK && !BSD_TIME && (MSWINRT_FLAVOR
|| WINXP_USE_PERF_COUNTER)] (MS_TIME_DIFF): Divide by a million.
* include/private/gc_priv.h [!NO_CLOCK && !BSD_TIME && (MSWINRT_FLAVOR
|| WINXP_USE_PERF_COUNTER)] (NS_FRAC_TIME_DIFF): Return (a-b)%1000000
(instead of 0).