Ivan Maidanski [Tue, 14 Mar 2017 22:58:41 +0000 (01:58 +0300)]
Fix GC_SIZE_MAX definition (Linux/musl-gcc)
* include/private/gc_priv.h [SIZE_MAX && !CPPCHECK] (GC_SIZE_MAX): Cast
SIZE_MAX to size_t explicitly (to workaround incorrect definition
of SIZE_MAX - e.g. it is defined as ~0ULL in musl-tools which is not
correct for a 32-bit target).
Ivan Maidanski [Tue, 14 Mar 2017 06:43:28 +0000 (09:43 +0300)]
Allow compilation of PROC_VDB code on Linux host (GC_NO_SYS_FAULT_H)
This is to check that PROC_VDB code compilation is ok. The code will
not work on a non-Solaris host, of course, because of lack of "pagedata"
file, so -D NO_INCREMENTAL should be additionally specified to avoid
abort during GC initialization (in gctest).
* os_dep.c [PROC_VDB && GC_NO_SYS_FAULT_H]: Do not include sys/fault.h
and sys/procfs.h.
* os_dep.c [PROC_VDB && GC_NO_SYS_FAULT_H] (PG_MODIFIED,
struct prpageheader, struct prasmap): Define explicitly.
* os_dep.c [PROC_VDB && GC_NO_SYS_FAULT_H && CPPCHECK] (GC_read_dirty):
Call GC_noop1 for dummy fields of prpageheader and prasmap.
* include/private/gc_pmark.h [MARK_BIT_PER_OBJ] (PUSH_CONTENTS_HDR):
Declare "obj_displ" local variable at the beginning of the block (not
after GC_STATIC_ASSERT).
Ivan Maidanski [Fri, 10 Mar 2017 16:13:52 +0000 (19:13 +0300)]
Remove Makefile KandRtest target (that supported K&R C compiler)
* Makefile.direct (test): Execute setjmp_test, gctest directly (instead
of depending on KandRtest).
* Makefile.direct (KandRtest): Remove (with the comment about K&R C
compiler).
Ivan Maidanski [Thu, 9 Mar 2017 22:03:05 +0000 (01:03 +0300)]
Use __thread keyword for Android NDK r12b+ Clang (arm)
* include/private/gcconfig.h (GC_CLANG_PREREQ_FULL): New macro (to check
the required patch_level of Clang).
* include/private/thread_local_alloc.h [PLATFORM_ANDROID && ARM32]
(USE_COMPILER_TLS): Define for clang-3.8.256229 or later.
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.
* 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: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 [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 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.
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).
* 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 [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 [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.
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).
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).