platform/upstream/libgc.git
7 years agoUpdate ChangeLog file
Ivan Maidanski [Fri, 10 Feb 2017 13:11:44 +0000 (16:11 +0300)]
Update ChangeLog file

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Fri, 10 Feb 2017 12:52:36 +0000 (15:52 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Fri, 10 Feb 2017 11:18:00 +0000 (14:18 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

7 years agoTravis CI: Test --disable-static --disable-threads
Ivan Maidanski [Thu, 2 Feb 2017 19:47:52 +0000 (22:47 +0300)]
Travis CI: Test --disable-static --disable-threads

7 years agoTravis CI: Test --enable-gc-assertions (only with -m32 and gcov)
Ivan Maidanski [Thu, 2 Feb 2017 19:38:54 +0000 (22:38 +0300)]
Travis CI: Test --enable-gc-assertions (only with -m32 and gcov)

7 years agoTravis CI: Test --enable-munmap only once (for gcov only)
Ivan Maidanski [Thu, 2 Feb 2017 19:26:27 +0000 (22:26 +0300)]
Travis CI: Test --enable-munmap only once (for gcov only)

7 years agoTravis CI: Test also --disable-gc-debug and --enable-large-config
Ivan Maidanski [Thu, 2 Feb 2017 19:13:42 +0000 (22:13 +0300)]
Travis CI: Test also --disable-gc-debug and --enable-large-config

7 years agoTravis CI: Do not apply gcov to gc-debug code
Ivan Maidanski [Thu, 2 Feb 2017 18:20:37 +0000 (21:20 +0300)]
Travis CI: Do not apply gcov to gc-debug code

7 years agoAdd Coveralls (test coverage status) badge to README
Ivan Maidanski [Thu, 2 Feb 2017 17:59:51 +0000 (20:59 +0300)]
Add Coveralls (test coverage status) badge to README

7 years agoTravis CI: Fix base directory for lcov
Ivan Maidanski [Thu, 2 Feb 2017 17:49:36 +0000 (20:49 +0300)]
Travis CI: Fix base directory for lcov
(fix commit 8270bf2)

7 years agoTravis CI: Fix gcov exclude matrix and fix lcov usage
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)

7 years agoTravis CI: Report test coverage for Linux/x64 (single-obj-compilation)
Ivan Maidanski [Wed, 1 Feb 2017 17:33:27 +0000 (20:33 +0300)]
Travis CI: Report test coverage for Linux/x64 (single-obj-compilation)

7 years agoTravis CI: Refactoring (rename ENABLE_CPP variable to CONF_CPP)
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)

7 years agoTravis CI: Refactoring (CFLAGS_EXTRA_M, wrap long lines)
Ivan Maidanski [Wed, 1 Feb 2017 09:02:26 +0000 (12:02 +0300)]
Travis CI: Refactoring (CFLAGS_EXTRA_M, wrap long lines)

7 years agoFix enable_parallel_mark condition in CMake script
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.

7 years agoFix MS VC warning about compiling unused checksums and thread_local_alloc
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.

7 years ago.gitignore: Ignore coverage.info (generated by lcov)
Ivan Maidanski [Tue, 31 Jan 2017 21:43:43 +0000 (00:43 +0300)]
.gitignore: Ignore coverage.info (generated by lcov)

7 years ago.gitignore: Ignore all *.gc.log and *.tlog (generated by CMake)
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)

7 years agoTravis CI: Fix linux/i686 build; set language to C++
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.

7 years agoFix a typo in comment of GC_mark_some
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").

7 years agoFix 'zero-size array is extension' Clang warning in os_dep (Linux/x86)
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.

7 years agoTravis CI: compile both for x86 and x64
Ivan Maidanski [Sun, 29 Jan 2017 05:51:30 +0000 (08:51 +0300)]
Travis CI: compile both for x86 and x64

7 years agoTravis CI: Exclude osx/gcc builds
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)

7 years agoFix AO_compiler_barrier definition in gc_atomic_ops private header
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.

7 years agoAppveyor CI: build/test with GCJ support
Ivan Maidanski [Thu, 26 Jan 2017 07:53:32 +0000 (10:53 +0300)]
Appveyor CI: build/test with GCJ support

