]> granicus.if.org Git - gc/log
gc
7 years agoFix comments style in configure.ac and Makefile.am
Ivan Maidanski [Fri, 18 May 2018 18:36:37 +0000 (21:36 +0300)]
Fix comments style in configure.ac and Makefile.am
(a cherry-pick of commit a043dade from 'master')

Do not allow the comments that are meaningless in the auto-generated
configure and Makefile.in to be put to these files.

* Makefile.am (EXTRA_DIST, SINGLE_GC_OBJ, EXTRA_DIST,
include doc/doc.am): Change comment style from "#" to "##".
* Makefile.am (CPLUSPLUS): Move "#" inside the conditional block.
* configure.ac: Update the copyright.
* configure.ac: Change comment style from "#" to "dnl" for the comments
that are meaningless in auto-generated configure file.

7 years agoFix infinite restarting of mark_some when a static root disappeared (Linux)
Ivan Maidanski [Mon, 7 May 2018 08:05:15 +0000 (11:05 +0300)]
Fix infinite restarting of mark_some when a static root disappeared (Linux)
(a cherry-pick of commits 38d194a3e849b45c from 'master')

Issue #218 (bdwgc).

* dyn_load.c [USE_PROC_FOR_LIBRARIES] (GC_register_map_entries): Call
GC_remove_roots_subregion for each region which has prot starting
with "---"; add comment.
* include/private/gc_priv.h [USE_PROC_FOR_LIBRARIES]
(GC_remove_roots_subregion): Declare function.
* mark_rts.c [USE_PROC_FOR_LIBRARIES] (GC_remove_roots_subregion):
Implement (including partial overlapping).

7 years agoFix return type in GC_set_warn_proc API documentation
Ivan Maidanski [Tue, 15 May 2018 07:47:18 +0000 (10:47 +0300)]
Fix return type in GC_set_warn_proc API documentation
(a cherry-pick of commit a63c89e7 from 'master')

* doc/gcinterface.html: Change GC_set_warn_proc return type from
GC_warn_proc to void.

7 years agoReally abort if failed to read /proc for library registration (Linux)
Ivan Maidanski [Fri, 4 May 2018 08:15:55 +0000 (11:15 +0300)]
Really abort if failed to read /proc for library registration (Linux)

* dyn_load.c [USE_PROC_FOR_LIBRARIES] (GC_register_map_entries):
Change return type from word to void; remove "return 1".
* dyn_load.c [USE_PROC_FOR_LIBRARIES] (GC_register_dynamic_libraries):
Call ABORT() if GC_get_maps() returned null.
* os_dep.c [NEED_PROC_MAPS] (GC_get_maps): Remove outdated comment
(about fn).

7 years agoUpdate AUTHORS file (add Naoyuki Sawa)
Ivan Maidanski [Thu, 3 May 2018 07:24:24 +0000 (10:24 +0300)]
Update AUTHORS file (add Naoyuki Sawa)
(a cherry-pick of commit 2b759983 from 'master')

7 years agoFix register_dynamic_libraries on Windows 10
Naoyuki Sawa [Wed, 2 May 2018 04:10:23 +0000 (13:10 +0900)]
Fix register_dynamic_libraries on Windows 10

Issue #219 (bdwgc).

In the past (Windows XP, Windows 7, and older Windows 10), VirtualQuery
always returned PAGE_READWRITE for the data section.
In the April 2018 Update of Windows 10, it seems that PAGE_WRITECOPY
is returned sometimes (thus causing GC_register_dynamic_libraries not
to call GC_cond_add_roots for the section).

* dyn_load.c [MSWIN32 || MSWINCE || CYGWIN32]
(GC_register_dynamic_libraries): Call GC_cond_add_roots()
also for PAGE_EXECUTE_WRITECOPY and PAGE_WRITECOPY pages.

7 years agoWorkaround 'function nested_sp is never used' cppcheck style warning
Ivan Maidanski [Tue, 15 May 2018 09:39:03 +0000 (12:39 +0300)]
Workaround 'function nested_sp is never used' cppcheck style warning

The warning should not be produced by cppcheck as nested_sp is assigned
to nested_sp_fn variable.

* tools/setjmp_t.c [CPPCHECK] (main): Call nested_sp() directly; add
comment.

7 years agoWorkaround 'class C does not have a copy constructor' cppcheck warning
Ivan Maidanski [Thu, 3 May 2018 21:51:21 +0000 (00:51 +0300)]
Workaround 'class C does not have a copy constructor' cppcheck warning

* tests/test_cpp.cc (class C): Add a copy constructor and an assignment
operator; add comment.

7 years agoWorkaround 'opposite expression on both sides of &' cppcheck style warning
Ivan Maidanski [Thu, 3 May 2018 08:16:32 +0000 (11:16 +0300)]
Workaround 'opposite expression on both sides of &' cppcheck style warning

* mallocx.c (GC_posix_memalign): Replace (align-1)&align with
align_minus_one&align where align_minus_one local variable is set to
align-1.

7 years ago.gitignore: Ignore '.vs' folders
Ivan Maidanski [Tue, 19 Jun 2018 21:45:12 +0000 (00:45 +0300)]
.gitignore: Ignore '.vs' folders

7 years ago.gitignore: Ignore gc.def (produced by digimars.mak)
Ivan Maidanski [Thu, 31 May 2018 23:11:41 +0000 (02:11 +0300)]
.gitignore: Ignore gc.def (produced by digimars.mak)

7 years ago.gitignore: Ignore *.tds files (generated by bcc)
Ivan Maidanski [Thu, 31 May 2018 05:44:23 +0000 (08:44 +0300)]
.gitignore: Ignore *.tds files (generated by bcc)

7 years agoAvoid multiple 'getcontext failed' warnings if getcontext is broken
Ivan Maidanski [Thu, 26 Apr 2018 07:54:52 +0000 (10:54 +0300)]
Avoid multiple 'getcontext failed' warnings if getcontext is broken
(back-port of commits b5941322bfaff7 from 'master')

Issue #133 (bdwgc).

* mach_dep.c [!HAVE_PUSH_REGS && UNIX_LIKE && !NO_GETCONTEXT]
(GC_with_callee_saves_pushed): Define getcontext_works static variable;
do not call getcontext() if getcontext_works < 0; add comment; set
getcontext_works to 1 or -1 (depending whether getcontext is working)
if getcontext_works is zero.
* misc.c [THREADS && UNIX_LIKE && !NO_GETCONTEXT]
(callee_saves_pushed_dummy_fn): New static function (empty).
* misc.c [THREADS && UNIX_LIKE && !NO_GETCONTEXT] (GC_init): Call
GC_with_callee_saves_pushed(callee_saves_pushed_dummy_fn) if GC_dont_gc
or GC_dont_precollect (otherwise it is called by GC_gcollect_inner);
add comment.

