Ivan Maidanski [Thu, 9 Mar 2017 06:57:56 +0000 (09:57 +0300)]
Eliminate 'non-reentrant function strtok called' cppcheck warning (POSIX)
* tests/test_cpp.cc [(MSWIN32 && !__MINGW32__ || MSWINCE)
&& !NO_WINMAIN_ENTRY] (WinMain): Manually inline strtok(); add comment.
Ivan Maidanski [Wed, 8 Mar 2017 03:23:24 +0000 (06:23 +0300)]
Fix 'token not a valid binary' error during initsecondarythread compilation
(fix commit 4f98587)
* include/private/gc_priv.h (GC_CLANG_PREREQ): Remove.
* include/private/gcconfig.h (GC_CLANG_PREREQ): Define (moved from
gc_priv.h).
Ivan Maidanski [Tue, 7 Mar 2017 21:39:30 +0000 (00:39 +0300)]
Fix 'expected end of line in preprocessor' compilation error in gc_priv.h
(fix commit 4f98587)
* include/private/gc_priv.h [CANCEL_SAFE && GC_ASSERTIONS]: Remove
extra ')' in "#if" expression.
Ivan Maidanski [Tue, 7 Mar 2017 16:53:30 +0000 (19:53 +0300)]
Travis CI: Also test --enable-large-config in 32-bit mode (Linux)
Thomas Linder Puls [Mon, 6 Mar 2017 10:55:56 +0000 (11:55 +0100)]
Increase MAX_HEAP_SECTS (10 times) for large-config
This enables heaps larger than 128 GB on 64-bit targets.
* include/private/gc_priv.h [!MAX_HEAP_SECTS && LARGE_CONFIG]
(MAX_HEAP_SECTS): Increase value 10 times (from 8192 to 81920 if
64-bit target, from 768 to 7680 otherwise); remove comments.
Ivan Maidanski [Tue, 7 Mar 2017 16:23:49 +0000 (19:23 +0300)]
Workaround 'memory leak: result' cppcheck false error (POSIX)
The report is a false positive because result (returned by mmap) should
be equal to start_addr (passed to mmap).
* os_dep.c [USE_MUNMAP && !USE_WINALLOC] (GC_unmap, GC_unmap_gap): Call
GC_noop1(result) if CPPCHECK (same as for LINT2).
* os_dep.c [USE_MUNMAP && !USE_WINALLOC && NACL] (GC_remap): Likewise.
Ivan Maidanski [Tue, 7 Mar 2017 16:03:00 +0000 (19:03 +0300)]
Workaround 'obsolescent usleep called' cppcheck warning (POSIX)
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]: Include time.h.
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL] (GC_stop_world):
Use nanosleep() instead of usleep() if CPPCHECK.
Ivan Maidanski [Tue, 7 Mar 2017 15:52:08 +0000 (18:52 +0300)]
Workaround 'obsolescent bcopy, bzero called' cppcheck warnings (POSIX)
* include/private/gc_priv.h (BCOPY, BZERO): Define to memcpy/set if
CPPCHECK (regardless of BCOPY_EXISTS).
Ivan Maidanski [Tue, 7 Mar 2017 15:41:13 +0000 (18:41 +0300)]
Eliminate 'scope of variable can be reduced' cppcheck warnings (Win32)
* os_dep.c [MSWIN32] (GC_register_root_section): Move "protect" local
variable declaration to the inner scope where the variable is actually
used.
* win32_threads.c [!MSWINCE && !CYGWIN32] (GC_CreateThread): Move
"thread_h" local variable declaration to the inner scope.
Ivan Maidanski [Tue, 7 Mar 2017 15:27:57 +0000 (18:27 +0300)]
Travis CI: Test also --enable-large-config --enable-munmap (Linux)
Ivan Maidanski [Tue, 7 Mar 2017 15:24:23 +0000 (18:24 +0300)]
Travis CI: Output gctest.log content
Ivan Maidanski [Tue, 7 Mar 2017 15:19:29 +0000 (18:19 +0300)]
Define CLANG/GNUC_PREREQ macros to check gcc/clang minimum version
(code refactoring)
* cord/cordxtra.c (CORD_ATTR_UNUSED): Use GC_GNUC_PREREQ() instead of
direct use of __GNUC[_MINOR]__.
* gc_cpp.cc (GC_NEW_DELETE_NEED_THROW): Likewise.
* include/gc_config_macros.h (GC_API, GC_ATTR_MALLOC, GC_ATTR_ALLOC_SIZE,
GC_ATTR_NONNULL, GC_ATTR_DEPRECATED, GC_RETURN_ADDR,
GC_RETURN_ADDR_PARENT, GC_PTHREAD_EXIT_ATTRIBUTE): Likewise.
* include/gc_cpp.h (GC_NO_OPERATOR_NEW_ARRAY): Likewise.
* include/gc_inline.h (GC_EXPECT, GC_PREFETCH_FOR_WRITE): Likewise.
* include/new_gc_alloc.h: Likewise.
* include/private/gc_priv.h (GC_INNER, GC_ATTR_UNUSED, EXPECT, GC_INLINE,
GC_ATTR_NOINLINE, GC_API_OSCALL, GC_ATTR_FORMAT_PRINTF,
NONNULL_ARG_NOT_NULL): Likewise.
* include/private/gc_priv.h [CANCEL_SAFE] (GC_cancel_disable_count):
Likewise.
* include/private/gcconfig.h (HAVE_BUILTIN_UNWIND_INIT, PREFETCH,
GC_PREFETCH_FOR_WRITE): Likewise.
* include/private/gcconfig.h [I386 && LINUX && __ELF__]
(GC_NO_SIGSETJMP): Likewise.
* include/private/gcconfig.h [X86_64 && MSWIN32] (MPROTECT_VDB):
Likewise.
* include/private/thread_local_alloc.h [CYGWIN32] (USE_PTHREAD_SPECIFIC):
Likewise.
* include/private/thread_local_alloc.h [LINUX && !ARM32 && !AVR32
|| PLATFORM_ANDROID && !__clang__] (USE_COMPILER_TLS): Likewise.
* mark.c [MSWIN32 || MSWINCE] (GC_mark_some): Likewise.
* mark_rts.c (GC_approx_sp): Likewise.
* tests/test_cpp.cc (ATTR_UNUSED): Likewise.
* tools/setjmp_t.c (nested_sp): Likewise.
* include/gc_config_macros.h (GC_GNUC_PREREQ): New macro (not for
public use).
* include/private/gc_priv.h (GC_CLANG_PREREQ): New private macro.
* include/private/gcconfig.h (HAVE_BUILTIN_UNWIND_INIT): Refine comment.
* include/private/thread_local_alloc.h [LINUX && !ARM32 && !AVR32
|| PLATFORM_ANDROID && !__clang__] (USE_COMPILER_TLS): Use
GC_CLANG_PREREQ() instead of direct use of __clang_major__ and
__clang_minor__.
* mark.c [MSWIN32 || MSWINCE] (GC_mark_some): Likewise.
Ivan Maidanski [Sun, 5 Mar 2017 05:22:39 +0000 (08:22 +0300)]
Eliminate 'condition ret==NULL always true' cppcheck style warning (Amiga)
* extra/AmigaOS.c [GC_AMIGA_FASTALLOC && !GC_AMIGA_ONLYFAST
&& GC_AMIGA_GC] (GC_amiga_allocwrapper_any): Do not check ret==NULL
twice.
* extra/AmigaOS.c [GC_AMIGA_FASTALLOC && GC_AMIGA_GC]
(GC_amiga_allocwrapper_fast): Likewise.
* extra/AmigaOS.c [GC_AMIGA_GC] (GC_amiga_realloc): Likewise.
Ivan Maidanski [Fri, 3 Mar 2017 15:24:43 +0000 (18:24 +0300)]
Travis CI: Also test with Unexpected behavior sanitizer (UBSan)
Ivan Maidanski [Fri, 3 Mar 2017 14:53:10 +0000 (17:53 +0300)]
Fix 'overriding commands for target check-without-...' Makefile warnings
(fix commit 8f20303)
Makefile.am includes cord.am and tests.am, so check-without-test-driver
should be defined only at one place.
* cord/cord.am (check-without-test-driver): Remove.
* tests/tests.am (check-without-test-driver): Add ./cordtest$(EXEEXT)
execution.
Ivan Maidanski [Thu, 2 Mar 2017 21:42:01 +0000 (00:42 +0300)]
Update AUTHORS file
Mikael Djurfeldt [Sun, 26 Feb 2017 19:09:56 +0000 (20:09 +0100)]
Fix 'size of tv is unknown' error in brief_async_signal_safe_sleep (musl)
(fix commits 62097c3, 9f48082)
Include <sys/time.h> to get struct timeval defined and select() declared.
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD]: Include sys/time.h
before GC_brief_async_signal_safe_sleep definition.
Ivan Maidanski [Wed, 1 Mar 2017 23:23:32 +0000 (02:23 +0300)]
Add Makefile target to run all tests without test-driver
This could be used to catch errors reported by MemorySanitizer
(the traditional "make check" shows the tests with MSan errors as
skipped, so it does not lead to a non-zero exit code of make itself).
* cord/cord.am (check-without-test-driver): New phony target (to
compile, link and execute the tests not using test-driver).
* tests/tests.am (check-without-test-driver): Likewise.
Ivan Maidanski [Wed, 1 Mar 2017 23:03:11 +0000 (02:03 +0300)]
Fix missing .exe for disclaim test filenames in Makefile (MinGW)
(fix commit 6c1a924)
Also add 4 blank lines to improve tests.am readability.
* tests/tests.am [ENABLE_DISCLAIM] (TESTS): Add $(EXEEXT) suffix to
disclaim_test, disclaim_bench.
Ivan Maidanski [Wed, 1 Mar 2017 22:10:29 +0000 (01:10 +0300)]
Update shared libraries version info to differentiate against v7.6
There are no API/implementation changes in libcord and libgccpp against
release-7_6 for now, so the corresponding version info is made the same.
There some implementation changes in libgc (without API changes) against
release-7_6, so the version info is made not the same (although there
are no API changes, 4:x:2 is already in use/reserved for release-7_6).
* Makefile.am (LIBGC_VER_INFO): Change version info to 5:0:3
(release-7_6 is supposed to use 4:x:2).
* Makefile.am (LIBGCCPP_VER_INFO): Change version info to 4:0:3
(the same one as release-7_6 uses at present).
* cord/cord.am (LIBCORD_VER_INFO): Likewise.
Ivan Maidanski [Wed, 1 Mar 2017 08:10:00 +0000 (11:10 +0300)]
Move libraries version info to the beginning of Makefile.am
(code refactoring)
* Makefile.am (LIBGC_VER_INFO, LIBGCCPP_VER_INFO): New variable; add
comment about the version update rule.
* cord/cord.am (LIBCORD_VER_INFO): Likewise.
* Makefile.am (libgc_la_LDFLAGS, libgccpp_la_LDFLAGS): Use
LIBGC[CPP]_VER_INFO instead the direct hard-coding of version info.
* cord/cord.am (libcord_la_LDFLAGS): Likewise.
Max Mouratov [Wed, 1 Mar 2017 03:12:14 +0000 (08:12 +0500)]
Update AUTHORS file
Ivan Maidanski [Tue, 28 Feb 2017 22:25:34 +0000 (01:25 +0300)]
Eliminate 'checking unsigned variable < 0' cppcheck warning in gc_inline
* include/gc_inline.h (GC_FAST_MALLOC_GRANS): Replace
(word)my_entry<=num_direct with (signed_word)my_entry-num_direct<=0
to avoid "checking unsigned var < 0" warning if num_direct==0
(no overflow is expected in (signed_word)my_entry-num_direct as it is
guaranteed that (word)my_entry<=num_direct+GC_TINY_FREELISTS+1).
Ivan Maidanski [Tue, 28 Feb 2017 21:45:45 +0000 (00:45 +0300)]
Fix name typos in GC_FAST_MALLOC_GRANS comment
* include/gc_inline.h (GC_FAST_MALLOC_GRANS): Fix typos in names in
comment ("num_direct", "generic_malloc").
Ivan Maidanski [Tue, 28 Feb 2017 21:25:51 +0000 (00:25 +0300)]
Define GC_ASSERT(x) as C assert(x) for external clients of gc_inline.h
* include/gc_inline.h [!GC_ASSERT && !NDEBUG] (GC_ASSERT): Define as
assert(x); include assert.h.
Ivan Maidanski [Tue, 28 Feb 2017 21:12:32 +0000 (00:12 +0300)]
Document GC_BUILTIN_ATOMIC macro (and gc_atomic_ops private header file)
* doc/README.macros (GC_BUILTIN_ATOMIC): Document.
* doc/porting.html (atomic_ops): Replace GC7+ with GC v7; remove note
that libatomic_ops contains more primitives than needed by GC; remove
note about GC_test_and_set of older GC versions (pre-v7); add note
about gc_atomic_ops.h file (optional replacement of libatomic_ops).
Ivan Maidanski [Tue, 28 Feb 2017 20:41:03 +0000 (23:41 +0300)]
Define GC_PREFETCH_FOR_WRITE to __builtin_prefetch in gc_inline.h (GCC)
Also add GC_ prefix to NO_PREFETCH_FOR_WRITE.
* include/gc_inline.h [!GC_PREFETCH_FOR_WRITE] (GC_PREFETCH_FOR_WRITE):
Copy the definition from gcconfig.h.
* include/private/gcconfig.h (NO_PREFETCH_FOR_WRITE): Rename to
GC_NO_PREFETCH_FOR_WRITE.
Ivan Maidanski [Tue, 28 Feb 2017 20:02:55 +0000 (23:02 +0300)]
Eliminate 'label not used' cppcheck false warnings in GC_mark_X
(code refactoring of PUSH_CONTENTS[_HDR] to eliminate 'goto' statement)
* include/private/gc_hdrs.h (HC_GET_HDR): Remove exit_label argument;
replace goto with break; remove do-while(0) (as break is now used to
pass control to some place of the caller).
* include/private/gc_pmark.h (SET_MARK_BIT_EXIT_IF_SET): Likewise.
* include/private/gc_pmark.h [!USE_MARK_BYTES] (OR_WORD_EXIT_IF_SET):
Likewise.
* include/private/gc_pmark.h (PUSH_CONTENTS, PUSH_CONTENTS_HDR):
Remove exit_label argument (and the comment about it).
* include/private/gc_pmark.h (SET_MARK_BIT_EXIT_IF_SET): Refine comment
about the exit.
* mark.c (GC_mark_from): Remove PUSH_CONTENTS exit<N> argument.
* typd_mlc.c (GC_typed_mark_proc): Likewise.
* mark.c (GC_mark_and_push, GC_mark_and_push_stack): Remove
PUSH_CONTENTS_HDR label argument and the label itself.
Ivan Maidanski [Mon, 27 Feb 2017 21:38:51 +0000 (00:38 +0300)]
Travis CI: Output config.h content
Ivan Maidanski [Mon, 27 Feb 2017 21:32:50 +0000 (00:32 +0300)]
Travis CI: Move cppcheck to parent (home) folder
(fix commit
b89b137e)
Ivan Maidanski [Mon, 27 Feb 2017 21:26:00 +0000 (00:26 +0300)]
Travis CI: Reformat 'env' section (describe each configuration in a line)
(fix commits
9a3ca02a,
7f295679,
5d52904e)
Ivan Maidanski [Mon, 20 Feb 2017 21:32:49 +0000 (00:32 +0300)]
Fix typo in GC_AMIGA_GC documentation in README
* doc/README.amiga (GC_AMIGA_GC): Fix a typo ("very").
Ivan Maidanski [Mon, 20 Feb 2017 21:25:29 +0000 (00:25 +0300)]
Update AUTHORS file
Klemens Zwischenbrugger [Mon, 20 Feb 2017 21:17:57 +0000 (00:17 +0300)]
Fix various typos in comments and printed messages
This patch contains some spelling fixes (just in comments and C strings
passed to printf) as found by bot (https://github.com/ka7/misspell_fixer).
* SMakefile.amiga: Fix typo in comment ("don't").
* WCC_MAKEFILE (SYSTEM): Fix typo in comment ("uncomment").
* configure.ac [!GCC] (gc_cflags): Fix typo in comment ("actually").
* configure.ac (NO_CLOCK): Fix typo in comment ("targeting").
* doc/README.amiga: Fix typos in documentation ("there's", "compliant",
"documentation").
* extra/AmigaOS.c [GC_AMIGA_PRINTSTATS] (GC_amiga_free_all_mem): Fix
typos in printed messages ("succeeded", "succeeding").
* include/gc.h (GC_get_heap_size): Fix typo in comment ("below").
* tools/setjmp_t.c (main): Fix typo in printed message ("won't").
Ivan Maidanski [Wed, 15 Feb 2017 21:55:15 +0000 (00:55 +0300)]
Do not specify version info for test libraries (Automake)
* tests/tests.am (libstaticrootslib_test_la_LDFLAGS,
libstaticrootslib2_test_la_LDFLAGS): Remove -version-info option.
Ivan Maidanski [Wed, 15 Feb 2017 21:42:22 +0000 (00:42 +0300)]
.gitignore: Ignore *.sancov (generated by ASan)
Ivan Maidanski [Wed, 15 Feb 2017 08:56:06 +0000 (11:56 +0300)]
Fix typo in Makefile.am comment
* Makefile.am (SUBDIRS): Fix typo in comment ("to be").
Ivan Maidanski [Tue, 14 Feb 2017 19:53:56 +0000 (22:53 +0300)]
Travis CI: Add source check by cppcheck
Ivan Maidanski [Tue, 14 Feb 2017 19:31:28 +0000 (22:31 +0300)]
Travis CI: Test -D LINT2 in Linux/x86 builds, not during test coverage
(fix commit a373d52)
Ivan Maidanski [Tue, 14 Feb 2017 18:59:28 +0000 (21:59 +0300)]
Travis CI: fix -D KEEP_BACK_PTRS option passed to clang in CSA_CHECK
(fix commit 3663fd5)
Ivan Maidanski [Tue, 14 Feb 2017 18:42:02 +0000 (21:42 +0300)]
Travis CI: fix 'bits/predefs.h not found' in CSA_CHECK build
(fix commit 3663fd5)
Ivan Maidanski [Tue, 14 Feb 2017 18:23:35 +0000 (21:23 +0300)]
Travis CI: fix missing "fi" in the script
(fix commit 3663fd5)
Ivan Maidanski [Tue, 14 Feb 2017 10:44:34 +0000 (13:44 +0300)]
Eliminate 'value of GC_INLINE unknown' cppcheck info message
(fix commit 46a2411)
* include/private/gc_atomic_ops.h (AO_INLINE): Check GC_PRIVATE_H is
defined instead of "ifdef GC_INLINE".
Ivan Maidanski [Tue, 14 Feb 2017 10:34:53 +0000 (13:34 +0300)]
Travis CI: Pass -D LINT2 to CFLAGS during test coverage check
Ivan Maidanski [Tue, 14 Feb 2017 10:28:56 +0000 (13:28 +0300)]
Travis CI: Add source check by Clang Static Analyzer
Ivan Maidanski [Tue, 14 Feb 2017 08:24:18 +0000 (11:24 +0300)]
Workaround '!GC_page_size is always false' cppcheck style warning
* os_dep.c [!MSWIN32] (GC_setpagesize): Do not check that GC_page_size
is non-zero if CPPCHECK.
Ivan Maidanski [Fri, 10 Feb 2017 13:11:44 +0000 (16:11 +0300)]
Update ChangeLog file
Ivan Maidanski [Fri, 10 Feb 2017 12:52:36 +0000 (15:52 +0300)]
Update ChangeLog file (v7.6 changes only)
Ivan Maidanski [Fri, 10 Feb 2017 11:18:00 +0000 (14:18 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Thu, 2 Feb 2017 19:47:52 +0000 (22:47 +0300)]
Travis CI: Test --disable-static --disable-threads
Ivan Maidanski [Thu, 2 Feb 2017 19:38:54 +0000 (22:38 +0300)]
Travis CI: Test --enable-gc-assertions (only with -m32 and gcov)
Ivan Maidanski [Thu, 2 Feb 2017 19:26:27 +0000 (22:26 +0300)]
Travis CI: Test --enable-munmap only once (for gcov only)
Ivan Maidanski [Thu, 2 Feb 2017 19:13:42 +0000 (22:13 +0300)]
Travis CI: Test also --disable-gc-debug and --enable-large-config
Ivan Maidanski [Thu, 2 Feb 2017 18:20:37 +0000 (21:20 +0300)]
Travis CI: Do not apply gcov to gc-debug code
Ivan Maidanski [Thu, 2 Feb 2017 17:59:51 +0000 (20:59 +0300)]
Add Coveralls (test coverage status) badge to README
Ivan Maidanski [Thu, 2 Feb 2017 17:49:36 +0000 (20:49 +0300)]
Travis CI: Fix base directory for lcov
(fix commit 8270bf2)
Ivan Maidanski [Wed, 1 Feb 2017 19:41:47 +0000 (22:41 +0300)]
Travis CI: Fix gcov exclude matrix and fix lcov usage
(fix commit 8270bf2)
Ivan Maidanski [Wed, 1 Feb 2017 17:33:27 +0000 (20:33 +0300)]
Travis CI: Report test coverage for Linux/x64 (single-obj-compilation)
Ivan Maidanski [Wed, 1 Feb 2017 17:24:16 +0000 (20:24 +0300)]
Travis CI: Refactoring (rename ENABLE_CPP variable to CONF_CPP)
(fix commit 6c48bae)
Ivan Maidanski [Wed, 1 Feb 2017 09:02:26 +0000 (12:02 +0300)]
Travis CI: Refactoring (CFLAGS_EXTRA_M, wrap long lines)
Ivan Maidanski [Tue, 31 Jan 2017 23:30:18 +0000 (02:30 +0300)]
Fix enable_parallel_mark condition in CMake script
* CMakeLists.txt [enable_parallel_mark] (ADD_DEFINITIONS): Add
-DPARALLEL_MARK; remove ADD_DEFINITIONS("-DPARALLEL_MARK") in other
places; remove ${} for enable_parallel_mark in IF.
Ivan Maidanski [Tue, 31 Jan 2017 23:21:22 +0000 (02:21 +0300)]
Fix MS VC warning about compiling unused checksums and thread_local_alloc
* CMakeLists.txt (SRC): Remove checksums.c (to avoid MS VC warning
about unused file).
* CMakeLists.txt (SRC): Do not add thread_local_alloc.c unless
ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") present.
Ivan Maidanski [Tue, 31 Jan 2017 21:43:43 +0000 (00:43 +0300)]
.gitignore: Ignore coverage.info (generated by lcov)
Ivan Maidanski [Tue, 31 Jan 2017 18:25:59 +0000 (21:25 +0300)]
.gitignore: Ignore all *.gc.log and *.tlog (generated by CMake)
(fix commit f4047f9)
Ivan Maidanski [Tue, 31 Jan 2017 08:59:23 +0000 (11:59 +0300)]
Travis CI: Fix linux/i686 build; set language to C++
(fix commit caa4a79)
Note: libgccpp and test_cpp are disabled for 32-bit builds currently.
Ivan Maidanski [Tue, 31 Jan 2017 07:38:22 +0000 (10:38 +0300)]
Fix a typo in comment of GC_mark_some
(fix commit 84c0313)
* mark.c [(MSWIN32 || MSWINCE) && !__clang__ && __GNUC__>=4]
(GC_mark_some): Fix typo in comment ("pedantic").
Ivan Maidanski [Mon, 30 Jan 2017 03:51:12 +0000 (06:51 +0300)]
Fix 'zero-size array is extension' Clang warning in os_dep (Linux/x86)
* os_dep.c [I386 && LINUX && SAVE_CALL_CHAIN] (struct frame): Do not
declare fr_arg[NARGS] field if NARGS is zero.
Ivan Maidanski [Sun, 29 Jan 2017 05:51:30 +0000 (08:51 +0300)]
Travis CI: compile both for x86 and x64
Ivan Maidanski [Sun, 29 Jan 2017 05:39:43 +0000 (08:39 +0300)]
Travis CI: Exclude osx/gcc builds
(gcc is an alias to clang on OS X)
Ivan Maidanski [Thu, 26 Jan 2017 08:01:08 +0000 (11:01 +0300)]
Fix AO_compiler_barrier definition in gc_atomic_ops private header
(fix commit 46a2411)
See AO_compiler_barrier definition in gcc/generic.h of libatomic_ops.
* include/private/gc_atomic_ops.h [GC_BUILTIN_ATOMIC]
(AO_compiler_barrier): Use __atomic_signal_fence(__ATOMIC_SEQ_CST)
instead of atomic_thread_fence.
Ivan Maidanski [Thu, 26 Jan 2017 07:53:32 +0000 (10:53 +0300)]
Appveyor CI: build/test with GCJ support
Ivan Maidanski [Wed, 25 Jan 2017 20:52:53 +0000 (23:52 +0300)]
Fix GCJ support in CMake build script
* CMakeLists.txt [enable_gcj_support] (SRC): Add gcj_mlc.c.
* CMakeLists.txt [enable_gcj_support] (ADD_DEFINITIONS):
Add -DGC_ENABLE_SUSPEND_THREAD only if enable_threads.
Ivan Maidanski [Wed, 25 Jan 2017 09:16:56 +0000 (12:16 +0300)]
Add AO primitives implementation to GC based on C11 atomic intrinsic
* Makefile.direct (SRCS): Add include/private/gc_atomic_ops.h.
* include/include.am (dist_noinst_HEADERS): Likewise.
* include/private/gc_atomic_ops.h: New file; define needed AO entities
if GC_BUILTIN_ATOMIC, otherwise include atomic_ops.h.
* include/private/gc_locks.h [THREADS && GC_PTHREADS
&& !GC_WIN32_THREADS]: Include gc_atomic_ops.h instead of atomic_ops.h.
* include/private/gc_priv.h [PARALLEL_MARK || THREADS && MPROTECT_VDB]:
Likewise.
* include/private/specific.h: Likewise.
* pthread_stop_world.c: Include private/gc_atomic_ops.h instead of
atomic_ops.h.
* tests/subthread_create.c: Likewise.
* thread_local_alloc.c [THREAD_LOCAL_ALLOC && GC_GCJ_SUPPORT]: Likewise.
* typd_mlc.c [GC_FORCE_INCLUDE_ATOMIC_OPS || GC_BUILTIN_ATOMIC]:
Likewise.
* win32_threads.c [GC_DLL && !GC_NO_THREADS_DISCOVERY && !MSWINCE]:
Likewise.
Ivan Maidanski [Mon, 23 Jan 2017 23:10:16 +0000 (02:10 +0300)]
Do not x86 asm in PUSH_CONTENTS_HDR for NaCl
* include/private/gc_pmark.h [I386 && __GNUC__] (LONG_MULT): Do not use
asm-based implementation ("mull") if NACL (i.e. fallback to plain C).
Ivan Maidanski [Thu, 19 Jan 2017 21:36:41 +0000 (00:36 +0300)]
Revert "Skip GC_DS_PER_OBJECT objs with negative descriptor in GC_mark_from"
Issue #137 (bdwgc).
This reverts commit
57f36b93c1f1f2beb6bbbf0cb38c714b518abfdd.
Because it breaks gctest "list reversal" if compiled with
GC_GCJ_SUPPORT for MinGW/x86. This is caused by the fact that static
data roots could be between two GC heap regions thus GC with the patch
skips scanning of a reachable GCJ object with a descriptor located in
the static data roots.
To fix the issue (#92) of mistaking the free list pointers in free
objects for being type descriptor pointers, another approach should be
taken (e.g. marking objects in free lists).
Ivan Maidanski [Thu, 19 Jan 2017 07:45:22 +0000 (10:45 +0300)]
Add assertion to allocobj that live unmarked object cannot be reclaimed
* alloc.c (GC_allocobj): Add assertion before GC_continue_reclaim call
that either GC_is_full_gc is FALSE or the corresponding ok_reclaim_list
element is NULL (i.e. GC_continue_reclaim call is a no-op).
Ivan Maidanski [Wed, 18 Jan 2017 08:58:42 +0000 (11:58 +0300)]
Eliminate 'GC_collecting is set but never used' code defect (Win32)
* include/private/gc_locks.h [USE_PTHREAD_LOCKS && GC_PTHREADS]
(GC_collecting): Do not declare if GC_WIN32_THREADS.
* include/private/gc_locks.h [USE_PTHREAD_LOCKS && GC_PTHREADS]
(ENTER_GC, EXIT_GC): Do not define if GC_WIN32_THREADS; remove
trailing ';', add cast to void.
* win32_threads.c [USE_PTHREAD_LOCKS] (GC_collecting): Remove definition.
Ivan Maidanski [Wed, 18 Jan 2017 08:47:44 +0000 (11:47 +0300)]
Add configure --enable-gcov option (enable code coverage analysis)
* configure.ac (gcov): New --enable-* option.
* configure.ac [enable_gcov] (CFLAGS): Add "--coverage" option.
* configure.ac [enable_gcov && !enable_shared] (CXXFLAGS): Add
"--coverage" option (the shared library build is skipped to workaround
a bug in GCC or linker, atlist for gcc-4.8.4/x86_64).
* configure.ac [enable_gcov] (CFLAGS, CXXFLAGS): Filter out compiler
"-O" options (except for -O0).
Ivan Maidanski [Mon, 16 Jan 2017 21:14:44 +0000 (00:14 +0300)]
Fix lack of 2 trailing zeros in _MSC_VER numbers
_MSC_VER value consists of 4 digits (as of VS 2015).
* include/gc_config_macros.h [!GC_ATTR_MALLOC && !__GNUC__ && _MSC_VER]
(GC_ATTR_MALLOC): Replace _MSC_VER>=14 with _MSC_VER>=1400.
* include/private/gc_priv.h [!__GNUC__ && _MSC_VER] (GC_ATTR_NOINLINE):
Likewise.
* include/gc_config_macros.h [!GC_BUILD && !__GNUC__ && _MSC_VER]
(GC_ATTR_DEPRECATED): Replace _MSC_VER>=12 with _MSC_VER>=1200.
Paul Bone [Sat, 14 Jan 2017 07:02:54 +0000 (10:02 +0300)]
New API function (GC_dump_named) to produce named dumps
gc_dump() now prints a label (name) for the dump, by default the name
is created using the current garbage collection number (GC_get_gc_no).
An arbitrary name could be provided using GC_dump_named() instead.
The naming makes it easier to work with multiple dumps in a single log.
* include/gc.h (GC_dump_named): New public API function declaration.
* include/gc.h (GC_dump): Update comment (the current collection number
is printed at the beginning of the dump).
* misc.c [!NO_DEBUGGING] (GC_dump): Just call GC_dump_named(NULL).
* misc.c [!NO_DEBUGGING] (GC_dump_named): Move code from GC_dump;
start dump with the "GC Dump" followed by either the name specified or
the current collection number (if name is null).
Ivan Maidanski [Fri, 13 Jan 2017 17:24:07 +0000 (20:24 +0300)]
.gitignore: Ignore gcov c/h output files
Ivan Maidanski [Wed, 11 Jan 2017 21:58:41 +0000 (00:58 +0300)]
Use EXPECT FALSE for mark_from code documented as executed rarely
* mark.c (GC_mark_from): Use EXPECT(cond, FALSE) instead of
"Rarely executed" comment.
Ivan Maidanski [Wed, 11 Jan 2017 21:26:25 +0000 (00:26 +0300)]
Fix gc_allocator.h file name in new_gc_alloc.h comment
* include/new_gc_alloc.h: Rename gc_alloc.h to gc_allocator.h in comment;
refine the comment about the STL alloc header.
Ivan Maidanski [Wed, 11 Jan 2017 21:19:24 +0000 (00:19 +0300)]
windows-untested: Fix paths to gc_version.h
* windows-untested/gc.ver: Include gc_version.h instead of ../version.h.
* windows-untested/vc60/gc.dsp (SOURCE): Replace version.h with
include\gc_version.h.
* windows-untested/vc60/libgc.dsp (SOURCE): Likewise.
* windows-untested/vc60/libgcmt.dsp (SOURCE): Likewise.
* windows-untested/vc70/gc.vcproj (Filter.File): Likewise.
* windows-untested/vc70/libgc.vcproj (Filter.File): Likewise.
* windows-untested/vc70/libgcmt.vcproj (Filter.File): Likewise.
* windows-untested/vc71/gc.vcproj (Filter.File): Likewise.
* windows-untested/vc71/libgc.vcproj (Filter.File): Likewise.
* windows-untested/vc71/libgcmt.vcproj (Filter.File): Likewise.
Ivan Maidanski [Wed, 11 Jan 2017 08:26:11 +0000 (11:26 +0300)]
Fix gc_backptr.h, gc_mark.h, GC_DS_TAGS names in documentation
* doc/debugging.html: Rename backptr.h to gc_backptr.h.
* include/gc_mark.h (GC_DS_PER_OBJECT): Rename DS_TAGS to GC_DS_TAGS in
the comment.
* include/private/gc_priv.h (hblkhdr.hb_descr): Rename mark.h to
gc_mark.h in the comment.
Ivan Maidanski [Mon, 9 Jan 2017 21:03:07 +0000 (00:03 +0300)]
Fix 'execvp argument incompatible pointer type' compiler warning (tools)
* tools/if_mach.c (main): Cast the 2nd argument of execvp to void* (to
avoid compiler warning as the argument of execvp() prototype could be
of "const char* const*" or "char**" type).
* tools/if_not_there.c (main): Likewise.
Ivan Maidanski [Mon, 9 Jan 2017 20:33:38 +0000 (23:33 +0300)]
Update README regarding make cords with Makefile.direct
* README.QUICK (cord): Replace "make cords after copying to Makefile"
to "make -f Makefile.direct cords".
Ivan Maidanski [Mon, 9 Jan 2017 07:53:05 +0000 (10:53 +0300)]
Delete preprocessor output on make clean (Makefile.direct)
* .gitignore: Add "*.i" (only for the base folder).
* Makefile.direct (clean): Add "rm *.i".
Ivan Maidanski [Mon, 9 Jan 2017 07:29:29 +0000 (10:29 +0300)]
Fix Makefile.direct recursive invocation
* Makefile.direct (bsd-libgc.a): Add "-f Makefile.direct" option.
Ivan Maidanski [Wed, 28 Dec 2016 21:19:14 +0000 (00:19 +0300)]
Fix a typo in push_roots comment
* mark_rts.c (GC_push_roots): Fix a typo in comment ("GC_push_one").
Ivan Maidanski [Fri, 23 Dec 2016 16:10:33 +0000 (19:10 +0300)]
Fix typo in GC_build_fl_clear2 comment
* new_hblk.c [!SMALL_CONFIG] (GC_build_fl_clear2): Fix a typo in
comment ("to").
Ivan Maidanski [Thu, 22 Dec 2016 22:44:06 +0000 (01:44 +0300)]
Workaround 'condition is always true' cppcheck style warnings in GC_init
* misc.c (GC_init): Skip GC_STATIC_ASSERT for sizeof(ptr_t),
sizeof(word), (word)-1>(word)0 and ((signed_word)-1)<0 if CPPCHECK.
Ivan Maidanski [Thu, 22 Dec 2016 22:07:41 +0000 (01:07 +0300)]
Add minimal testing of GC_MALLOC_[ATOMIC_]WORDS and GC_CONS (gctest)
* tests/test.c: Include "gc_inline.h" unconditionally.
* tests/test.c (test_tinyfl): New function (which invokes
GC_MALLOC_WORDS, GC_MALLOC_ATOMIC_WORDS and GC_CONS).
* tests/test.c (run_one_test): Call test_tinyfl.
Ivan Maidanski [Thu, 22 Dec 2016 22:00:28 +0000 (01:00 +0300)]
Eliminate 'array vs singleton' code defect in typed_test (gctest)
Taking address of bmX yields a singleton pointer but GC_make_descriptor
expects an array (of words).
* tests/test.c (typed_test): Define bm3, bm2, bm_large as 1-element
arrays (instead of values of a primitive type), and remove
"&" operator when passing them to GC_make_descriptor.
Ivan Maidanski [Thu, 22 Dec 2016 21:39:10 +0000 (00:39 +0300)]
Fix bm_huge initialization for 64-bit targets (gctest)
* tests/test.c (bm_huge): Make array size depend on word size
(5 elements for 64-bit targets); initialize elements (except the last
one) to -1 instead of 0xffffffff (so that all bits are ones even on
a 64-bit target); initialize last element to ((word)-1)>>8 instead of
0x00ffffff value.
* tests/test.c (typed_test): Fail if bm_huge descriptor contains wrong
bit values at certain positions (as it had before this fix).
Ivan Maidanski [Thu, 22 Dec 2016 08:40:21 +0000 (11:40 +0300)]
Remove HIGH_BIT macro duplicating SIGNB
(code refactoring)
* typd_mlc.c (HIGH_BIT) Remove macro.
* typd_mlc.c (GC_make_descriptor): Use SIGNB instead of HIGH_BIT.
Ivan Maidanski [Thu, 22 Dec 2016 08:05:41 +0000 (11:05 +0300)]
Eliminate 'memory leak' code defect for scratch-allocated memory
Reuse memory allocated by GC_scratch_alloc and GET_MEM in GC heap
if possible.
* backgraph.c (push_in_progress): Replace in_progress_size==0 with
in_progress_space==NULL (to ensure BCOPY argument is non-NULL);
eliminate code duplication regarding GC_add_to_our_memory call;
call GC_scratch_recycle_no_gww (for old in_progress_space value) unless
GWW_VDB (and remove corresponding FIXME).
* dyn_load.c [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX]
(GC_register_dynamic_libraries): Call GC_scratch_recycle_no_gww (for
old addr_map and current_sz values).
* include/private/gc_priv.h [!GWW_VDB] (GC_scratch_recycle_no_gww): New
internal macro.
* include/private/gc_priv.h (GC_scratch_recycle_inner): New prototype.
* mark.c (GC_scratch_recycle_inner): New function (move code portion
from alloc_mark_stack).
* mark.c (alloc_mark_stack): Call GC_scratch_recycle_inner (if
recycle_old).
* os_dep.c [NEED_PROC_MAPS] (GC_get_maps): Call GC_scratch_recycle_no_gww
(for old maps_buf and maps_buf_sz values).
* os_dep.c [PROC_VDB] (GC_read_dirty): Call GC_scratch_recycle_no_gww
(for old GC_proc_buf and GC_proc_buf_size values).
Ivan Maidanski [Tue, 20 Dec 2016 08:45:21 +0000 (11:45 +0300)]
Fix CMake tests build for Win32
(fix commit 686c871)
The tests have main() entry (instead of WinMain).
* tests/CMakeLists.txt (hugetest, leaktest, middletest, realloc_test,
smashtest): Remove WIN32 attribute from ADD_EXECUTABLE.
Ivan Maidanski [Tue, 20 Dec 2016 07:41:40 +0000 (10:41 +0300)]
Workaround 'resource leak' false positives in alloc_MS, bl/envfile_init
* blacklst.c (GC_bl_init): Add assertion that GC_old_stack_bl and
GC_incomplete_stack_bl are both null prior to their assignment (to the
result of GC_scratch_alloc).
* mark.c (alloc_mark_stack): Replace GC_mark_stack_size!=0 with
GC_mark_stack!=NULL (to ensure no memory leak when GC_mark_stack is
assigned for the first time).
* misc.c [GC_READ_ENV_FILE && (MSWIN32 || MSWINCE || CYGWIN32)]
(GC_envfile_init): Add assertion that GC_envfile_content is null prior
to its assignment.
Ivan Maidanski [Tue, 20 Dec 2016 07:21:07 +0000 (10:21 +0300)]
Fix (adjust) GC_scratch_alloc actual argument type
* dyn_load.c [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX]
(GC_register_dynamic_libraries): Do not cast GC_scratch_alloc argument
to word type (it should be of size_t).
* headers.c (alloc_hdr, GC_init_headers, get_index): Likewise.
* os_dep.c [PROC_VDB] (GC_proc_buf_size): Change type from word to size_t.
* os_dep.c [PROC_VDB] (GC_read_dirty): Change type of new_size local
variable (which is passed to GC_scratch_alloc) from word to size_t.