7 years agoFix GCJ support in CMake build script
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.

7 years agoAdd AO primitives implementation to GC based on C11 atomic intrinsic
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.

7 years agoDo not x86 asm in PUSH_CONTENTS_HDR for NaCl
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).

7 years agoRevert "Skip GC_DS_PER_OBJECT objs with negative descriptor in GC_mark_from"
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).

7 years agoAdd assertion to allocobj that live unmarked object cannot be reclaimed
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).

7 years agoEliminate 'GC_collecting is set but never used' code defect (Win32)
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.

7 years agoAdd configure --enable-gcov option (enable code coverage analysis)
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).

7 years agoFix lack of 2 trailing zeros in _MSC_VER numbers
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.

7 years agoNew API function (GC_dump_named) to produce named dumps
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).

7 years ago.gitignore: Ignore gcov c/h output files
Ivan Maidanski [Fri, 13 Jan 2017 17:24:07 +0000 (20:24 +0300)]
.gitignore: Ignore gcov c/h output files

7 years agoUse EXPECT FALSE for mark_from code documented as executed rarely
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.

7 years agoFix gc_allocator.h file name in new_gc_alloc.h 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.

7 years agowindows-untested: Fix paths to gc_version.h
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.

7 years agoFix gc_backptr.h, gc_mark.h, GC_DS_TAGS names in documentation
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.

7 years agoFix 'execvp argument incompatible pointer type' compiler warning (tools)
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.

7 years agoUpdate README regarding make cords with Makefile.direct
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".

7 years agoDelete preprocessor output on make clean (Makefile.direct)
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".

7 years agoFix Makefile.direct recursive invocation
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.

7 years agoFix a typo in push_roots comment
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").

7 years agoFix typo in GC_build_fl_clear2 comment
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").

7 years agoWorkaround 'condition is always true' cppcheck style warnings in GC_init
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.

7 years agoAdd minimal testing of GC_MALLOC_[ATOMIC_]WORDS and GC_CONS (gctest)
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.

7 years agoEliminate 'array vs singleton' code defect in typed_test (gctest)
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.

7 years agoFix bm_huge initialization for 64-bit targets (gctest)
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).

7 years agoRemove HIGH_BIT macro duplicating SIGNB
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.

7 years agoEliminate 'memory leak' code defect for scratch-allocated memory
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).

7 years agoFix CMake tests build for Win32
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.

7 years agoWorkaround 'resource leak' false positives in alloc_MS, bl/envfile_init
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.

7 years agoFix (adjust) GC_scratch_alloc actual argument type
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.

7 years agoFix storage class of local variable in register_dynamic_libraries (Irix)
Ivan Maidanski [Mon, 19 Dec 2016 21:54:32 +0000 (00:54 +0300)]
Fix storage class of local variable in register_dynamic_libraries (Irix)

* dyn_load.c [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX]
(GC_register_dynamic_libraries): Remove "static" for needed_sz local
variable (and initialize it to zero).

7 years agoExecute more single-threaded GC tests by CMake
Ivan Maidanski [Mon, 19 Dec 2016 21:47:17 +0000 (00:47 +0300)]
Execute more single-threaded GC tests by CMake

Note: support of the multi-threaded tests, disclaim_bench/test,
trace_test, staticrootstest is not added to cmake test script yet.

* tests/CMakeLists.txt (ADD_EXECUTABLE, TARGET_LINK_LIBRARIES,
ADD_TEST): Add hugetest, leaktest, middletest, realloc_test, smashtest
(similar to gctest).

7 years ago.gitignore: Add even more files generated by CMake
Ivan Maidanski [Mon, 19 Dec 2016 21:33:08 +0000 (00:33 +0300)]
.gitignore: Add even more files generated by CMake
(fix commit 11ae03e)

7 years agoSkip grungy_pages update when mark state invalid to speedup read_dirty
Ivan Maidanski [Mon, 19 Dec 2016 07:56:19 +0000 (10:56 +0300)]
Skip grungy_pages update when mark state invalid to speedup read_dirty