7 years agoInstall gc.3 man page instead of copying gc.man to doc folder (configure)
Ivan Maidanski [Tue, 24 Apr 2018 21:56:36 +0000 (00:56 +0300)]
Install gc.3 man page instead of copying gc.man to doc folder (configure)
(back-port of commit c2773a5f from 'master')

* doc/doc.am [ENABLE_DOCS] (dist_doc_DATA): Remove doc/gc.man.
* doc/doc.am [ENABLE_DOCS] (dist_man3_MANS): Set to doc/gc.man.
* doc/gc.man (.TH): Rename GC_MALLOC to BDWGC.

7 years agoAdd initial RISC-V support
Shea Levy [Sun, 18 Feb 2018 06:37:12 +0000 (01:37 -0500)]
Add initial RISC-V support
(back-port of commits 4f7f0eebd3b008f79e from 'master')

Issue #208 (bdwgc).

* include/private/gcconfig.h [__riscv && LINUX] (RISCV,
mach_type_known): Define macro.
* include/private/gcconfig.h [RISCV] (MACH_TYPE): Likewise.
* include/private/gcconfig.h [RISCV && LINUX] (OS_TYPE, DATASTART,
LINUX_STACKBOTTOM, DYNAMIC_LOADING): Likewise.
* include/private/gcconfig.h [RISCV && LINUX] (__data_start): Declare
external variable.
* include/private/gcconfig.h [RISCV] (CPP_WORDSZ, ALIGNMENT): Define
using __riscv_xlen.

7 years ago[7.6.6] v7.6.6
Ivan Maidanski [Fri, 20 Apr 2018 17:37:01 +0000 (20:37 +0300)]
[7.6.6]

Bump gc version to 7.6.6