* include/private/gc_priv.h [!GC_DISABLE_INCREMENTAL] (GC_read_dirty):
Add output_unneeded argument; update comment.
* os_dep.c [MANUAL_VDB || PROC_VDB] (GC_read_dirty): Likewise.
* mark.c [!GC_DISABLE_INCREMENTAL] (GC_initiate_gc): Pass
output_unneeded argument.
* misc.c [!GC_DISABLE_INCREMENTAL && !KEEP_BACK_PTRS]
(GC_enable_incremental): Likewise.
* os_dep.c [MPROTECT_VDB] (GC_read_dirty): Likewise.
* os_dep.c [GWW_VDB] (GC_gww_read_dirty): Add output_unneeded argument.
* os_dep.c [DEFAULT_VDB || PCR_VDB] (GC_read_dirty): Likewise.
* os_dep.c [GWW_VDB] (GC_gww_read_dirty): Do not call
BZERO(GC_grungy_pages) and set_pht_entry_from_index() if output_unneeded.
* os_dep.c [GWW_VDB && CHECKSUMS] (GC_gww_read_dirty): Add assertion
that output_unneeded is false.
* os_dep.c [MANUAL_VDB || MPROTECT_VDB] (GC_read_dirty): Do not call
BCOPY(GC_dirty_pages, GC_grungy_pages) if output_unneeded.
* os_dep.c [PROC_VDB] (GC_read_dirty): Do not call
memset(GC_grungy_pages) if output_unneeded.

7 years agoWorkaround 'value of AO_compiler_barrier unknown' cppcheck info message
Ivan Maidanski [Sat, 17 Dec 2016 15:43:00 +0000 (18:43 +0300)]
Workaround 'value of AO_compiler_barrier unknown' cppcheck info message
(fix commit e3ec4a5)

* mark.c (GC_noop6): Call AO_compiler_barrier() only if PARALLEL_MARK
or GC_PTHREADS and not GC_WIN32_THREADS (do not use
"#ifdef AO_compiler_barrier").

7 years agoDisable implicit multi-threaded mode for Win32 to avoid LOCK crash
Ivan Maidanski [Sat, 17 Dec 2016 15:15:02 +0000 (18:15 +0300)]
Disable implicit multi-threaded mode for Win32 to avoid LOCK crash
(fix commit d5c6531)

* include/private/gc_locks.h [GC_ALWAYS_MULTITHREADED] (GC_need_to_lock):
Do not define to TRUE unless USE_PTHREAD_LOCKS or USE_SPIN_LOCK; issue
#error otherwise (excluding CPPCHECK case) as PCR and Windows-based
lock implementation requires it to be initialized first.
* include/private/gc_locks.h [UNCOND_LOCK && !LOCK && LINT2] (LOCK,
UNLOCK): Define (to UNCOND_[UN]LOCK) only if USE_PTHREAD_LOCKS.

7 years agoWorkaround 'bad address arithmetic' static analysis tool false positive
Ivan Maidanski [Sat, 17 Dec 2016 14:21:40 +0000 (17:21 +0300)]
Workaround 'bad address arithmetic' static analysis tool false positive

The tool complains whether (alloc(size)+ofs) is intentional instead of
(alloc(size+ofs)).  In our case, it is a false alarm (the offset is
added to the result to align the allocation at HBLKSIZE boundary).

* os_dep.c [USE_WINALLOC && MSWIN32] (GC_win32_get_mem): Store result
of GlobalAlloc() to "result" local variable first (then, perform result
alignment in a standalone statement); add comment.

7 years agoFix compilation for winpthreads if HANDLE_FORK
Ivan Maidanski [Sat, 17 Dec 2016 07:11:37 +0000 (10:11 +0300)]
Fix compilation for winpthreads if HANDLE_FORK

* tests/test.c [GC_PTHREADS && !GC_WIN32_PTHREADS]
(NO_TEST_HANDLE_FORK): Define.
* win32_threads.c [CAN_HANDLE_FORK] (available_markers_m1): Define (as
static variable) even if !GC_PTHREADS_PARAMARK.

7 years agoWorkaround 'checking unsigned value is negative' code defect in mark_from
Ivan Maidanski [Sat, 17 Dec 2016 06:57:34 +0000 (09:57 +0300)]
Workaround 'checking unsigned value is negative' code defect in mark_from

* mark.c (GC_mark_from): Replace (signed_word)descr<0 with
(descr&SIGNB)!=0.

7 years agoWorkaround 'null pointer dereference' false positive in push_next_marked
Ivan Maidanski [Sat, 17 Dec 2016 06:47:10 +0000 (09:47 +0300)]
Workaround 'null pointer dereference' false positive in push_next_marked

* mark.c [LINT2] (GC_push_next_marked,
GC_push_next_marked_uncollectable): Call ABORT if h is null (to ensure
that null is not passed to GC_push_marked).
* mark.c [!GC_DISABLE_INCREMENTAL && LINT2] (GC_push_next_marked_dirty):
Likewise.
* mark.c [!GC_DISABLE_INCREMENTAL && STUBBORN_ALLOC]
(GC_push_next_marked_dirty): Remove code duplication.

7 years agoEliminate 'integer shift by a negative amount' code defect in finalize
Ivan Maidanski [Fri, 16 Dec 2016 22:01:06 +0000 (01:01 +0300)]
Eliminate 'integer shift by a negative amount' code defect in finalize

* finalize.c (GC_register_disappearing_link_inner): Add assertion that
dl_hashtbl->log_size is non-negative after GC_grow_table() call.
* finalize.c (GC_unregister_disappearing_link_inner): If
dl_hashtbl->log_size is negative then return immediately (to avoid an
integer value shift by log_size==-1 in HASH2).
* finalize.c [!GC_MOVE_DISAPPEARING_LINK_NOT_NEEDED]
(GC_move_disappearing_link_inner): Likewise.
* finalize.c (GC_register_finalizer_inner): Add assertion that
log_fo_table_size is non-negative after GC_grow_table() call.
* finalize.c (GC_finalize): Add assertion that log_fo_table_size is
non-negative unless GC_fnlz_roots.finalize_now is null.

7 years agoFix typo in GET_MEM comment
Ivan Maidanski [Fri, 16 Dec 2016 21:21:21 +0000 (00:21 +0300)]
Fix typo in GET_MEM comment

* include/private/gcconfig.h (GET_MEM): Fix typo in comment (HBLKSIZE).

7 years ago.gitignore: Properly ignore sym-linked folders of code analysis tools
Ivan Maidanski [Wed, 14 Dec 2016 16:35:38 +0000 (19:35 +0300)]
.gitignore: Properly ignore sym-linked folders of code analysis tools
(fix commit 8e4544c)

7 years agoDo not print n_rescuing_pages value if incremental collections disabled
Ivan Maidanski [Tue, 13 Dec 2016 22:00:29 +0000 (01:00 +0300)]
Do not print n_rescuing_pages value if incremental collections disabled

* mark.c (GC_n_rescuing_pages): Do not define if GC_DISABLE_INCREMENTAL
and not STUBBORN_ALLOC; refine comment.
* mark.c (GC_initiate_gc, GC_push_marked): Do not update
GC_n_rescuing_pages if GC_DISABLE_INCREMENTAL and not STUBBORN_ALLOC.
* mark.c [ENABLE_DISCLAIM] (GC_push_unconditionally): Likewise.
* mark.c (GC_mark_some_inner): Do call GC_COND_LOG_PRINTF for
GC_n_rescuing_pages if GC_DISABLE_INCREMENTAL and not STUBBORN_ALLOC.

7 years agoFix GC_noop6 definition to avoid its calls to be optimized away
Ivan Maidanski [Mon, 12 Dec 2016 23:34:28 +0000 (02:34 +0300)]
Fix GC_noop6 definition to avoid its calls to be optimized away

* include/private/gc_priv.h (GC_ATTR_NOINLINE): New macro (effective
for GCC/Clang and MS VC currently).
* mark.c (GC_noop6): Use GC_ATTR_NOINLINE attribute; call
AO_compiler_barrier if available, otherwise call GC_noop1(0); add
comment.

7 years agoPut invariant name in quotes to make mark_state comments clearer
Ivan Maidanski [Mon, 12 Dec 2016 22:02:29 +0000 (01:02 +0300)]
Put invariant name in quotes to make mark_state comments clearer