* ChangeLog (7.6.6): Set release date; list all changes including the
changes of v7.4.12 and v7.2k.
* Makefile.am (LIBGC_VER_INFO): Increment revision (change version info
of libgc.so to 4:3:3).
* README.md: Bump micro version.
* configure.ac (AC_INIT): Likewise.
* include/gc_version.h (GC_TMP_VERSION_MICRO): Likewise.

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Fri, 20 Apr 2018 07:58:39 +0000 (10:58 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoEliminate 'boolean result used in bitwise operation' cppcheck warning
Ivan Maidanski [Thu, 19 Apr 2018 23:19:19 +0000 (02:19 +0300)]
Eliminate 'boolean result used in bitwise operation' cppcheck warning

* finalize.c (GC_push_finalizer_structures): Replace (word)&sym to
(word)(&sym).
* typd_mlc.c (GC_add_ext_descriptor): Likewise.

7 years agoWorkaround gctest hang on kFreeBSD if thread-local allocations are on
Ivan Maidanski [Thu, 19 Apr 2018 22:15:53 +0000 (01:15 +0300)]
Workaround gctest hang on kFreeBSD if thread-local allocations are on
(back-port of commit 228e9b2 from 'master')

Issue #185 (bdwgc).

* configure.ac [enable_gcj_support] (THREAD_LOCAL_ALLOC): Do not
AC_DEFINE if host is kfreebsd; add FIXME item.

7 years agoUpdate ChangeLog file (add gc-7.4.12 release date)
Ivan Maidanski [Thu, 19 Apr 2018 06:44:21 +0000 (09:44 +0300)]
Update ChangeLog file (add gc-7.4.12 release date)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Wed, 18 Apr 2018 22:12:56 +0000 (01:12 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

7 years agoFix 'pointer of type void* used in arithmetic' compiler warning in dbg_mlc
Ivan Maidanski [Tue, 17 Apr 2018 21:20:46 +0000 (00:20 +0300)]
Fix 'pointer of type void* used in arithmetic' compiler warning in dbg_mlc
(fix of commit 8f63e5b)

* dbg_mlc.c [GC_ASSERTIONS] (GC_store_debug_info_inner): Cast p to
ptr_t when passed to CROSSES_HBLK().

7 years agoFix data race during apply_to_each_object(reset_back_edge)
Ivan Maidanski [Tue, 10 Apr 2018 08:07:08 +0000 (11:07 +0300)]
Fix data race during apply_to_each_object(reset_back_edge)
(back-port of commit d7ea0b1 from 'master')

Issue #144 (bdwgc).

* backgraph.c [MAKE_BACK_GRAPH] (GC_print_back_graph_stats): Add
assertion that the allocation lock is held; store GC_deepest_obj to
obj local variable (while holding the lock); place UNLOCK/LOCK around
GC_print_heap_obj() call; pass obj to GC_print_heap_obj().
* finalize.c [MAKE_BACK_GRAPH] (GC_notify_or_invoke_finalizers): Remove
UNLOCK/LOCK around GC_print_back_graph_stats() call.

7 years agoSupport threads for DragonFly in configure
Ivan Maidanski [Wed, 17 Jan 2018 22:14:27 +0000 (01:14 +0300)]
Support threads for DragonFly in configure
(back-port of commit 19c81d80 from 'master')

* configure.ac [THREADS=posix && host=*-*-dragonfly*] (GC_THREADS,
_REENTRANT, PARALLEL_MARK, THREAD_LOCAL_ALLOC): Define similar
to *-*-freebsd*.

7 years agoWorkaround sem_wait failure in pthread_create on Haiku
Ivan Maidanski [Tue, 6 Mar 2018 22:24:05 +0000 (01:24 +0300)]
Workaround sem_wait failure in pthread_create on Haiku

Issue #97 (bdwgc).

sem_wait() fails because of some bug in Haiku OS (as of hrev51798).

* pthread_support.c [GC_HAIKU_THREADS] (WRAP_FUNC(pthread_create)):
If errno is EACCES then just retry sem_wait instead of ABORT.

7 years agoWorkaround Haiku pthread_join failure in subthreadcreate_test
Ivan Maidanski [Tue, 6 Mar 2018 22:13:15 +0000 (01:13 +0300)]
Workaround Haiku pthread_join failure in subthreadcreate_test

Issue #97 (bdwgc).

The underlying pthread_join fails because of some bug in Haiku OS
(as of hrev51798) when many threads are created in parallel.

* tests/subthread_create.c [__HAIKU__]: Include errno.h.
* tests/subthread_create.c [__HAIKU__] (main): If pthread_join returned
value is ESRCH then just end the test normally (i.e. ignore the failure
of pthread_join); add comment and TODO item.

7 years agoUpdate AUTHORS file (add Calvin Hill)
Ivan Maidanski [Tue, 17 Apr 2018 20:04:02 +0000 (23:04 +0300)]
Update AUTHORS file (add Calvin Hill)

7 years agoInitial support of Haiku/amd64
Calvin Hill [Tue, 23 Jan 2018 14:54:59 +0000 (17:54 +0300)]
Initial support of Haiku/amd64
(back-port of commits 847927f2396ce1 from 'master')

* configure.ac (GC_HAIKU_THREADS): New AH_TEMPLATE.
* configure.ac [THREADS=posix && host=*-*-haiku*] (GC_THREADS,
_REENTRANT): Define macro.
* include/gc_config_macros.h [!GC_THREADS && GC_HAIKU_THREADS]
(GC_THREADS): Likewise.
* include/gc_config_macros.h [GC_THREADS && __HAIKU__]
(GC_HAIKU_THREADS): Likewise.
* include/gc_config_macros.h [__HAIKU__ && !GC_CAN_SAVE_CALL_STACKS]
(GC_ADD_CALLER): Define macro.
* include/private/gcconfig.h [__HAIKU__ && _X86_] (I386, HAIKU,
mach_type_known): Likewise.
* include/private/gcconfig.h [__HAIKU__ && (__amd64__ || __x86_64__)]
(X86_64, HAIKU, mach_type_known): Likewise.
* include/private/gcconfig.h [I386 && HAIKU] (DYNAMIC_LOADING,
MPROTECT_VDB): Likewise.
* include/private/gcconfig.h [X86_64 && HAIKU] (OS_TYPE, GETPAGESIZE,
DYNAMIC_LOADING, MPROTECT_VDB, HEURISTIC2, SEARCH_FOR_DATA_START):
Likewise.
* include/private/gcconfig.h [HAIKU] (UNIX_LIKE, GET_MEM): Likewise.
* os_dep.c [MPROTECT_VDB && !DARWIN && !MSWIN32 && !MSWINCE
&& HAIKU] (CODE_OK): Likewise.
* include/private/gcconfig.h [UNIX_LIKE && HAIKU] (NO_GETCONTEXT):
Likewise.
* dyn_load.c [HAIKU] (GC_register_dynamic_libraries): Implement.
* os_dep.c [HAIKU] (GC_haiku_get_mem): Likewise.
* include/private/gcconfig.h (BEOS): Rename to HAIKU.
* os_dep.c (BEOS): Likewise.
* include/private/gcconfig.h [I386 && HAIKU] (OS_TYPE): Change value
to "HAIKU".
* include/private/gcconfig.h [X86_64 && HAIKU]: Include OS.h.
* include/private/gcconfig.h [HAIKU] (GC_haiku_get_mem): Declare
prototype.
* include/private/thread_local_alloc.h [GC_HAIKU_THREADS]
(USE_PTHREAD_SPECIFIC): Likewise.
* os_dep.c [(NEED_FIND_LIMIT || UNIX_LIKE) && HAIKU] (old_segv_act):
Define static variable.
* os_dep.c [(NEED_FIND_LIMIT || UNIX_LIKE) && HAIKU]
(GC_set_and_save_fault_handler): Use old_segv_act; call
sigaction(SIGSEGV).
* os_dep.c [NEED_FIND_LIMIT || (USE_PROC_FOR_LIBRARIES && THREADS)]
(GC_reset_fault_handler): Likewise.
* os_dep.c [MPROTECT_VDB && !DARWIN && !USE_WINALLOC && HAIKU]: Do not
include sys/syscall.h.
* pthread_support.c [GC_HAIKU_THREADS] (GC_get_nprocs): Define function.

7 years agoFix the collector hang when it is configured with --enable-gc-debug
Ivan Maidanski [Thu, 15 Mar 2018 07:10:39 +0000 (10:10 +0300)]
Fix the collector hang when it is configured with --enable-gc-debug
(back-port of commits d6ccabe2e8c66c from 'master')

Issue #205 (bdwgc).

* dbg_mlc.c (GC_store_debug_info_inner): Remove comment (as it exists
in the header); change from STATIC to GC_INNER.
* dbg_mlc.c (GC_store_debug_info): Change from GC_INNER to static;
remove GC_ prefix; replace ptr_t to void*; add fn argument;
replace "const char *string, int linenum" with GC_EXTRA_PARAMS;
change "word sz" argument to "size_t lb"; allow p to be null (print
error message in this case); call GC_start_debugging_inner unless
GC_debugging_started; call ADD_CALL_CHAIN.
* dbg_mlc.c (GC_start_debugging): Remove.
* dbg_mlc.c (GC_debug_malloc, GC_debug_malloc_ignore_off_page,
GC_debug_malloc_atomic_ignore_off_page, GC_debug_generic_malloc,
GC_debug_malloc_atomic, GC_debug_malloc_uncollectable): Call
store_debug_info() instead of checking result for null and calling
GC_start_debugging, ADD_CALL_CHAIN, GC_store_debug_info; use OPT_RA.
* dbg_mlc.c [STUBBORN_ALLOC] (GC_debug_malloc_stubborn): Likewise.
* dbg_mlc.c [GC_ATOMIC_UNCOLLECTABLE]
(GC_debug_malloc_atomic_uncollectable): Likewise.
* gcj_mlc.c [GC_GCJ_SUPPORT] (GC_debug_gcj_malloc): Call ADD_CALL_CHAIN
while holding the lock; call GC_store_debug_info_inner (holding the
lock) instead of GC_store_debug_info.
* include/private/dbg_mlc.h (ADD_CALL_CHAIN): Update comment.
* include/private/gc_priv.h (GC_store_debug_info): Replace with
GC_store_debug_info_inner; update comment; change ptr_t to void*.
* os_dep.c [SAVE_CALL_CHAIN] (GC_save_callers): Add assertion that the
allocation lock is held; add comment.

7 years agoEliminate TSan warning about data race when accessing GC_debugging_started
Ivan Maidanski [Fri, 17 Nov 2017 08:07:03 +0000 (11:07 +0300)]
Eliminate TSan warning about data race when accessing GC_debugging_started

Now GC_debugging_started variable is double-checked with the allocation
lock held before calling GC_start_debugging_inner.

* dbg_mlc.c (GC_start_debugging_inner): Define as GC_INNER (instead of
STATIC).
* dbg_mlc.c [THREADS] (GC_start_debugging): Define as STATIC; do not
call GC_start_debugging_inner() if GC_debugging_started.
* dbg_mlc.c [!THREADS] (GC_start_debugging): Define as macro (redirect
to GC_start_debugging_inner).
* gcj_mlc.c (GC_debug_gcj_malloc): Call GC_start_debugging_inner
(holding the lock) instead of GC_start_debugging.
* include/private/gc_priv.h (GC_start_debugging): Rename to
GC_start_debugging_inner; improve usage comment.

7 years agoFix unbounded heap growth in case of intensive disappearing links usage
Ivan Maidanski [Tue, 20 Mar 2018 21:58:24 +0000 (00:58 +0300)]
Fix unbounded heap growth in case of intensive disappearing links usage
(back-port of commits b04b34646e7ec2 from 'master')

Issue #182 (bdwgc).

* finalize.c (GC_ON_GROW_LOG_SIZE_MIN): New macro (defined to
CPP_LOG_HBLKSIZE value by default).
* finalize.c (GC_grow_table): Rename size_ptr to log_size_ptr in
comment; add entries_ptr argument; add comment; call if log_old_size is
GC_ON_GROW_LOG_SIZE_MIN or bigger then call GC_try_to_collect_inner
(surrounded with DISABLE/RESTORE_CANCEL) and, then, return from the
function if the number of entries is less than 75% of the table
capacity.
* finalize.c (GC_register_disappearing_link_inner): Pass
dl_hashtbl->entries pointer to GC_grow_table.
* finalize.c (GC_register_finalizer_inner): Pass GC_fo_entries pointer
to GC_grow_table.

7 years agoFix null dereference in print_callers on backtrace_symbols failure
Ivan Maidanski [Fri, 6 Apr 2018 16:07:50 +0000 (19:07 +0300)]
Fix null dereference in print_callers on backtrace_symbols failure

* os_dep.c [NEED_CALLINFO && GC_HAVE_BUILTIN_BACKTRACE
&& !GC_BACKTRACE_SYMBOLS_BROKEN] (GC_print_callers): If sym_name is
NULL then print info[i].ci_pc to buf and set name to buf (instead of
to sym_name[0]).
* os_dep.c [NEED_CALLINFO && GC_HAVE_BUILTIN_BACKTRACE
&& !GC_BACKTRACE_SYMBOLS_BROKEN] (GC_print_callers): Do not call
free(sym_name) if sym_name is NULL.

7 years agoFix null pointer dereference in get_private_path_and_zero_file (Symbian)
Ivan Maidanski [Fri, 6 Apr 2018 06:32:12 +0000 (09:32 +0300)]
Fix null pointer dereference in get_private_path_and_zero_file (Symbian)
(back-port of commit 9d019e2e from 'master')

* extra/symbian.cpp (GC_get_private_path_and_zero_file): Do not call
memcpy() if allocation of copyChar is failed.
* os_dep.c [MMAP_SUPPORTED && !USE_MMAP_ANON] (zero_fd): Initialize
global variable to -1 (instead of 0).
* os_dep.c [MMAP_SUPPORTED && !USE_MMAP_ANON && SYMBIAN]
(GC_unix_mmap_get_mem): Do not call open() and free() if path is NULL.

7 years agoFix missing SIGBUS handler setup for kFreeBSD
Ivan Maidanski [Fri, 6 Apr 2018 06:13:03 +0000 (09:13 +0300)]
Fix missing SIGBUS handler setup for kFreeBSD

Issue #184 (bdwgc).

* os_dep.c [MPROTECT_VDB && !DARWIN && !MSWIN32 && !MSWINCE && FREEBSD
&& __GLIBC__] (GC_mprotect_dirty_init): Call sigaction(SIGBUS).

7 years agoDefine GC_FREEBSD_THREADS and GC_ADD_CALLER macros for kFreeBSD
Ivan Maidanski [Fri, 6 Apr 2018 05:59:22 +0000 (08:59 +0300)]
Define GC_FREEBSD_THREADS and GC_ADD_CALLER macros for kFreeBSD
(back-port of commit 5700d205 from 'master')

* include/gc_config_macros.h [__FreeBSD_kernel__] (GC_FREEBSD_THREADS):
Define macro.
* include/gc_config_macros.h [__FreeBSD_kernel__
&& !GC_CAN_SAVE_CALL_STACKS] (GC_ADD_CALLER): Likewise.

7 years agoEliminate 'there is pointer arithmetic with NULL' cppcheck warning
Ivan Maidanski [Thu, 5 Apr 2018 21:42:29 +0000 (00:42 +0300)]
Eliminate 'there is pointer arithmetic with NULL' cppcheck warning

* extra/msvc_dbg.c (GetDescriptionFromStack): Compare size to 0 instead
of comparing description to NULL; mark format argument as used.
* extra/msvc_dbg.c (backtrace_symbols): Do not call
GetDescriptionFromStack if symbols (description) is NULL but size is
non-zero.

7 years agoExplicitly unblock GC signals on GC initialization
Ivan Maidanski [Thu, 22 Mar 2018 22:09:40 +0000 (01:09 +0300)]
Explicitly unblock GC signals on GC initialization

Issue #175 (bdgwc).

Note: NO_SIGNALS_UNBLOCK_IN_MAIN macro is to be defined manually to
turn off this feature (for a reason).

* include/private/gcconfig.h [GC_NO_PTHREAD_SIGMASK]
(NO_SIGNALS_UNBLOCK_IN_MAIN): New macro.
* pthread_stop_world.c [GC_PTHREADS && !GC_WIN32_THREADS
&& !GC_DARWIN_THREADS && !SN_TARGET_ORBIS && !SN_TARGET_PSP2 && !NACL
&& !GC_OPENBSD_UTHREADS && !NO_SIGNALS_UNBLOCK_IN_MAIN]
(GC_unblock_gc_signals): Define.
* pthread_stop_world.c [GC_PTHREADS && !GC_WIN32_THREADS
&& !GC_DARWIN_THREADS && !SN_TARGET_ORBIS && !SN_TARGET_PSP2 && !NACL
&& !GC_OPENBSD_UTHREADS && !NO_SIGNALS_UNBLOCK_IN_MAIN] (GC_stop_init):
Call GC_unblock_gc_signals; add comment.

7 years agoFix thread_suspend fail for threads registered from key destructor (OS X)
Ivan Maidanski [Fri, 23 Mar 2018 08:13:23 +0000 (11:13 +0300)]
Fix thread_suspend fail for threads registered from key destructor (OS X)

Issue #213 (bdwgc).

* pthread_support.c [GC_DARWIN_THREADS] (GC_register_my_thread):
Reinitialize stop_info.mach_thread if the thread is registered from
the client thread key destructor; add comment.

7 years agoFix assertion violation in DllMain of win32_threads
Ivan Maidanski [Thu, 22 Mar 2018 08:24:04 +0000 (11:24 +0300)]
Fix assertion violation in DllMain of win32_threads

DllMain(DLL_THREAD_ATTACH) might be called for C runtime threads
before main() is launched, so this commit just removes wrong
assertion in DllMain.

* win32_threads.c [!GC_NO_THREADS_DISCOVERY] (GC_DllMain): Remove
entry_count static variable; remove assertion for entry_count and
parallel_initialized values in DLL_THREAD_ATTACH case.

7 years agoFix 'scope of var can be reduced' cppcheck err in enqueue_all_finalizers
Ivan Maidanski [Thu, 15 Mar 2018 20:38:31 +0000 (23:38 +0300)]
Fix 'scope of var can be reduced' cppcheck err in enqueue_all_finalizers
(back-port of commit b82af3a3 from 'master')

* finalize.c [!JAVA_FINALIZATION_NOT_NEEDED]
(GC_enqueue_all_finalizers): Declare curr_fo and real_ptr in the scopes
of their use.

7 years agoFix comment for debug_generic_malloc_inner[_ignore_off_page]
Ivan Maidanski [Thu, 15 Mar 2018 07:41:22 +0000 (10:41 +0300)]
Fix comment for debug_generic_malloc_inner[_ignore_off_page]
(fix of commit 38965f279)

* dbg_mlc.c [DBG_HDRS_ALL] (GC_debug_generic_malloc_inner): Update
comment after adding GC_start_debugging[_inner] call.

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Mon, 5 Mar 2018 10:55:41 +0000 (13:55 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Sun, 4 Mar 2018 15:52:32 +0000 (18:52 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
(a cherry-pick of commit 08a2e0ba from 'release-7_4')

7 years agoFix missing GC_generic_malloc_words_small implementation in new_gc_alloc.h
Ivan Maidanski [Thu, 1 Mar 2018 19:47:22 +0000 (22:47 +0300)]
Fix missing GC_generic_malloc_words_small implementation in new_gc_alloc.h

* include/new_gc_alloc.h (GC_generic_malloc_words_small): Replace
prototype with a macro (that uses GC_generic_malloc); remove FIXME item.

7 years agoFix include gc_gcj.h in thread_local_alloc.c
Ivan Maidanski [Wed, 28 Feb 2018 20:16:36 +0000 (23:16 +0300)]
Fix include gc_gcj.h in thread_local_alloc.c
(back-port of commit 60d9632a from 'master')

The #include for the public GC headers should not contain "include/"
prefix.

* thread_local_alloc.c [GC_GCJ_SUPPORT]: Include "gc_gcj.h" instead of
"include/gc_gcj.h".

7 years agoRemove API symbols renaming in WCC_MAKEFILE
Ivan Maidanski [Wed, 28 Feb 2018 06:27:26 +0000 (09:27 +0300)]
Remove API symbols renaming in WCC_MAKEFILE

GC_is_marked, GC_incr_bytes_allocd, GC_incr_bytes_freed are now
declared as GC_API, the so symbols renaming by the linker is not needed.

GC_generic_malloc_words_small does not exist anymore.

* WCC_MAKEFILE [MAKE_AS_DLL] (gc.dll): Remove "append $*.lnk export"
for GC_is_marked, GC_incr_bytes_allocd, GC_incr_bytes_freed,
GC_generic_malloc_words_small.
* WCC_MAKEFILE (gc.lib): Adjust indentation.
* WCC_MAKEFILE [MAKE_AS_DLL] (gctest.exe): Remove "append $*.lnk import"
for GC_is_marked.
* WCC_MAKEFILE [MAKE_AS_DLL] (test_cpp.exe): Remove
"append $*.lnk import" for GC_incr_bytes_allocd, GC_incr_bytes_freed,
GC_generic_malloc_words_small.

7 years agoTravis CI: Output content of threadkey_test.log
Ivan Maidanski [Wed, 28 Feb 2018 06:21:18 +0000 (09:21 +0300)]
Travis CI: Output content of threadkey_test.log

7 years agoFix typo in AIX macro name
Ivan Maidanski [Wed, 28 Feb 2018 05:26:27 +0000 (08:26 +0300)]
Fix typo in AIX macro name

* include/private/gc_priv.h [AIX] (NEED_FIND_LIMIT): Define macro
(rename AUX to AIX).
* os_dep.c [AIX && !PCR] (GC_SysVGetDataStart): Define function.

7 years agoFix dbg_mlc.c/o file name in documentation
Ivan Maidanski [Tue, 27 Feb 2018 21:35:19 +0000 (00:35 +0300)]
Fix dbg_mlc.c/o file name in documentation

* README.md (Debugging Facilities): Fix file name ("dbg_mlc.c").
* misc.c (GC_debugging_started): Fix file name ("dbg_mlc.o") in
comment.

7 years agoFix missing new-line in GC_INFOLOG_PRINTF call in ABORT_ARG<n>
Ivan Maidanski [Thu, 22 Feb 2018 21:54:02 +0000 (00:54 +0300)]
Fix missing new-line in GC_INFOLOG_PRINTF call in ABORT_ARG<n>

* include/private/gc_priv.h (ABORT_ARG1, ABORT_ARG2, ABORT_ARG3):
Output "\n" after C_fmt by GC_INFOLOG_PRINTF.

7 years agoUpdate AUTHORS file (add Natanael Copa)
Ivan Maidanski [Fri, 2 Mar 2018 17:15:31 +0000 (20:15 +0300)]
Update AUTHORS file (add Natanael Copa)

7 years agoFix gctest with musl libc on s390x
Natanael Copa [Tue, 6 Feb 2018 20:21:23 +0000 (21:21 +0100)]
Fix gctest with musl libc on s390x

Issue #202 (bdwgc).

DEFAULT_STACK_MAYBE_SMALL is only set if PARALLEL_MARK is set, but stack
is too small on musl libc even if PARALLEL_MARK is unset.  We solve this
by detecting musl via NO_GETCONTEXT.

7 years agoFix type of local variables receiving result of PHT_HASH
Ivan Maidanski [Thu, 22 Feb 2018 20:39:38 +0000 (23:39 +0300)]
Fix type of local variables receiving result of PHT_HASH
(back-port of commit 037991eb from 'master')

The variables should be of word type, not int or size_t.

* os_dep.c (GC_write_fault_handler, GC_remove_protection): Change type
of index local variable from size_t to word.
* os_dep.c [MPROTECT_VDB && DARWIN] (catch_exception_raise): Change
type of index local variable from int to word.

7 years agoFix man section number (3)
Ivan Maidanski [Mon, 19 Feb 2018 08:02:12 +0000 (11:02 +0300)]
Fix man section number (3)

Library calls should use section 3 (unlike Programs that use section 1).

* doc/gc.man (TH GC_MALLOC): Change section number from 1L to 3.

7 years agoFix arguments delimiter in pcr_interface.c (PCR)
Ivan Maidanski [Thu, 8 Feb 2018 08:45:57 +0000 (11:45 +0300)]
Fix arguments delimiter in pcr_interface.c (PCR)

* extra/pcr_interface.c (GC_enumerate_block): Replace ';' with ',' in
the arguments list.

7 years agoUpdate AUTHORS file (add Jay Krell)
Ivan Maidanski [Mon, 5 Feb 2018 07:14:09 +0000 (10:14 +0300)]
Update AUTHORS file (add Jay Krell)

7 years agoFix typo in comment in specific.h
Jay Krell [Mon, 5 Feb 2018 07:06:59 +0000 (10:06 +0300)]
Fix typo in comment in specific.h

* include/private/specific.h (tse): Fix a typo ("thread") in comment.

7 years agoFix 'undefined reference to __builtin_unwind_init' linker error (ArmCC)
Jonathan Chambers [Thu, 1 Feb 2018 21:35:49 +0000 (00:35 +0300)]
Fix 'undefined reference to __builtin_unwind_init' linker error (ArmCC)
(part of commit 9379c66 from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* include/private/gcconfig.h (HAVE_BUILTIN_UNWIND_INIT): Do not define
if __ARMCC_VERSION.

7 years agoWorkaround 'address of auto-variable returned' cppcheck error
Ivan Maidanski [Tue, 30 Jan 2018 08:11:45 +0000 (11:11 +0300)]
Workaround 'address of auto-variable returned' cppcheck error
(back-port of commit b51bdee1 from 'master')

* mark_rts.c [CPPCHECK] (GC_approx_sp): Use __builtin_frame_address.

7 years ago[7.6.4] v7.6.4
Ivan Maidanski [Fri, 26 Jan 2018 11:45:31 +0000 (14:45 +0300)]
[7.6.4]

Bump gc version to 7.6.4

* Makefile.am (LIBGC_VER_INFO): Increment revision (change version info
of libgc.so to 4:2:3, change version info of libgccpp.so to 4:1:3).
* README.md: Bump micro version.
* configure.ac (AC_INIT): Likewise.
* include/gc_version.h (GC_TMP_VERSION_MICRO): Likewise.

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Fri, 26 Jan 2018 11:30:43 +0000 (14:30 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoFix 'undeclared identifier USRSTACK' compiler error on OpenBSD-6.2
Peter Wang [Wed, 24 Jan 2018 14:37:23 +0000 (17:37 +0300)]
Fix 'undeclared identifier USRSTACK' compiler error on OpenBSD-6.2
(back-port of commits ef879a90bafc33 from 'master')

Issue #198 (bdwgc).

USRSTACK macro is defined in <machine/vmparam.h> but that is protected
by "ifdef _KERNEL" in <uvm/uvm_param.h>.

* include/private/gcconfig.h [POWERPC && OPENBSD && !GC_OPENBSD_THREADS]
(STACKBOTTOM): Add comment.
* include/private/gcconfig.h [(POWERPC || SPARC || I386 || MIPS
|| HP_PA || ALPHA || ARM32 || SH && !SH4 || X86_64) && OPENBSD
&& !GC_OPENBSD_THREADS] (STACKBOTTOM): Define only if USRSTACK is
defined.
* include/private/gcconfig.h [(POWERPC || SPARC || I386 || MIPS
|| HP_PA || ALPHA || ARM32 || SH && !SH4 || X86_64) && OPENBSD
&& !GC_OPENBSD_THREADS && !USRSTACK] (HEURISTIC2): Define.
* include/private/gcconfig.h [(MIPS || SH && !SH4) && OPENBSD]:
Reformat code.

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Wed, 24 Jan 2018 13:29:26 +0000 (16:29 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Mon, 22 Jan 2018 06:34:28 +0000 (09:34 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
(a cherry-pick of commit 357a28b8 from 'release-7_4')

7 years ago.gitignore: Ignore 'cords' marker file (generated by Makefile.direct)
Ivan Maidanski [Wed, 24 Jan 2018 13:13:26 +0000 (16:13 +0300)]
.gitignore: Ignore 'cords' marker file (generated by Makefile.direct)

7 years agoFix 'cords' parallel build in Makefile.direct
Ivan Maidanski [Tue, 23 Jan 2018 16:28:21 +0000 (19:28 +0300)]
Fix 'cords' parallel build in Makefile.direct

* Makefile.direct (cords): Create empty "cords" file after the last
if_not_there command is executed.
* Makefile.direct (clean): Remove "cords" file.

7 years agoDelete dont_ar_* build intermediate files on make clean (Makefile.direct)
Ivan Maidanski [Tue, 23 Jan 2018 15:31:44 +0000 (18:31 +0300)]
Delete dont_ar_* build intermediate files on make clean (Makefile.direct)

* Makefile.direct (clean): Add "rm dont_ar_*"; reorder items.

7 years ago.gitignore: Ignore dont_ar_* files (generated by Makefile.direct)
Ivan Maidanski [Tue, 23 Jan 2018 15:18:55 +0000 (18:18 +0300)]
.gitignore: Ignore dont_ar_* files (generated by Makefile.direct)

7 years agoFix libgc version which was changed in linkage breaking way (release-7_6)
Ivan Maidanski [Fri, 19 Jan 2018 08:24:31 +0000 (11:24 +0300)]
Fix libgc version which was changed in linkage breaking way (release-7_6)

Issue #197 (bdwgc).

* Makefile.am (LIBGC_VER_INFO): Change from 4:1:2 to 4:1:3 (to bring
the SONAME back to libgc.so.1).

7 years agoUpdate AUTHORS file (add Gustavo Giraldez)
Ivan Maidanski [Thu, 18 Jan 2018 21:55:08 +0000 (00:55 +0300)]
Update AUTHORS file (add Gustavo Giraldez)

7 years agoFix GC allocation mutex in child after a fork
Gustavo Giraldez [Thu, 18 Jan 2018 21:52:25 +0000 (00:52 +0300)]
Fix GC allocation mutex in child after a fork

Even though after a fork the child only inherits the single thread
that called the fork(), if another thread in the parent was attempting
to lock the mutex while being held in fork_child_prepare(), the mutex
will be left in an inconsistent state in the child after the UNLOCK().
This is the case, at least, in Mac OS X and leads to an unusable GC in
the child which will block when attempting to perform any GC operation
that acquires the mutex.

* pthread_support.c [CAN_HANDLE_FORK && USE_PTHREAD_LOCKS]
(fork_child_proc): Add assertion (after UNLOCK) that the lock is not
held actually, and, then, re-initialize GC_allocate_ml; add comments.

7 years agoFix missing EOLn output in threadlibs tool
Ivan Maidanski [Wed, 17 Jan 2018 21:46:38 +0000 (00:46 +0300)]
Fix missing EOLn output in threadlibs tool

* tools/threadlibs.c [GC_OSF1_THREADS] (main): Print "\n" after "-lrt".

7 years agoDo not declare dl_iterate_phdr as weak for DragonFly
Ivan Maidanski [Wed, 17 Jan 2018 08:45:56 +0000 (11:45 +0300)]
Do not declare dl_iterate_phdr as weak for DragonFly

* dyn_load.c [!USE_PROC_FOR_LIBRARIES && __DragonFly__]
(HAVE_DL_ITERATE_PHDR, DL_ITERATE_PHDR_STRONG): Define.

7 years agoFix threadlibs tool to output '-lpthread' for DragonFly
Ivan Maidanski [Wed, 17 Jan 2018 08:43:09 +0000 (11:43 +0300)]
Fix threadlibs tool to output '-lpthread' for DragonFly

* tools/threadlibs.c [GC_FREEBSD_THREADS && (__DragonFly__
|| !__FREEBSD_version)] (main): Print "-lpthread" (as well as for
__FREEBSD_version >= 500000).

7 years agoChange compiler invocation example in gc.man to use dynamic libgc
Ivan Maidanski [Wed, 17 Jan 2018 07:46:56 +0000 (10:46 +0300)]
Change compiler invocation example in gc.man to use dynamic libgc

* doc/gc.man (SYNOPSIS): Replace gc.a to -lgc option in the compiler
(cc) invocation example.

7 years agoAdd note of set_free_space_divisor, set_warn_proc ABI change after gc-7.1
Ivan Maidanski [Wed, 17 Jan 2018 07:42:04 +0000 (10:42 +0300)]
Add note of set_free_space_divisor, set_warn_proc ABI change after gc-7.1

Issue #197 (bdwgc).

GC_set_free_space_divisor() and GC_set_warn_proc() used to return
some value.  But starting from version 7.1alpha2, these API functions
do not return any value.

* include/gc.h (GC_set_free_space_divisor, GC_set_warn_proc): Add
comment that the setter used to returned the old value in gc-7.1 (and
previous versions).

7 years agoTravis CI: Fix ASan build with Clang-4.0 (add sudo)
Ivan Maidanski [Mon, 15 Jan 2018 22:19:01 +0000 (01:19 +0300)]
Travis CI: Fix ASan build with Clang-4.0 (add sudo)

7 years agoTravis CI: Do not use 'trusty' build environment
Ivan Maidanski [Mon, 25 Dec 2017 07:57:58 +0000 (10:57 +0300)]
Travis CI: Do not use 'trusty' build environment
(backport of commit 468ac9bd from 'master')

7 years agoPrevent DATASTART redefinition for NaCl
Ivan Maidanski [Mon, 15 Jan 2018 23:22:37 +0000 (02:22 +0300)]
Prevent DATASTART redefinition for NaCl
(backport of commit 331e3944 from 'master')

* include/private/gcconfig.h [NACL] (NO_PTHREAD_GETATTR_NP): Define.
* include/private/gcconfig.h [I386 && NACL] (OS_TYPE, etext, DATASTART,
_end, DATAEND, STACK_GRAN, HEURISTIC1, NO_PTHREAD_GETATTR_NP,
GETPAGESIZE, MAX_NACL_GC_THREADS): Remove.

7 years agoFix global operator delete definition for C++14 in gc_cpp
Ivan Maidanski [Mon, 15 Jan 2018 05:20:02 +0000 (08:20 +0300)]
Fix global operator delete definition for C++14 in gc_cpp

Issue #195 (bdwgc).

Sized variants of global operator delete should be defined along with
the non-sized ones.  Otherwise compiler might invoke the one from the
standard library (as observed in e.g. Cygwin) leading to a crash.

* gc_cpp.cc [!_MSC_VER && __cplusplus>201103L] (operator delete):
Define sized variant (the size argument is ignored for now).
* gc_cpp.cc [!_MSC_VER && __cplusplus>201103L && GC_OPERATOR_NEW_ARRAY
&& !CPPCHECK] (operator delete[]): Likewise.

7 years agoFix last_reclaimed..gc_no interval comparison to threshold in unmap_old
Ivan Maidanski [Sun, 14 Jan 2018 07:51:06 +0000 (10:51 +0300)]
Fix last_reclaimed..gc_no interval comparison to threshold in unmap_old
(fix commit 14c324f8b)

* allchblk.c [USE_MUNMAP] (GC_unmap_old): Replace
(unsigned short)GC_gc_no-hb_last_reclaimed to
(unsigned short)(GC_gc_no-hb_last_reclaimed) to handle
value wrapping in hb_last_reclaimed (and the truncated GC_gc_no)
correctly.

7 years agoRemove obsolete advice about linking with _DYNAMIC=0 (Linux)
Peter Wang [Fri, 12 Jan 2018 16:50:47 +0000 (19:50 +0300)]
Remove obsolete advice about linking with _DYNAMIC=0 (Linux)

Issue #196 (bdwgc).

The mentioned GCC option is not needed since gc-5.0alpha3 (when
_DYNAMIC symbol was declared as weak in dyn_load.c).
Even more, the advice is problematic for Alpine Linux (and probably
other systems using musl) as building a program with gcc -static
produces a binary containing a _DYNAMIC symbol with a non-zero address,
and forcing the address to 0 causes a crash during GC initialization.

* doc/README.linux: Remove note that static executable should be
linked with the gcc option "-Wl,-defsym,_DYNAMIC=0".

7 years agoFix error code in abort message if sem_wait failed in start_world (NetBSD)
Ivan Maidanski [Wed, 27 Dec 2017 08:09:48 +0000 (11:09 +0300)]
Fix error code in abort message if sem_wait failed in start_world (NetBSD)

* pthread_stop_world.c [GC_NETBSD_THREADS_WORKAROUND] (GC_start_world):
Print errno instead of the value returned by sem_wait if the latter has
failed; remove "code" local variable.

7 years ago[7.6.2] v7.6.2
Ivan Maidanski [Sat, 23 Dec 2017 08:01:34 +0000 (11:01 +0300)]
[7.6.2]

Bump gc version to 7.6.2

* ChangeLog (7.6.2): Set release date.
* Makefile.am (LIBGC_VER_INFO): Increment revision (change version
info of libgc.so to 4:1:2).
* README.md: Bump micro version.
* configure.ac (AC_INIT): Likewise.
* include/gc_version.h (GC_TMP_VERSION_MICRO): Likewise.

7 years agoUpdate ChangeLog file (add gc-7.4.8 release date)
Ivan Maidanski [Fri, 22 Dec 2017 21:05:41 +0000 (00:05 +0300)]
Update ChangeLog file (add gc-7.4.8 release date)

7 years agoUpdate ChangeLog file (add gc-7.2i release date)
Ivan Maidanski [Thu, 21 Dec 2017 21:40:34 +0000 (00:40 +0300)]
Update ChangeLog file (add gc-7.2i release date)

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Tue, 19 Dec 2017 21:53:44 +0000 (00:53 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Tue, 19 Dec 2017 08:10:23 +0000 (11:10 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
(Cherry-pick commit b15b52be from 'release-7_4' branch.)

7 years agoAppveyor CI: Use v7.6 of libatomic_ops
Ivan Maidanski [Sun, 17 Dec 2017 07:47:41 +0000 (10:47 +0300)]
Appveyor CI: Use v7.6 of libatomic_ops

7 years agoTravis CI: Test with ASan and GCC
Ivan Maidanski [Wed, 29 Nov 2017 08:20:04 +0000 (11:20 +0300)]
Travis CI: Test with ASan and GCC
(Cherry-pick commit 03dafe9c from 'master' branch.)

7 years agoEliminate TSan warning about A.dummy in gctest
Ivan Maidanski [Thu, 2 Nov 2017 21:58:18 +0000 (00:58 +0300)]
Eliminate TSan warning about A.dummy in gctest

* tests/test.c (reverse_test_inner): Move A.dummy=17 to
set_print_procs().
* tests/test.c (set_print_procs): Add comment.

7 years agoAvoid 'Unexpected heap growth' fail if compiled by GCC with ASan (gctest)
Ivan Maidanski [Thu, 23 Nov 2017 17:26:02 +0000 (20:26 +0300)]
Avoid 'Unexpected heap growth' fail if compiled by GCC with ASan (gctest)

* tests/test.c [ADDRESS_SANITIZER && !__clang__] (check_heap_stats):
Multiply max_heap_sz by ~1.66.

7 years agoSupport AddressSanitizer (GCC)
Ivan Maidanski [Tue, 21 Nov 2017 08:03:28 +0000 (11:03 +0300)]
Support AddressSanitizer (GCC)
(Cherry-pick commit e8e90817 from 'master' branch.)

* include/private/gcconfig.h [!__has_feature && __SANITIZE_ADDRESS__]
(ADDRESS_SANITIZER): Define.

7 years agoFix 'unknown attribute no_sanitize' compiler warnings for GCC
Ivan Maidanski [Mon, 20 Nov 2017 21:17:51 +0000 (00:17 +0300)]
Fix 'unknown attribute no_sanitize' compiler warnings for GCC
(Cherry-pick commit bba7234a from 'master' branch.)

* include/private/gc_priv.h [!GC_ATTR_NO_SANITIZE_ADDR
&& ADDRESS_SANITIZER && !AO_CLANG_PREREQ(3,8)]
(GC_ATTR_NO_SANITIZE_ADDR): Define to
__attribute__((no_sanitize_address)).
* include/private/gc_priv.h [!GC_ATTR_NO_SANITIZE_MEMORY
&& MEMORY_SANITIZER && !AO_CLANG_PREREQ(3,8)]
(GC_ATTR_NO_SANITIZE_MEMORY): Define to
__attribute__((no_sanitize_memory)).

7 years agoPlace no_sanitize address/memory attributes in a GCC-compliant way
Ivan Maidanski [Mon, 20 Nov 2017 21:10:08 +0000 (00:10 +0300)]
Place no_sanitize address/memory attributes in a GCC-compliant way
(Cherry-pick commit 2914cbff from 'master' branch.)

Now the attributes precede the function prototypes (the format is:
<attribute> void f(void) <body>).

* mark.c (GC_mark_from, GC_push_all_eager): Move
GC_ATTR_NO_SANITIZE_ADDR, GC_ATTR_NO_SANITIZE_MEMORY attributes to the
beginning of the function prototype.
* mach_dep.c (GC_with_callee_saves_pushed): Likewise.
* mark.c [WRAP_MARK_SOME && PARALLEL_MARK] (GC_push_conditional_eager):
Likewise.

7 years agoEliminate UBSan warning of overflow during descr subtraction in mark_from
Ivan Maidanski [Thu, 14 Dec 2017 21:54:04 +0000 (00:54 +0300)]
Eliminate UBSan warning of overflow during descr subtraction in mark_from

There is no unsigned overflow because descr has a negative value
actually when it is subtracted from type_descr.

* mark.c (GC_mark_from): Cast descr to signed_word
in (type_descr-(descr+...)).

7 years agoAdjust AO_HAVE_x check to match AO_fetch_and_add primitive variant used
Ivan Maidanski [Tue, 28 Nov 2017 23:57:28 +0000 (02:57 +0300)]
Adjust AO_HAVE_x check to match AO_fetch_and_add primitive variant used
(fix commit 6043293)

* tests/subthread_create.c: Replace "ifdef AO_HAVE_fetch_and_add" with
"ifdef AO_HAVE_fetch_and_add1".

7 years agoRemove 'ifdef USE_SPIN_LOCK' which is always false in gc_locks.h
Ivan Maidanski [Fri, 10 Nov 2017 15:44:57 +0000 (18:44 +0300)]
Remove 'ifdef USE_SPIN_LOCK' which is always false in gc_locks.h
(fix commit 9a20535)

* include/private/gc_locks.h [!GC_WIN32_THREADS && GC_PTHREADS
&& USE_PTHREAD_LOCKS && !GC_ASSERTIONS && NO_PTHREAD_TRYLOCK
&& USE_SPIN_LOCK] (UNCOND_LOCK): Define to
pthread_mutex_lock(&GC_allocate_ml) instead of GC_lock().

7 years agoDo not enable mprotect-based incremental mode if unmapping is on (gctest)
Ivan Maidanski [Wed, 29 Nov 2017 07:06:34 +0000 (10:06 +0300)]
Do not enable mprotect-based incremental mode if unmapping is on (gctest)
(Cherry-pick commit db26b7e4 from 'master' branch.)

Incremental mode based on mprotect() is not compatible with memory
unmapping for now.

* tests/test.c [!PCR && !GC_WIN32_THREADS && !MAKE_BACK_GRAPH
&& !NO_INCREMENTAL] (main): Do not call GC_enable_incremental() if
MPROTECT_VDB && USE_MUNMAP.

7 years agoEliminate 'value exceeds maximum object size' GCC warning in huge_test
Ivan Maidanski [Wed, 29 Nov 2017 08:44:17 +0000 (11:44 +0300)]
Eliminate 'value exceeds maximum object size' GCC warning in huge_test

* tests/huge_test.c [!GC_ATTR_ALLOC_SIZE] (GC_ATTR_ALLOC_SIZE): Define
to empty (before include gc.h).