* include/private/gc_pmark.h (mark_state_t, MS_NONE, MS_PUSH_RESCUERS,
MS_PUSH_UNCOLLECTABLE, MS_ROOTS_PUSHED, MS_PARTIALLY_INVALID,
MS_INVALID): Replace I with "I" in comment.

7 years ago.gitignore: Ignore folders and files of static code analysis tools
Ivan Maidanski [Mon, 12 Dec 2016 21:50:09 +0000 (00:50 +0300)]
.gitignore: Ignore folders and files of static code analysis tools

7 years agoFix GC_mark_stack_top assertion violation properly in mark_local
Ivan Maidanski [Sat, 10 Dec 2016 07:37:04 +0000 (10:37 +0300)]
Fix GC_mark_stack_top assertion violation properly in mark_local
(fix commit a563b883)

* mark.c (GC_mark_local): Remove assertion checking that
global_first_nonempty is not greater than GC_mark_stack_top+1 (because
global_first_nonempty could be bigger slightly more at some moments due
to concurrency between the markers); replace n_on_stack==0 with
my_top<my_first_nonempty (the latter is equivalent to
(signed_word)n_on_stack<=0).

7 years agoFix assertion in GC_steal_mark_stack for non-heap regions
Ivan Maidanski [Sat, 10 Dec 2016 07:14:39 +0000 (10:14 +0300)]
Fix assertion in GC_steal_mark_stack for non-heap regions
(similar to commit da2fcda)

* mark.c (GC_steal_mark_stack): Replace top->mse_descr.w with descr
in assertion; relax assertion condition for descr (length-containing
mse_descr.w could be larger than the current GC heap size if
mse_start points to a region in a stack or a program data root;
e.g. it could happen if MemorySanitizer is used).

7 years agoFix gc_cleanup destructor for non-heap objects (gc_cpp)
Ivan Maidanski [Fri, 9 Dec 2016 23:19:32 +0000 (02:19 +0300)]
Fix gc_cleanup destructor for non-heap objects (gc_cpp)

* include/gc_cpp.h (gc_cleanup::~gc_cleanup): If GC_base(this) returns
null (could be if the object is not allocated dynamically) then do not
call GC_register_finalizer_ignore_self.

7 years agoWorkaround 'index out of bounds' UBSan false warning in push_marked
Ivan Maidanski [Fri, 9 Dec 2016 23:07:25 +0000 (02:07 +0300)]
Workaround 'index out of bounds' UBSan false warning in push_marked

* mark.c (GC_push_marked): Cast (h+1)->hb_body to word before
subtraction of sz value (and cast the result back to ptr_t).
* mark.c [ENABLE_DISCLAIM] (GC_push_unconditionally): Likewise.

7 years agoEliminate 'use of vulnerable sprintf' code defect in de_win test (cord)
Ivan Maidanski [Fri, 9 Dec 2016 22:54:05 +0000 (01:54 +0300)]
Eliminate 'use of vulnerable sprintf' code defect in de_win test (cord)

* cord/tests/de_win.c (WinMain): Do not call sprintf() on RegisterClass
and CreateWindow failure; invoke de_error() with the immediate error
message strings (without the error code).

7 years agoWorkaround 'potential multiplication overflow' code defect in de_win (cord)
Ivan Maidanski [Fri, 9 Dec 2016 21:57:39 +0000 (00:57 +0300)]
Workaround 'potential multiplication overflow' code defect in de_win (cord)

* cord/tests/de_win.c (get_line_rect): Cast (extend) char_height to
LONG when multiplied by line (otherwise only the result of the
multiplication is extended to LONG implicitly).

7 years agoSupport CFLAGS_EXTRA to pass extra user-defined compiler flags (configure)
Ivan Maidanski [Fri, 9 Dec 2016 00:21:05 +0000 (03:21 +0300)]
Support CFLAGS_EXTRA to pass extra user-defined compiler flags (configure)

* Makefile.am (CFLAGS, CXXFLAGS): Append $(CFLAGS_EXTRA).
* configure.ac: Add AC_SUBST(CFLAGS_EXTRA).

7 years agoRemove page_was_dirty and remove_protection duplicate definitions
Ivan Maidanski [Thu, 8 Dec 2016 23:41:54 +0000 (02:41 +0300)]
Remove page_was_dirty and remove_protection duplicate definitions

* include/private/gc_priv.h [!GC_DISABLE_INCREMENTAL]
(GC_page_was_dirty): Refine comment (move the comment
content from GC_page_was_dirty in os_dep.c).
* os_dep.c [GWW_VDB && MPROTECT_VDB] (GC_gww_page_was_dirty): Remove.
* os_dep.c [GWW_VDB || MPROTECT_VDB || PROC_VDB || MANUAL_VDB]
(GC_page_was_dirty): Avoid code duplication (remove the functions of
the identical implementation).
* os_dep.c [(GWW_VDB || PROC_VDB) && !MPROTECT_VDB || MANUAL_VDB
|| DEFAULT_VDB] (GC_remove_protection): Likewise.
* os_dep.c [CHECKSUMS && GWW_VDB || PROC_VDB] (GC_or_pages): Remove
nesting of #if.

7 years agoFix '~' operator application to unsigned values shorter than word
Ivan Maidanski [Wed, 7 Dec 2016 08:32:30 +0000 (11:32 +0300)]
Fix '~' operator application to unsigned values shorter than word

Without the fix, unsigned result of "~" operator is zero-extended
to a wide type (word) thus the result has leading zeros (which is
not expected to be).

* dyn_load.c [HAVE_DL_ITERATE_PHDR] (GC_register_dynlib_callback):
Cast (sizeof(word)-1) to word before "~" operation.
* mark.c (GC_mark_from): Likewise.
* mark_rts.c (GC_add_roots_inner, GC_exclude_static_roots): Likewise.
* mark_rts.c [!MSWIN32 && !MSWINCE && !CYGWIN32]
(GC_remove_roots_inner): Likewise.
* os_dep.c [SVR4 || AUX || DGUX || LINUX && SPARC]
(GC_SysVGetDataStart): Likewise.
* os_dep.c [!MSWIN32 && DATASTART_USES_BSDGETDATASTART]
(GC_FreeBSDGetDataStart): Likewise.
* dyn_load.c [(MSWIN32 || MSWINCE || CYGWIN32) && !GC_WIN32_THREADS]
(GC_cond_add_roots): Cast (dwAllocationGranularity-1) to word before
"~" operation.
* include/private/gc_priv.h (HBLKPTR): Cast (HBLKSIZE-1) to word
before "~" operation.
* os_dep.c [USE_WINALLOC || CYGWIN32] (GC_win32_get_mem): Likewise.
* mark.c (GC_mark_from): Change type of new_size local variable from
int to word.
* os_dep.c [OPENBSD] (GC_find_limit_openbsd, GC_skip_hole_openbsd):
Change type of pgsz local variable from size_t to word (to avoid
implicit unsigned value extension after "~" operation).
* os_dep.c [PROC_VDB] (GC_read_dirty): Cast (sizeof(long)-1) to word
before "~" operation.

7 years agoFix 'bogus LR' detection in FindTopOfStack (Darwin)
Ivan Maidanski [Wed, 7 Dec 2016 08:02:59 +0000 (11:02 +0300)]
Fix 'bogus LR' detection in FindTopOfStack (Darwin)
(fix commit 5742f86)

* darwin_stop_world.c [!DARWIN_DONT_PARSE_STACK] (GC_FindTopOfStack):
Use "UL" suffix (instead of "U") for 0x3 (on the right side of the
comparison) to avoid implicit unsigned int-to-long value extension
of "~" operator result.

7 years agoEnable mprotect-based incremental GC for Win64 (GCC)
Ivan Maidanski [Wed, 7 Dec 2016 07:49:53 +0000 (10:49 +0300)]
Enable mprotect-based incremental GC for Win64 (GCC)

* include/private/gcconfig.h [X86_64 && MSWIN32 && __GNUC__]
(MPROTECT_VDB): Define for GCC 4.7+ too; update comment.

7 years agoWorkaround 'pointer used before comparison to null' code defect (pthread)
Ivan Maidanski [Wed, 7 Dec 2016 07:40:15 +0000 (10:40 +0300)]
Workaround 'pointer used before comparison to null' code defect (pthread)
(fix commit 31b3afc)

* pthread_support.c [GC_PTHREADS && !GC_WIN32_THREADS && DEBUG_THREADS]
(GC_pthread_create): Do not check new_thread is non-NULL (because
new_thread is first passed to the underlying pthread_create() where
the argument is marked with "nonnull" attribute).

7 years agoFix '32-bit value shift followed by expansion to 64-bit' code defect
Ivan Maidanski [Wed, 7 Dec 2016 07:22:09 +0000 (10:22 +0300)]
Fix '32-bit value shift followed by expansion to 64-bit' code defect

* gcj_mlc.c [GC_GCJ_SUPPORT] (GC_core_gcj_malloc,
GC_gcj_malloc_ignore_off_page): Cast lg local variable to word before
passing it to GRANULES_TO_BYTES (so that value type widening does not
occur after the value left shift).
* malloc.c (GC_generic_malloc_inner, GC_malloc_kind_global,
GC_generic_malloc_uncollectable): Likewise.
* typd_mlc.c (GC_malloc_explicitly_typed_ignore_off_page): Likewise.
* misc.c (block_add_size): Cast hhdr->hb_sz to word before passing it
to WORDS_TO_BYTES; cast HBLKSIZE-1 to word before "~" operation.

7 years agoFix 'GC_written_pages never read' code defect (GWW_VDB)
Ivan Maidanski [Tue, 6 Dec 2016 07:49:52 +0000 (10:49 +0300)]
Fix 'GC_written_pages never read' code defect (GWW_VDB)

* include/private/gc_priv.h [GWW_VDB] (GC_written_pages,
GC_arrays._written_pages): Do not define unless CHECKSUMS.
* os_dep.c [GWW_VDB] (GC_or_pages): Likewise.
* os_dep.c [GWW_VDB] (GC_gww_read_dirty): Call
GC_or_pages(GC_written_pages) only if CHECKSUMS.

7 years agoFix 'context local variable might be clobbered by setjmp' compiler warning
Ivan Maidanski [Mon, 5 Dec 2016 23:21:33 +0000 (02:21 +0300)]
Fix 'context local variable might be clobbered by setjmp' compiler warning

* mach_dep.c (GC_with_callee_saves_pushed): Mark "context" local
variable as volatile (to prevent it from potential clobbering).

7 years agoFix message of VDB implementation used if MPROTECT_VDB+GWW_VDB (gctest)
Ivan Maidanski [Mon, 5 Dec 2016 23:06:36 +0000 (02:06 +0300)]
Fix message of VDB implementation used if MPROTECT_VDB+GWW_VDB (gctest)

* tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS
&& !NO_INCREMENTAL] (main): If MPROTECT_VDB and GWW_VDB are both
defined then also print "Using GetWriteWatch-based implementation"
message.

7 years agoTest GCJ object creation with length-based descriptor (gctest)
Ivan Maidanski [Mon, 5 Dec 2016 22:38:49 +0000 (01:38 +0300)]
Test GCJ object creation with length-based descriptor (gctest)

* tests/test.c [GC_GCJ_SUPPORT] (gcj_cons): Define new static variable
obj_cnt; increment obj_cnt on each call; if obj_cnt is odd then pass
gcj_class_struct1 to GC_GCJ_MALLOC instead of gcj_class_struct2.

7 years agoFix potential data race in GC_SysVGetDataStart (SPARC)
Ivan Maidanski [Mon, 5 Dec 2016 21:49:33 +0000 (00:49 +0300)]
Fix potential data race in GC_SysVGetDataStart (SPARC)

* os_dep.c [SVR4 || AUX || DGUX || LINUX && SPARC]
(GC_SysVGetDataStart): Use AO_fetch_and_add(p,0) if available instead
of non-atomic read/write in *p = *p statement (thus, to avoid data race
though it is highly unlikely).

7 years agoFix a typo in comment in GC_SysVGetDataStart
Ivan Maidanski [Mon, 5 Dec 2016 20:54:57 +0000 (23:54 +0300)]
Fix a typo in comment in GC_SysVGetDataStart

* os_dep.c [SVR4 || AUX || DGUX || LINUX && SPARC]
(GC_SysVGetDataStart): Fix a typo in comment ("brought").

7 years agoTravis CI configuration: turn on pointer backtracing
Ivan Maidanski [Mon, 28 Nov 2016 10:11:35 +0000 (13:11 +0300)]
Travis CI configuration: turn on pointer backtracing

7 years agoTravis CI configuration: also build and test C++
Ivan Maidanski [Mon, 28 Nov 2016 06:46:28 +0000 (09:46 +0300)]
Travis CI configuration: also build and test C++

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Sun, 27 Nov 2016 20:31:22 +0000 (23:31 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Sun, 27 Nov 2016 20:13:51 +0000 (23:13 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

7 years agoSuppress 'use of GNU address-of-label extension' warning for Clang 3.3+
Ivan Maidanski [Sat, 26 Nov 2016 14:24:52 +0000 (17:24 +0300)]
Suppress 'use of GNU address-of-label extension' warning for Clang 3.3+
(fix commit 84c0313)

* mark.c [WRAP_MARK_SOME && __GNUC__ && (MSWIN32 || MSWINCE)]
(GC_mark_some): Use pragma "GCC diagnostic" even for Clang v3.3 .. v3.5.

7 years agoSuppress 'taking address of label non-standard' GCC/Clang pedantic warning
Ivan Maidanski [Fri, 25 Nov 2016 11:10:37 +0000 (14:10 +0300)]
Suppress 'taking address of label non-standard' GCC/Clang pedantic warning

* mark.c [WRAP_MARK_SOME && __GNUC__ && (MSWIN32 || MSWINCE)]
(GC_mark_some): Use pragma "GCC diagnostic ignored" to temporarily
suppress "taking the address of a label is non-standard" (or
"use of GNU address-of-label extension" in case of Clang) warning for
"&&handle_ex" expression.

7 years agoFix Solaris/sparc detection in case of strict C compliance is enforced
Ivan Maidanski [Wed, 23 Nov 2016 01:47:19 +0000 (04:47 +0300)]
Fix Solaris/sparc detection in case of strict C compliance is enforced

* include/gc_config_macros.h [__i386__ || __amd64__] (GC_SOLARIS_THREADS):
Define also if __sun is defined (treat __sun as a synonym to sun).
* include/private/gcconfig.h [__i386__ || __amd64] (SOLARIS):
Likewise.
* include/gc_config_macros.h [sun] (GC_SOLARIS_THREADS): Define also
if __amd64 is defined (treat __amd64 as a synonym to __amd64__).
* include/gc_config_macros.h [sparc && unix] (DRSNX): Do not define if
SPARC and SOLARIS are already defined.

7 years agoReport gcc/clang pedantic warnings (configure)
Ivan Maidanski [Tue, 22 Nov 2016 12:18:36 +0000 (15:18 +0300)]
Report gcc/clang pedantic warnings (configure)

* configure.ac [GCC] (WPEDANTIC): New variable (set to
"-Wpedantic -Wno-long-long" if supported by the compiler).
* configure.ac [GCC] (CFLAGS): Add $WPEDANTIC.

7 years agoFix assertion violation in GC_repeat_read if --enable-redirect-malloc
Ivan Maidanski [Sat, 19 Nov 2016 17:37:04 +0000 (20:37 +0300)]
Fix assertion violation in GC_repeat_read if --enable-redirect-malloc

* malloc.c [REDIRECT_MALLOC && GC_LINUX_THREADS] (GC_init_lib_bounds):
Declare cancel_state local variable; DISABLE_CANCEL for GC_text_mapping
(because GC_repeat_read expects the cancellation state off); call
RESTORE_CANCEL on return.

7 years agoFix threaded tests runtime crash if GC_NO_THREAD_REDIRECTS supplied
Ivan Maidanski [Sat, 19 Nov 2016 17:16:27 +0000 (20:16 +0300)]
Fix threaded tests runtime crash if GC_NO_THREAD_REDIRECTS supplied

* tests/disclaim_test.c (GC_NO_THREAD_REDIRECTS): Undefine (before
include "gc*.h").
* tests/test.c (GC_NO_THREAD_REDIRECTS): Likewise.
* tests/thread_leak_test.c (GC_NO_THREAD_REDIRECTS): Likewise.