platform/upstream/libgc.git
10 years agoFix typo in GC overview file
Ivan Maidanski [Sat, 22 Feb 2014 17:26:13 +0000 (21:26 +0400)]
Fix typo in GC overview file

* doc/overview.html: Fix a typo ("See").

10 years agoRemove redundant casts in GC_generic_or_special_malloc and similar
Ivan Maidanski [Mon, 17 Feb 2014 20:50:14 +0000 (00:50 +0400)]
Remove redundant casts in GC_generic_or_special_malloc and similar
(refactoring)

* mallocx.c (GC_generic_or_special_malloc,
GC_generic_malloc_ignore_off_page): Remove redundant casts for
"lb" argument; remove redundant parentheses.
* fnlz_mlc.c (GC_finalized_malloc): Likewise.
* malloc.c (GC_generic_malloc, GC_malloc_uncollectable): Likewise.
* malloc.c (GC_malloc_uncollectable): Remove redundant cast of
returned value.
* mallocx.c (GC_malloc_ignore_off_page,
GC_malloc_atomic_ignore_off_page): Likewise.

10 years agocord: Change no-argument functions declaration style to ANSI C
Ivan Maidanski [Sun, 16 Feb 2014 16:46:58 +0000 (20:46 +0400)]
cord: Change no-argument functions declaration style to ANSI C

* cord/cordbscs.c (CORD_init_min_len): Use ANSI C style of no-argument
function prototype.
* cord/tests/de.c (prune_map, normalize_display, fix_pos): Likewise.

10 years agoFix GC_sig_suspend initialization when non-constant SIGRTMIN used
Ivan Maidanski [Fri, 31 Jan 2014 20:32:08 +0000 (00:32 +0400)]
Fix GC_sig_suspend initialization when non-constant SIGRTMIN used

* pthread_stop_world.c (SIGNAL_UNSET): New macro.
* pthread_stop_world.c (GC_sig_suspend, GC_sig_thr_restart): Initialize
to SIGNAL_UNSET (instead of SIG_SUSPEND/THR_RESTART).
* pthread_stop_world.c (GC_get_suspend_signal): Return SIG_SUSPEND if
GC_sig_suspend is SIGNAL_UNSET.
* pthread_stop_world.c (GC_get_thr_restart_signal): Return
SIG_THR_RESTART if GC_sig_thr_restart is SIGNAL_UNSET.
* pthread_stop_world.c (GC_unblock_gc_signals): Add assertion for
initialization of GC_sig_suspend and GC_sig_thr_restart.
* pthread_stop_world.c (GC_stop_init): Replace SIGNAL_UNSET value for
GC_sig_suspend, GC_sig_thr_restart to SIG_SUSPEND and SIG_THR_RESTART,
respectively.

10 years agoFix 'e.g.' typos in comments and documentation
Ivan Maidanski [Fri, 31 Jan 2014 17:04:28 +0000 (21:04 +0400)]
Fix 'e.g.' typos in comments and documentation

* doc/README.cmake: Fix typo (e.g.).
* doc/README.solaris2: Likewise.
* doc/README.solaris2: Likewise.
* doc/README.win32: Likewise.
* include/gc.h (GC_register_my_thread): Fix typo in a comment (e.g.).
* include/leak_detector.h: Likewise.
* misc.c (GC_VSNPRINTF): Likewise.
* pthread_stop_world.c (GC_unblock_gc_signals): Likewise.

10 years agoImprove documentation for disappearing links in gc.h
Ivan Maidanski [Fri, 31 Jan 2014 16:01:06 +0000 (20:01 +0400)]
Improve documentation for disappearing links in gc.h

* include/gc.h (GC_free): Add comment about disappearing links.
* include/gc.h (GC_general_register_disappearing_link): Add comment
about the conditions for a link to disappear.

10 years agoAdd config option to use STGRTMIN-based signals for thread suspend/resume
David Grove [Wed, 8 Jan 2014 23:18:16 +0000 (18:18 -0500)]
Add config option to use STGRTMIN-based signals for thread suspend/resume

Change motivated by using BDWGC in the X10 runtime on systems where
IBM Parallel Environment is used to launch the X10 processes. PE
is already using the signals BDWCG is using for its own purposes, so
we need to force the GC to use different ones to avoid a conflict.

* configure.ac (sigrt-signals): Handle new option.
* configure.ac (GC_USESIGRT_SIGNALS): New AC define.
* include/private/gc_priv.h (SIG_SUSPEND): Force to be defined to
_SIGRTMIN+6 if GC_USESIGRT_SIGNALS (Darwin is excluded anyway).
* pthread_stop_world.c (SIG_THR_RESTART): Force to be defined to
_SIGRTMIN+5 if GC_USESIGRT_SIGNALS; reformat code.

10 years agoFix find stackbottom on BlueGene P/Q systems
David Grove [Wed, 8 Jan 2014 22:54:28 +0000 (17:54 -0500)]
Fix find stackbottom on BlueGene P/Q systems
(Use HEURISTIC2 instead of LINUX_STACKBOTTOM)

* include/private/gcconfig.h (NO_PTHREAD_GETATTR_NP, HEURISTIC2): Define
for BlueGene systems (instead of LINUX_STACKBOTTOM).

10 years agoCheck for Fujitsu compiler in builtin_unwind logic (enable FX10/K-Computer)
David Grove [Wed, 8 Jan 2014 23:07:41 +0000 (18:07 -0500)]
Check for Fujitsu compiler in builtin_unwind logic (enable FX10/K-Computer)
(Patch originally contributed to X10 project by Kamada-san.)

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

10 years agoUpdate AUTHORS file
Ivan Maidanski [Sat, 11 Jan 2014 13:57:06 +0000 (17:57 +0400)]
Update AUTHORS file

10 years agoAllow parallel mark to be enabled on powerpc-linux systems
David Grove [Wed, 8 Jan 2014 23:01:28 +0000 (18:01 -0500)]
Allow parallel mark to be enabled on powerpc-linux systems
(Tested using X10 on both BlueGene/Q and Power7/Linux platforms.)

* configure.ac (GC_LINUX_THREADS, PARALLEL_MARK, THREAD_LOCAL_ALLOC):
Define for powerpc*-*-linux* target.

10 years agoFix data roots registration for Android/x86 and NDK ARM 'gold' linker
Ivan Maidanski [Thu, 26 Dec 2013 21:41:05 +0000 (01:41 +0400)]
Fix data roots registration for Android/x86 and NDK ARM 'gold' linker

* include/gc.h (_etext, __dso_handle): Declare weak symbol (only if
Android).
* os_dep.c (_etext, __dso_handle): Likewise.
* include/gc.h (GC_INIT_CONF_ROOTS): If __data_start is incorrect
(less than _etext or missing but __dso_handle (which is typically
located at data section start) is greater than _etext as observed for
code produced by "gold" linker of Android NDK r9b) then use
__dso_handle as the lowest bound of registered data root instead of
__data_start (only if Android); update comment.
* os_dep.c (GC_init_linux_data_start): Likewise.
* os_dep.c (__data_start, data_start): Reformat code.

10 years agoFix mark stack excessive growth during parallel mark
Andrew Horton [Sat, 21 Dec 2013 13:06:36 +0000 (13:06 +0000)]
Fix mark stack excessive growth during parallel mark
(The growth observed in applications that implement things like weak
hash tables and iterate over the members marking entries using the
supplied GC_MARK_AND_PUSH macro.)

When overflow is signaled, only set GC_mark_stack_too_small if we
are using the global mark stack.  In parallel mode, local mark stack
is used, so the global mark stack is grown by GC_return_mark_stack
mainly.

* mark.c (GC_signal_mark_stack_overflow): Do not set
GC_mark_stack_too_small if GC_parallel.

10 years agoAdd API function to set/modify GC log file descriptor (Unix)
Ivan Maidanski [Sun, 22 Dec 2013 16:42:50 +0000 (20:42 +0400)]
Add API function to set/modify GC log file descriptor (Unix)

* include/gc.h (GC_set_log_fd): New API function declaration.
* misc.c (GC_set_log_fd): New function definition (except for OS/2,
MacOS, Win32/CE and Android).

10 years agoUpdate AUTHORS file
Ivan Maidanski [Sun, 22 Dec 2013 08:58:02 +0000 (12:58 +0400)]
Update AUTHORS file

10 years agoMerge pull request #30 from Hoops/loop-in-GC_alloc_large
Ivan Maidanski [Sun, 22 Dec 2013 08:54:41 +0000 (00:54 -0800)]
Merge pull request #30 from Hoops/loop-in-GC_alloc_large

Loop in GC_alloc_large

10 years agoGroup all compact fields of GC_arrays to fit in single page
Ivan Maidanski [Sun, 22 Dec 2013 08:27:20 +0000 (12:27 +0400)]
Group all compact fields of GC_arrays to fit in single page

* include/private/gc_priv.h (struct hblkhdr): Reorder hb_inv_sz field
to reduce alignment gaps on 64-bit targets.
* include/private/gc_priv.h (struct _GC_arrays): Reorder
_composite_in_use, _atomic_in_use, _unmapped_bytes, _all_nils,
_trace_addr, _modws_valid_offsets, _root_index, _last_stack fields
so that to have all compact (small-sized) fields in one memory page.

10 years agoFix LARGE_BLOCK value used for hb_flags
Ivan Maidanski [Sat, 21 Dec 2013 19:09:00 +0000 (23:09 +0400)]
Fix LARGE_BLOCK value used for hb_flags
(fix commit a49b495)

* include/private/gc_priv.h (LARGE_BLOCK): Redefine to 0x20 (to avoid
collision with MARK_UNCONDITIONALLY defined in case of ENABLE_DISCLAIM).

10 years agoRemove hb_large_block field (use 1 extra bit of hb_flags instead)
Ivan Maidanski [Sat, 21 Dec 2013 17:16:56 +0000 (21:16 +0400)]
Remove hb_large_block field (use 1 extra bit of hb_flags instead)

* allchblk.c (setup_header): Use (hb_flags & LARGE_BLOCK) != 0
instead of hb_large_block.
* private/gc_pmark.h (PUSH_CONTENTS_HDR): Likewise.
* mallocx.c (GC_realloc): Likewise.
* include/private/gc_priv.h (struct hblkhdr): Remove hb_large_block;
define LARGE_BLOCK to access corresponding bit in hb_flags (only if
MARK_BIT_PER_GRANULE).

10 years agoRemove extra trailing backslash in GC_collect_or_expand
Ivan Maidanski [Wed, 18 Dec 2013 22:41:27 +0000 (02:41 +0400)]
Remove extra trailing backslash in GC_collect_or_expand
(adjust code formatting)

* alloc.c (GC_collect_or_expand): Remove unnecessary trailing
backslash (in multi-line expression).

10 years agoFix 'attribute declaration must precede definition' warning (clang-3.1)
Ivan Maidanski [Wed, 18 Dec 2013 19:33:50 +0000 (23:33 +0400)]
Fix 'attribute declaration must precede definition' warning (clang-3.1)

* extra/gc.c: Include gc_inline.h explicitly before including mallocx.c
(to workaround "attribute declaration must precede definition" warning
reported by clang-3.1 for GC_generic_malloc_many); define
GC_PTHREAD_REDIRECTS_ONLY before including gc_pthread_redirects.h.
* include/gc_pthread_redirects.h (GC_dlopen, GC_pthread_sigmask,
GC_PTHREAD_CREATE_CONST, GC_pthread_create, GC_pthread_join,
GC_pthread_detach, GC_pthread_cancel, GC_pthread_exit): Do not declare
if GC_PTHREAD_REDIRECTS_ONLY defined (to workaround
"attribute declaration must precede definition" warning reported by
clang-3.1).

10 years agoMake heap growth more conservative after GC_gcollect_and_unmap call
Ivan Maidanski [Tue, 17 Dec 2013 06:02:05 +0000 (10:02 +0400)]
Make heap growth more conservative after GC_gcollect_and_unmap call
(Consider heap size growth since latest GC_gcollect_and_unmap
invocation instead of absolute heap size value when computing amount
of extra memory blocks to add to heap in GC_collect_or_expand.)

* alloc.c (GC_heapsize_at_forced_unmap): New static variable.
* alloc.c (GC_gcollect_and_unmap): Store current heap size to
GC_heapsize_at_forced_unmap; add comment.
* alloc.c (GC_collect_or_expand): Change blocks_to_get computation
considering heap size growth since latest GC_heapsize_at_forced_unmap
call (instead of the absolute heap size value); do not call
GC_expand_hp_inner twice with same argument.
* include/private/gc_priv.h (_GC_arrays._heapsize): Refine comment.

10 years agoFix typo in GC_collect_or_expand comment
Ivan Maidanski [Tue, 17 Dec 2013 05:37:20 +0000 (09:37 +0400)]
Fix typo in GC_collect_or_expand comment

* alloc.c (GC_collect_or_expand): Fix a typo in comment ("setting").

10 years agoEliminate redundant *flh check for null in GC_allocobj
Ivan Maidanski [Sun, 15 Dec 2013 17:03:17 +0000 (21:03 +0400)]
Eliminate redundant *flh check for null in GC_allocobj
(code refactoring)

* alloc.c (GC_allocobj): Do not check *flh twice if the value
is non-NULL (GC_new_hblk is not called thus *flh stays non-NULL in
that case).

10 years agoFix ok_init assignment (missing cast) in GC_new_kind_inner
Ivan Maidanski [Sun, 15 Dec 2013 16:54:12 +0000 (20:54 +0400)]
Fix ok_init assignment (missing cast) in GC_new_kind_inner

* misc.c (GC_new_kind_inner): Add cast from int to GC_bool for ok_init.

10 years agoRemove 'opp' local variable in GC_malloc_X
Ivan Maidanski [Sun, 15 Dec 2013 16:36:45 +0000 (20:36 +0400)]
Remove 'opp' local variable in GC_malloc_X
(code refactoring)

* alloc.c: Update comment (about free lists).
* fnlz_mlc.c (GC_finalized_malloc): Remove "opp" local variable
(replace *opp with <kind>freelist[lg]).
* gcj_mlc.c (GC_gcj_malloc, GC_gcj_malloc_ignore_off_page): Likewise.
* malloc.c (GC_malloc_atomic, GC_malloc, GC_malloc_uncollectable):
Likewise.
* mallocx.c (GC_malloc_atomic_uncollectable): Likewise.
* typd_mlc.c (GC_malloc_explicitly_typed,
GC_malloc_explicitly_typed_ignore_off_page,
GC_calloc_explicitly_typed): Likewise.

10 years agoBump GC_collect_at_heapsize in GC_add_to_heap. In the normal case it is
Andrew Horton [Sun, 15 Dec 2013 15:55:04 +0000 (15:55 +0000)]
Bump GC_collect_at_heapsize in GC_add_to_heap. In the normal case it is
recalculated straight after. But in the case where it's called directly
from alloc_mark_stack, it isn't. If the mark stack gets very large,
this can cause GC_should_collect to always return true, and
GC_alloc_large to get stuck in a loop calling GC_collect_or_expand.

10 years agoRemove non-existing DISCARD_WORDS from GC data structure ASCII diagram
Ivan Maidanski [Mon, 9 Dec 2013 04:44:05 +0000 (08:44 +0400)]
Remove non-existing DISCARD_WORDS from GC data structure ASCII diagram

* doc/tree.html (picture): Remove DISCARD_WORDS (since always zero
and already removed from the code in gc-6.0alpha6).

10 years agoRemove barrett_diagram file duplicated by tree.html
Ivan Maidanski [Mon, 9 Dec 2013 04:08:05 +0000 (08:08 +0400)]
Remove barrett_diagram file duplicated by tree.html

* Makefile.direct (DOC_FILES): Remove doc/barrett_diagram entry.
* Makefile.dj (OTHER_FILES): Likewise.
* doc/doc.am (dist_pkgdata_DATA): Likewise.
* doc/barrett_diagram: Remove file (as the content is duplicated in
doc/tree.html).

10 years agoUpdate AUTHORS file
Ivan Maidanski [Sun, 8 Dec 2013 08:38:22 +0000 (12:38 +0400)]
Update AUTHORS file

10 years agoFix CMakeLists.txt: do not override CMAKE_OSX_ARCHITECTURES
Yusuke Suzuki [Mon, 2 Dec 2013 03:50:52 +0000 (12:50 +0900)]
Fix CMakeLists.txt: do not override CMAKE_OSX_ARCHITECTURES

* CMakeLists.txt: Since latest OSX compiler (clang) provided by Xcode is
not accept "-arch ppc"; So if CMAKE_OSX_ARCHITECTURES is defined by
client, CMakeLists.txt should not force "ppc;i386;x86_64".

10 years agoFix ADD_DEFINITION in CMakeLists.txt for kFreeBSD
Yusuke Suzuki [Mon, 2 Dec 2013 03:38:45 +0000 (12:38 +0900)]
Fix ADD_DEFINITION in CMakeLists.txt for kFreeBSD

* CMakeLists.txt: Fix broken ADD_DEFINITION for kFreeBSD.

10 years agoNew macro (GC_ALWAYS_MULTITHREADED) to set multi-threaded mode implicitly
Ivan Maidanski [Sun, 1 Dec 2013 15:01:46 +0000 (19:01 +0400)]
New macro (GC_ALWAYS_MULTITHREADED) to set multi-threaded mode implicitly

* darwin_stop_world.c (GC_use_threads_discovery): Skip assertion on
GC_need_to_lock if GC_ALWAYS_MULTITHREADED.
* misc.c (GC_init): Likewise.
* doc/README.macros (GC_ALWAYS_MULTITHREADED): Document.
* include/gc.h (GC_allow_register_threads): Update comment (regarding
GC_ALWAYS_MULTITHREADED).
* include/private/gc_locks.h (I_HOLD_LOCK): Reformat code.
* include/private/gc_locks.h (GC_need_to_lock): Define as macro
(to TRUE) if GC_ALWAYS_MULTITHREADED defined.
* include/private/gc_locks.h (LOCK, UNLOCK): Define to UNCOND_[UN]LOCK
if GC_ALWAYS_MULTITHREADED.
* misc.c (GC_init): Call GC_init_parallel() if GC_ALWAYS_MULTITHREADED
but not GC_NO_THREADS_DISCOVERY (only for Win32, needed since
GC_allow_register_threads does nothing if GC_ALWAYS_MULTITHREADED).
* misc.c (IF_NEED_TO_LOCK): Ignore GC_parallel if
GC_ALWAYS_MULTITHREADED (since GC_need_to_lock is always true).
* pthread_support.c (GC_need_to_lock): Do not define varaible if
GC_ALWAYS_MULTITHREADED (since defined as a macro).
* win32_threads.c (GC_need_to_lock): Likewise.
* pthread_support.c (GC_allow_register_threads, pthread_create): Do
not alter value of GC_need_to_lock if GC_ALWAYS_MULTITHREADED.
* win32_threads.c (GC_allow_register_threads, GC_CreateThread,
GC_beginthreadex, GC_pthread_create, GC_init_parallel): Likewise.
* win32_threads.c (GC_allow_register_threads): Do not alter
"parallel_initialized" value if GC_ALWAYS_MULTITHREADED (so that
GC_allow_register_threads is a no-op if the macro defined).

10 years agoFix 'Bad signal in suspend_handler' abort on FreeBSD-9.2
Ivan Maidanski [Sat, 23 Nov 2013 20:16:38 +0000 (00:16 +0400)]
Fix 'Bad signal in suspend_handler' abort on FreeBSD-9.2

* pthread_stop_world.c (GC_suspend_handler_inner): If signal number
is zero then silently return (instead of ABORT) if FREEBSD (to
workaround a bug in FreeBSD 9.2-RELEASE regarding signals processing,
bug is observed only if THREAD_LOCAL_ALLOC defined).

10 years agoAllow to force GC_dump_regularly set on at compilation
Ivan Maidanski [Thu, 21 Nov 2013 22:37:37 +0000 (02:37 +0400)]
Allow to force GC_dump_regularly set on at compilation

* doc/README.macros (GC_DUMP_REGULARLY): Document.
* misc.c (GC_dump_regularly): Turn on by default if GC_DUMP_REGULARLY
macro defined (but not NO_DEBUGGING) - useful for embedded environments.
* misc.c (GC_init): Skip "GC_DUMP_REGULARLY" environments variable check
if GC_dump_regularly already set by the corresponding macro (only if not
NO_DEBUGGING).

10 years agoFix ABORT message in GC_restart_handler
Ivan Maidanski [Thu, 21 Nov 2013 22:12:25 +0000 (02:12 +0400)]
Fix ABORT message in GC_restart_handler

* pthread_stop_world.c (GC_restart_handler): Fix ABORT message.

10 years agoBump libgc version
Ivan Maidanski [Thu, 21 Nov 2013 21:25:58 +0000 (01:25 +0400)]
Bump libgc version

* README.md: Bump version to 7.5.0.
* configure.ac: Likewise.
* include/gc_version.h (GC_TMP_VERSION_MINOR): Likewise.

10 years agoBump version to 7.4.0; change policy regarding version numbers gc7_4_0
Ivan Maidanski [Sun, 17 Nov 2013 09:40:36 +0000 (13:40 +0400)]
Bump version to 7.4.0; change policy regarding version numbers

* ChangeLog: Update.
* README.md: Bump version.
* configure.ac (AC_INIT): Likewise.
* include/gc_version.h (GC_TMP_VERSION_MINOR): Likewise.
* alloc.c (GC_version, GC_get_version): Replace GC_TMP_ALPHA_VERSION
with GC_VERSION_MICRO.
* doc/debugging.html: Remove comment about "alpha" versions.
* doc/overview.html: Likewise.
* include/gc.h (GC_get_version): Update comment.
* include/gc_version.h (GC_NOT_ALPHA): Remove.
* include/gc_version.h (GC_TMP_ALPHA_VERSION): Replace with
GC_TMP_VERSION_MICRO; add comment about policy.
* m4/gc_set_version.m4 (GC_ALPHA_VERSION): Replace with
GC_VERSION_MICRO; update comments; adjust version format test.
* tests/test.c (GC_ALPHA_VERSION): Remove.
* tools/add_gc_prefix.c (GC_ALPHA_VERSION): Likewise.
* tools/gcname.c (GC_ALPHA_VERSION): Likewise.
* tests/test.c (CHECH_GCLIB_VERSION): Replace GC_ALPHA_VERSION with
GC_VERSION_MICRO.
* tools/add_gc_prefix.c (main): Replace "gc%d.%d[alpha%d]" print
format with "gc-%d.%d.%d" one.
* tools/gcname.c (main): Likewise.
* windows-untested/gc.ver (_BETA, GC_VERSION_MICRO): Remove.

10 years agoUpdate ChangeLog file
Ivan Maidanski [Sat, 16 Nov 2013 10:39:23 +0000 (14:39 +0400)]
Update ChangeLog file

10 years agoUpdate TODO file (add 1 item about parallel marker)
Ivan Maidanski [Sat, 16 Nov 2013 10:25:27 +0000 (14:25 +0400)]
Update TODO file (add 1 item about parallel marker)

10 years agoEnable prefetch operations by default (GCC 3.0+)
Ivan Maidanski [Sat, 16 Nov 2013 09:06:34 +0000 (13:06 +0400)]
Enable prefetch operations by default (GCC 3.0+)

* include/private/gcconfig.h (PREFETCH): Update comment; remove FIXME.
* include/private/gcconfig.h (NO_PREFETCH_FOR_WRITE): Define if
USE_I686_PREFETCH defined but not FORCE_WRITE_PREFETCH.
* include/private/gcconfig.h (PREFETCH, PREFETCH_FOR_WRITE,
CLEAR_DOUBLE): Reformat code (for IA64).
* include/private/gcconfig.h (PREFETCH, PREFETCH_FOR_WRITE): Make
default definition to GCC (v3+) built-in operation for all platforms
(instead of only for Linux/x64) unless NO_PREFETCH (or
NO_PREFETCH_FOR_WRITE, respectively) defined.

10 years agoUpdate AUTHORS file
Ivan Maidanski [Fri, 15 Nov 2013 20:22:57 +0000 (00:22 +0400)]
Update AUTHORS file

10 years agoStart of port to QNX
Kevin Tew [Thu, 29 Sep 2011 20:42:04 +0000 (14:42 -0600)]
Start of port to QNX
(Apply commit 5643815)

* include/private/gcconfig.h (I386, OS_TYPE, SA_RESTART, HEURISTIC1,
etext, DATASTART, _end, DATAEND, mach_type_known): Define for QNX.

10 years agoWorkaround 'ELF_DATA/EM_ALPHA redefined' warning in Android link.h
Ivan Maidanski [Mon, 11 Nov 2013 18:32:18 +0000 (22:32 +0400)]
Workaround 'ELF_DATA/EM_ALPHA redefined' warning in Android link.h
(revert part of commit a6e4ee9)

* dyn_load.c: Include asm/elf.h and linux/elf-em.h explicitly, and
undefine ELF_DATA and EM_ALPHA (if PLATFORM_ANDROID and
BIONIC_ELFDATA_REDEF_BUG are defined) to avoid "macro redefined"
warnings reported for link.h of Android Bionic.

10 years agoFix a typo in ChangeLog
Ivan Maidanski [Sun, 10 Nov 2013 15:44:03 +0000 (19:44 +0400)]
Fix a typo in ChangeLog

10 years agoUpdate ChangeLog file
Ivan Maidanski [Sun, 10 Nov 2013 13:31:08 +0000 (17:31 +0400)]
Update ChangeLog file

10 years agoFix dyn_load.c compilation for Android 4.3
Ivan Maidanski [Sat, 9 Nov 2013 07:56:35 +0000 (11:56 +0400)]
Fix dyn_load.c compilation for Android 4.3

* dyn_load.c (struct link_map, r_debug): Define explicitly (matching
that of Android 4.2 Bionic) instead of include linker.h (only if
PLATFORM_ANDROID); remove workaround enabled by
BIONIC_ELFDATA_REDEF_BUG regarding ELF_DATA redefinition (as linker.h
is not included); update comment.

10 years agoEliminate GCC warning about uninitialized 'hhdr' in GC_allochblk_nth
Ivan Maidanski [Sat, 9 Nov 2013 07:37:09 +0000 (11:37 +0400)]
Eliminate GCC warning about uninitialized 'hhdr' in GC_allochblk_nth

* allchblk.c (GC_allochblk_nth): Replace "for" condition with
conditional "return" since otherwise GCC reports
"'hhdr' may be used uninitialized" warning in case of -O0 optimization
level; remove comment about bogus compiler warning; refine comment
for "thishdr" local variable.

10 years agoFix race in GC_print_all_errors regarding GC_leaked
Ivan Maidanski [Mon, 16 Sep 2013 04:50:49 +0000 (08:50 +0400)]
Fix race in GC_print_all_errors regarding GC_leaked

* reclaim.c (GC_add_leaked): Remove FIXME.
* reclaim.c (GC_print_all_errors): Declare n_leaked, leaked[] local
variables initialized from GC_[n_]leaked while holding the allocation
lock (reset GC_n_leaked and GC_leaked[] as well); add GC_ASSERT for
n_leaked; use [n_]leaked while printing leaked objects count and
pointers.
* reclaim.c (GC_print_all_errors): Acquire lock to reset
printing_errors.

10 years agoAdd weak attribute to avoid __data_start undefined messages (s390x)
Neale Ferguson [Thu, 9 May 2013 19:42:58 +0000 (15:42 -0400)]
Add weak attribute to avoid __data_start undefined messages (s390x)
(Apply commit 8d3e3ac from 'mono_libgc' branch.)

* include/private/gcconfig.h (__data_start, _end): Add "weak"
attribute for Linux/s390.

Conflicts:

    include/private/gcconfig.h

10 years agoMerge (dummy) remote-tracking branch 'pcpa/master'
Ivan Maidanski [Sun, 15 Sep 2013 13:26:14 +0000 (17:26 +0400)]
Merge (dummy) remote-tracking branch 'pcpa/master'

Conflicts:
    include/gc_mark.h
    include/private/gc_priv.h
    mark.c
    os_dep.c

10 years agoAdjust 'pthread_[un]register_cancel undefined ref' workaround (Pthreads)
Ivan Maidanski [Sun, 15 Sep 2013 11:04:35 +0000 (15:04 +0400)]
Adjust 'pthread_[un]register_cancel undefined ref' workaround (Pthreads)

* misc.c (__pthread_register_cancel, __pthread_unregister_cancel):
Move prototypes to pthread_support.c.
* pthread_support.c (__pthread_unregister_cancel,
__pthread_unregister_cancel): Declare only if
PTHREAD_REGISTER_CANCEL_WEAK_STUBS defined.

10 years agoAdd weak stubs for pthread_cancel API.
Alex Rozenman [Sun, 2 Jun 2013 08:40:22 +0000 (11:40 +0300)]
Add weak stubs for pthread_cancel API.

10 years agoMerge (dummy) branch 'fnlz-requires-all-interior'
Ivan Maidanski [Sun, 15 Sep 2013 09:43:38 +0000 (13:43 +0400)]
Merge (dummy) branch 'fnlz-requires-all-interior'

10 years agoRevert "All interior pointers must be enabled for finalized allocation."
Ivan Maidanski [Sun, 15 Sep 2013 09:41:53 +0000 (13:41 +0400)]
Revert "All interior pointers must be enabled for finalized allocation."
(Ensuring all-interior-pointers mode is no longer needed.)

This reverts commit 97f113395e228567eec1f9105bccdd7d3db6c66e.

10 years agoMerge (dummy) remote-tracking branch 'paurkedal/t/thread_create_bug'
Ivan Maidanski [Sat, 14 Sep 2013 17:07:26 +0000 (21:07 +0400)]
Merge (dummy) remote-tracking branch 'paurkedal/t/thread_create_bug'

Conflicts:
    pthread_start.c
    pthread_support.c

10 years agoMerge (dummy) remote-tracking branch 'paurkedal/remove-disclaim-cd'
Ivan Maidanski [Sat, 14 Sep 2013 09:54:05 +0000 (13:54 +0400)]
Merge (dummy) remote-tracking branch 'paurkedal/remove-disclaim-cd'

Conflicts:
    include/private/gc_priv.h

10 years agoMerge (dummy) remote-tracking branch 'paurkedal/finalizer-at-end'
Ivan Maidanski [Sat, 14 Sep 2013 09:23:22 +0000 (13:23 +0400)]
Merge (dummy) remote-tracking branch 'paurkedal/finalizer-at-end'

Conflicts:
    fnlz_mlc.c
    tests/disclaim_test.c

10 years agoDetect dladdr() presence by configure
Ivan Maidanski [Sat, 14 Sep 2013 08:20:17 +0000 (12:20 +0400)]
Detect dladdr() presence by configure

* configure.ac (have_dladdr): Add check for "dladdr" presence.
* configure.ac (HAVE_DLADDR): New AC define based on have_dladdr.

10 years agoExplicitly specify that Darwin, Linux and Solaris platforms have dladdr()
Ivan Maidanski [Fri, 13 Sep 2013 19:33:32 +0000 (23:33 +0400)]
Explicitly specify that Darwin, Linux and Solaris platforms have dladdr()

* include/private/gcconfig.h (HAVE_DLADDR): Define also for DARWIN
(conditionally), LINUX and SOLARIS (conditionally).

10 years agoFix collection of objects referenced only from GC_mark_stack_X variables
Ivan Maidanski [Fri, 6 Sep 2013 19:36:39 +0000 (23:36 +0400)]
Fix collection of objects referenced only from GC_mark_stack_X variables
(Apply commit a7a5666 from 'release-7_2' branch.)

* include/private/gc_pmark.h (mse): Move to gc_priv.h (as used by
GC_mark_stack_limit, GC_mark_stack_top, GC_mark_stack).
* include/private/gc_pmark.h (GC_mark_stack_limit, GC_mark_stack_top,
GC_mark_stack): Remove variable declaration.
* include/private/gc_priv.h (_GC_arrays): Add _mark_stack,
_mark_stack_limit, _mark_stack_top fields.
* include/private/gc_priv.h (GC_mark_stack_limit, GC_mark_stack_top,
GC_mark_stack): Define macro (redirecting to the corresponding field
of GC_arrays).
* mark.c (GC_mark_stack, GC_mark_stack_limit, GC_mark_stack_top):
Remove variable; move comment to gc_priv.h.
* mark.c (GC_push_marked1, GC_push_marked2, GC_push_marked4): Undefine
GC_mark_stack_top and GC_mark_stack_limit macros (before redefining
them to local variables) at function start, redefine them back to the
corresponding field of GC_arrays at function exit.

Conflicts:

    include/private/gc_pmark.h

10 years agoMerge branch 'freebsd-ports-devel-boehm-gc-integrate'
Ivan Maidanski [Tue, 3 Sep 2013 20:32:48 +0000 (00:32 +0400)]
Merge branch 'freebsd-ports-devel-boehm-gc-integrate'

10 years ago.gitignore: Ignore *.log, *.trs files produced by 'make check' (Autoconf)
Ivan Maidanski [Mon, 2 Sep 2013 09:42:10 +0000 (13:42 +0400)]
.gitignore: Ignore *.log, *.trs files produced by 'make check' (Autoconf)

10 years agoRename subthread_create to subthreadcreate_test (Makefile)
Ivan Maidanski [Mon, 2 Sep 2013 09:11:02 +0000 (13:11 +0400)]
Rename subthread_create to subthreadcreate_test (Makefile)

* tests/tests.am (TESTS, check_PROGRAMS, subthreadcreate_SOURCES,
subthreadcreate_test_LDADD): Rename "subthread_create" to
"subthreadcreate_test" (except for .c file).
* .gitignore: Likewise.

10 years agotests: Append _test suffix to 'initsecondarythread' binary file names
Ivan Maidanski [Mon, 2 Sep 2013 08:55:47 +0000 (12:55 +0400)]
tests: Append _test suffix to 'initsecondarythread' binary file names

* tests/tests.am (TESTS, check_PROGRAMS, initsecondarythread_SOURCES,
initsecondarythread_LDADD): Rename initsecondarythread to
initsecondarythread_test (except for .c file).
* .gitignore: Likewise.

10 years agoPrevent misleading AC_MSG_ERROR/AS_IF errors reported in configure.ac
Ivan Maidanski [Sun, 1 Sep 2013 16:06:38 +0000 (20:06 +0400)]
Prevent misleading AC_MSG_ERROR/AS_IF errors reported in configure.ac

* configure.ac (PKG_CHECK_MODULES): Move AS_IF and AC_MSG_ERROR out of
ACTION-IF-NOT-FOUND argument (setting "missing_libatomic_ops" variable
instead) to prevent misleading
"possibly undefined macro: AC_MSG_ERROR, AS_IF" error reported by
Autoconf (pointing to code lines where these macros first occur) in
case of PKG_CHECK_MODULES is not defined in aclocal.m4; add comment
about missing Autotools pkg.m4 file.

10 years agoReplace deprecated [CXX]INCLUDES to AM_C[PP]FLAGS in configure.ac
Ivan Maidanski [Sun, 1 Sep 2013 10:00:08 +0000 (14:00 +0400)]
Replace deprecated [CXX]INCLUDES to AM_C[PP]FLAGS in configure.ac

* configure.ac (INCLUDES): Replace with AM_CFLAGS (as the former is
deprecated in Automake 1.13.4).
* configure.ac (CXXINCLUDES): Replace with AM_CPPFLAGS.

10 years agoRemove configure.ac outdated revision number
Ivan Maidanski [Sun, 1 Sep 2013 08:53:25 +0000 (12:53 +0400)]
Remove configure.ac outdated revision number

* configure.ac (AC_REVISION): Remove item (outdated).

10 years agoSpecify LT_INIT in configure.ac
Ivan Maidanski [Sun, 1 Sep 2013 07:28:51 +0000 (11:28 +0400)]
Specify LT_INIT in configure.ac

* configure.ac (LT_INIT): Specify (otherwise Automake 1.13.4 reports
error at "check_LTLIBRARIES" item in Makefile.am); add comment about
"LIBTOOL is undefined" error.

10 years ago.gitignore: Ignore test-driver (generated by autoreconf)
Ivan Maidanski [Sat, 31 Aug 2013 14:42:24 +0000 (18:42 +0400)]
.gitignore: Ignore test-driver (generated by autoreconf)

10 years agoRemove changes in Makefile.in and doc/gc.man specific to FreeBSD ports
Ivan Maidanski [Sun, 25 Aug 2013 08:37:19 +0000 (12:37 +0400)]
Remove changes in Makefile.in and doc/gc.man specific to FreeBSD ports
(Revert part of commit 8666ba2 from 'freebsd-ports-devel-boehm-gc' branch.)
(Apply commit 8f8d395 from 'release-7_2' branch.)

* doc/gc.man: Remove "PORT INFORMATION".

Conflicts:

    Makefile.in

10 years agoUse __builtin_extract_return_addr in GC_RETURN_ADDR_PARENT (gcc/x86)
Ivan Maidanski [Sun, 25 Aug 2013 05:59:42 +0000 (09:59 +0400)]
Use __builtin_extract_return_addr in GC_RETURN_ADDR_PARENT (gcc/x86)

* include/gc_config_macros.h (GC_RETURN_ADDR_PARENT): Use
__builtin_extract_return_addr (since the address passed to dladdr);
do not define the macro for GCC pre-v4.

10 years agoPrevent use of unsupported __builtin_return_address(1) in GC_DBG_EXTRAS
Ivan Maidanski [Sat, 24 Aug 2013 16:32:11 +0000 (20:32 +0400)]
Prevent use of unsupported __builtin_return_address(1) in GC_DBG_EXTRAS

* include/gc_config_macros.h (GC_CAN_SAVE_CALL_STACKS): Define also
for __amd64__ (synonym for __x86_64__).
* include/gc_config_macros.h (GC_RETURN_ADDR_PARENT): Define only for
x86 and x86_64 (which have frame-pointer register, for other targets
GCC might report "unsupported argument to __builtin_return_address"
warning).

10 years agoDefine GC_caller_func_offset only if HAVE_DLADDR and GC_RETURN_ADDR_PARENT
Ivan Maidanski [Sat, 24 Aug 2013 14:43:29 +0000 (18:43 +0400)]
Define GC_caller_func_offset only if HAVE_DLADDR and GC_RETURN_ADDR_PARENT
(Apply commit 5d94f18 from 'release-7_2' branch.)

* dbg_mlc.c (GC_caller_func_offset): Do not define (and do not include
dlfcn.h) unless GC_ADD_CALLER; test HAVE_DLADDR (and
GC_RETURN_ADDR_PARENT) instead of FREEBSD macro.
* dbg_mlc.c (GC_caller_func_offset): Use STATIC; replace the K&R-style
function definition with the ANSI C one; remove unnecessary "const" in
type casts; do not call dladdr() if address is 0.
* dbg_mlc.c (GC_debug_malloc, GC_debug_realloc): Move assignment of
"s" argument to "unknown" to GC_caller_func_offset (if GC_ADD_CALLER).
* dbg_mlc.c (GC_debug_realloc): Do not call GC_caller_func_offset if
"p" argument is NULL (i.e., if redirected to GC_debug_malloc)..
* include/private/gcconfig.h (HAVE_DLADDR): Define for FREEBSD.

Conflicts:

    dbg_mlc.c

10 years agoReplace GC_DBG_RA with GC_DBG_EXTRAS macro
Ivan Maidanski [Fri, 23 Aug 2013 19:42:26 +0000 (23:42 +0400)]
Replace GC_DBG_RA with GC_DBG_EXTRAS macro

* dbg_mlc.c (GC_debug_malloc_replacement,
GC_debug_realloc_replacement): Use GC_DBG_EXTRAS (instead of
"GC_DBG_RA NULL, 0").
* malloc.c (GC_debug_malloc_replacement): Likewise.
* mallocx.c (GC_debug_realloc_replacement): Likewise.
* include/private/gc_priv.h (GC_DBG_EXTRAS): New macro (similar to
GC_EXTRAS but pass NULL/0 instead of __FILE__and __LINE__);
pass "unknown" instead of NULL unless GC_ADD_CALLER.
* include/private/gc_priv.h (GC_DBG_RA): Remove.

10 years agoAdjust GC_debug_malloc/realloc_replacement macro to match the API function
Ivan Maidanski [Fri, 23 Aug 2013 18:51:07 +0000 (22:51 +0400)]
Adjust GC_debug_malloc/realloc_replacement macro to match the API function

* malloc.c (GC_debug_malloc_replacement): Pass NULL (instead of
"unknown") to "s" argument of GC_debug_malloc to match that
replacement definition in dbg_mlc.c.
* mallocx.c (GC_debug_realloc_replacement): Likewise.

10 years agoFix old_segv/bus_act variables initialization for FreeBSD
Ivan Maidanski [Thu, 22 Aug 2013 06:58:58 +0000 (10:58 +0400)]
Fix old_segv/bus_act variables initialization for FreeBSD

* os_dep.c (old_segv_act): Define static variable for FREEBSD (same as
for NETBSD).
* os_dep.c (GC_set_and_save_fault_handler): Reformat code (related to
FreeBSD).
* os_dep.c (GC_reset_fault_handler): Initialize old_segv_act (and
old_bus_act) for FREEBSD (same as for NETBSD).

10 years agoReformat gcconfig.h (related to FreeBSD/arm)
Ivan Maidanski [Thu, 22 Aug 2013 06:24:39 +0000 (10:24 +0400)]
Reformat gcconfig.h (related to FreeBSD/arm)

* include/private/gcconfig.h (ALIGNMENT, OS_TYPE, DYNAMIC_LOADING,
HEURISTIC2, etext, SEARCH_FOR_DATA_START): Reformat (adjust
indentation) for FreeBSD/arm.

10 years agoAdjust configure.ac to match configure regarding FreeBSD/sparc64
Ivan Maidanski [Sun, 21 Jul 2013 15:34:37 +0000 (19:34 +0400)]
Adjust configure.ac to match configure regarding FreeBSD/sparc64
(Apply commit 41a99fb from 'release-7_2' branch.)

* configure.ac (Configuration of machine-dependent code): Handle
sparc64-*-freebsd* case.

10 years agoFix GC_caller_func_offset and GC_DBG_RA names
Ivan Maidanski [Sun, 21 Jul 2013 14:27:07 +0000 (18:27 +0400)]
Fix GC_caller_func_offset and GC_DBG_RA names
(Apply commit 28e6e4f from 'release-7_2' branch.)

* dbg_mlc.c (GC_caller_func_offset): Test FREEBSD macro instead of
__FreeBSD__ (since the former is always defined in gcconfig.h included
from this file indirectly).
* dyn_load.c (ElfW): Likewise.
* dbg_mlc.c (GC_caller_func): Fix name to GC_caller_func_offset.
* dbg_mlc.c (GC_debug_realloc): Invoke GC_caller_func_offset if
GC_ADD_CALLER (same as in GC_debug_malloc and commit 2cdf7ec).
* include/private/gc_priv.h (RA): Fix name to GC_DBG_RA.
* include/private/gcconfig.h (X86_64): Test __x86_64__ in addition to
__amd64__ for FreeBSD (proposed in commit b54833a).

Conflicts:

    include/private/gcconfig.h

10 years agoFreeBSD New ports collection for boehm-gc v7.2d
Vitaly Magerya [Sun, 21 Jul 2013 12:53:31 +0000 (16:53 +0400)]
FreeBSD New ports collection for boehm-gc v7.2d
(Apply commit 8666ba2 from 'release-7_2' branch.)

* include/private/gc_priv.h (RA): Define to "GC_RETURN_ADDR_PARENT,"
if GC_RETURN_ADDR_PARENT defined.
* include/private/gcconfig.h (FREEBSD): Group rules.

Conflicts:

    Makefile.in
    configure
    dbg_mlc.c
    include/private/gc_priv.h
    include/private/gcconfig.h
    os_dep.c

10 years agoFreeBSD New ports collection for boehm-gc v7.1
Mike McGaughey [Sun, 21 Jul 2013 11:47:53 +0000 (15:47 +0400)]
FreeBSD New ports collection for boehm-gc v7.1
(Imported from freebsd-ports/devel/boehm-gc)
(Apply commit 2cdf7ec from 'release-7_2' branch.)

* dbg_mlc.c (GC_caller_func_offset): New function (empty unless
FreeBSD).
* dbg_mlc.c (GC_debug_malloc, GC_debug_realloc): Invoke
GC_caller_func_offset if GC_ADD_CALLER.
* include/private/gc_priv.h (GC_DBG_RA): Define to GC_RETURN_ADDR_PARENT
(if the latter is defined).
* dbg_mlc.c (GC_debug_malloc_replacement,
GC_debug_realloc_replacement): Pass NULL (instead of "unknown") to
GC_debug_malloc/realloc.
* doc/gc.man: Add "PORT INFORMATION".
* dyn_load.c (ElfW): Define for FreeBSD.
* include/private/gcconfig.h (X86_64, IA64, POWERPC, ARM32,
mach_type_known, ALIGNMENT, OS_TYPE, DYNAMIC_LOADING, HEURISTIC2,
etext, SEARCH_FOR_DATA_START): Likewise.
* os_dep.c (old_bus_act): Likewise.
* include/gc.h (GC_RETURN_ADDR_PARENT): New macro.
* os_dep.c (GC_set_and_save_fault_handler): Invoke sigaction(SIGBUS)
for FreeBSD.
* os_dep.c (AIM): Define before include machine/trap.h if FreeBSD/ppc.
* os_dep.c (CODE_OK): Define to test "code" against EXC_DSI (instead
of BUS_PAGE_FAULT) if FreeBSD/ppc.

Conflicts:

    Makefile.in
    configure
    dbg_mlc.c
    include/gc.h
    include/private/gcconfig.h
    os_dep.c

10 years agoFix GC_INLINE definition to comply with ISO C90 standard (GCC)
Ivan Maidanski [Thu, 15 Aug 2013 05:03:16 +0000 (09:03 +0400)]
Fix GC_INLINE definition to comply with ISO C90 standard (GCC)

* include/private/gc_priv.h (GC_INLINE): Define as "static __inline"
for GCC if "strict ISO/ANSI C90" mode is enforced.

10 years agoDefine GC_VSNPRINTF internal macro in misc.c (code refactoring)
Ivan Maidanski [Thu, 15 Aug 2013 04:53:11 +0000 (08:53 +0400)]
Define GC_VSNPRINTF internal macro in misc.c (code refactoring)

* misc.c (GC_VSNPRINTF): New macro (defined to vsnprintf by default
and used by GC_PRINTF_FILLBUF).

10 years agoUpdate AUTHORS file
Ivan Maidanski [Thu, 1 Aug 2013 05:36:59 +0000 (09:36 +0400)]
Update AUTHORS file

10 years agoFix more typos in comments
Ondrej Bilka [Tue, 30 Jul 2013 22:23:14 +0000 (02:23 +0400)]
Fix more typos in comments

* darwin_stop_world.c (GC_use_threads_discovery): Fix a typo in
comment ("stopped").
* doc/porting.html: Fix typos in comment ("defining", "support").
* include/gc.h (GC_get_prof_stats): Fix a typo in comment ("entries").
* include/private/gc_priv.h (GC_have_errors): Fix a typo in comment
("OK").
* include/private/gcconfig.h: Fix a typo in comment ("SPARC).
* ChangeLog: Likewise.
* os_dep.c (GC_linux_main_stack_base): Likewise.
* include/private/gcconfig.h: Fix a typo in comment ("release").
* mallocx.c (GC_generic_malloc_many): Fix a typo in comment
("reacquiring").
* mallocx.c (GC_memalign): Fix a typo in comment ("OK").
* os_dep.c (GC_win32_free_heap): Likewise.
* pthread_support.c (GC_remove_all_threads_but_me): Likewise.
* win32_threads.c (GC_remove_all_threads_but_me): Likewise.
* doc/README.Mac: Likewise.
* mark.c (GC_push_unconditionally): Fix a typo in comment ("pointers").
* pthread_support.c: Fix a typo in comment ("which").
* win32_threads.c: Fix a typo in comment ("losing").

10 years agoUpdate AUTHORS file
Ivan Maidanski [Sun, 21 Jul 2013 15:39:37 +0000 (19:39 +0400)]
Update AUTHORS file

10 years agoFix 'stack section' pointer passed to push_all_stack_sections (Pthreads)
Ivan Maidanski [Sat, 20 Jul 2013 13:01:01 +0000 (17:01 +0400)]
Fix 'stack section' pointer passed to push_all_stack_sections (Pthreads)

* pthread_stop_world.c (GC_push_all_stacks): Use
traced_stack_sect->prev instead of traced_stack_sect if saved_stack_ptr
(of traced_stack_sect) is the same as stop_info.stack_ptr of the
examined thread (thus preventing assertion violation in
GC_push_all_stack_sections invoked during incremental collection).

11 years agoFix stackbottom/stack_end assignment in GC_call_with_gc_active
Ivan Maidanski [Sat, 20 Jul 2013 11:21:37 +0000 (15:21 +0400)]
Fix stackbottom/stack_end assignment in GC_call_with_gc_active

* misc.c (GC_call_with_gc_active): Add GC_noop1 call between "fn" call
and "return" statement to discourage the compiler from treating the
function call as a tail one (thus ensuring "stackbottom" COOLER_THAN
any stack pointer value obtained inside "fn").
* pthread_support.c (GC_call_with_gc_active): Likewise.
* win32_threads.c (GC_call_with_gc_active): Likewise.

11 years agoTODO file: Add pending TODO/FIXME items
Ivan Maidanski [Sat, 20 Jul 2013 10:57:58 +0000 (14:57 +0400)]
TODO file: Add pending TODO/FIXME items

11 years agoFix assertion violation in GC_mark_from prefetch loop
Ivan Maidanski [Wed, 17 Jul 2013 06:07:19 +0000 (10:07 +0400)]
Fix assertion violation in GC_mark_from prefetch loop

* mark.c (GC_mark_from): If "descr" is less than size of word then
skip prefetching and PUSH_CONTENTS of the current entry (thus,
eliminate assertion violation in the prefetch loop) if SMALL_CONFIG is
not defined.

11 years agoEliminate GC_first_nonempty atomic value reload in GC_mark_local assertion
Ivan Maidanski [Tue, 16 Jul 2013 14:54:54 +0000 (18:54 +0400)]
Eliminate GC_first_nonempty atomic value reload in GC_mark_local assertion

* mark.c (GC_mark_from, GC_mark_local, GC_do_parallel_mark): Reformat
code partially.
* mark.c (GC_mark_local): Use "my_first_nonempty" in assertion
instead of reloading value of GC_first_nonempty twice.

11 years agoFix typo in comment of GC_mark_from
Ivan Maidanski [Tue, 16 Jul 2013 12:58:28 +0000 (16:58 +0400)]
Fix typo in comment of GC_mark_from

* mark.c (GC_mark_from): Fix typo (capitalization) in comment ("ASAP").

11 years agoAllow to compile GC_inner_start_routine aside from extra/gc.c
Ivan Maidanski [Tue, 16 Jul 2013 12:19:12 +0000 (16:19 +0400)]
Allow to compile GC_inner_start_routine aside from extra/gc.c
(for proper exceptions support on Linux)

* extra/gc.c: Do not include pthread_start.c if
GC_PTHREAD_START_STANDALONE defined (thus pthread_start.c could go to
a standalone compilation unit).
* include/private/pthread_support.h (GC_INNER_PTHRSTART): New macro
(defined to either empty or GC_INNER depending on
GC_PTHREAD_START_STANDALONE).
* include/private/pthread_support.h (GC_start_rtn_prepare_thread,
GC_thread_exit_proc): Replace GC_INNER to GC_INNER_PTHRSTART.
* pthread_support.c (GC_thread_exit_proc,
GC_start_rtn_prepare_thread): Likewise.
* pthread_start.c (GC_inner_start_routine): Define as
GC_INNER_PTHRSTART; do not call GC_log_printf if
GC_PTHREAD_START_STANDALONE (since the function might be visible only
within extra/gc.c compilation unit).
* pthread_support.c (GC_inner_start_routine): Declare as
GC_INNER_PTHRSTART.

11 years agoTest NO_WRAP_MARK_SOME macro to suppress WRAP_MARK_SOME-specific code
Ivan Maidanski [Mon, 15 Jul 2013 14:08:01 +0000 (18:08 +0400)]
Test NO_WRAP_MARK_SOME macro to suppress WRAP_MARK_SOME-specific code

* mark.c (WRAP_MARK_SOME): Do not define if NO_WRAP_MARK_SOME defined.

11 years agoDefine [UN]SET_LOCK_HOLDER and I_[DONT_]HOLD_LOCK macros only if used
Ivan Maidanski [Mon, 15 Jul 2013 13:34:54 +0000 (17:34 +0400)]
Define [UN]SET_LOCK_HOLDER and I_[DONT_]HOLD_LOCK macros only if used
(code refactoring)

* include/private/gc_locks.h (SET_LOCK_HOLDER, UNSET_LOCK_HOLDER,
I_HOLD_LOCK, I_DONT_HOLD_LOCK): Do not define unless GC_ASSERTIONS.
* include/private/gc_locks.h (SET_LOCK_HOLDER, UNSET_LOCK_HOLDER):
Do not define unless THREADS.

11 years agoDo not set GC_lock_holder by call_with_alloc_lock if assertions disabled
Ivan Maidanski [Mon, 15 Jul 2013 13:18:12 +0000 (17:18 +0400)]
Do not set GC_lock_holder by call_with_alloc_lock if assertions disabled

* include/private/gc_locks.h (GC_lock_holder): Do not declare unless
GC_ASSERTIONS (the variable is not longer used to prevent recursive
reentry in the system call wrapper).
* misc.c (GC_call_with_alloc_lock): Remove [UN]SET_LOCK_HOLDER
explicit calls since GC_lock_holder is set properly by [UN]LOCK()
(in case of GC_ASSERTIONS).
* pthread_support.c (GC_lock_holder): Do not define unless
GC_ASSERTIONS; adjust comment.
* win32_threads.c (GC_lock_holder): Likewise.

11 years agoDefine SET/UNSET_MARK_LOCK_HOLDER macros to set/check GC_acquire_mark_lock
Ivan Maidanski [Mon, 15 Jul 2013 12:45:52 +0000 (16:45 +0400)]
Define SET/UNSET_MARK_LOCK_HOLDER macros to set/check GC_acquire_mark_lock
(refactoring)

* pthread_support.c (SET_MARK_LOCK_HOLDER, UNSET_MARK_LOCK_HOLDER):
New macro (defined to no action unless GC_ASSERTIONS).
* win32_threads.c (SET_MARK_LOCK_HOLDER, UNSET_MARK_LOCK_HOLDER):
Likewise.
* pthread_support.c (GC_acquire_mark_lock, GC_release_mark_lock,
GC_wait_builder, GC_wait_marker): Use [UN]SET_MARK_LOCK_HOLDER
(instead of GC_mark_lock_holder setters and checkers).
* win32_threads.c (GC_acquire_mark_lock, GC_release_mark_lock,
GC_wait_builder, GC_wait_marker): Likewise.
* win32_threads.c (GC_mark_lock_holder): Change type to DWORD unless
GC_PTHREADS_PARAMARK defined.
* win32_threads.c (GC_acquire_mark_lock, GC_notify_all_builder):
Remove unnecessary cast of GetCurrentThreadId() result.

11 years agoAdd double-lock assertion to GC_acquire_mark_lock
Ivan Maidanski [Mon, 15 Jul 2013 12:02:36 +0000 (16:02 +0400)]
Add double-lock assertion to GC_acquire_mark_lock

* pthread_support.c (GC_acquire_mark_lock): Add assertion that
GC_mark_lock_holder is not set to the current thread on the function
entry (i.e., assertion against double lock).
* win32_threads.c (GC_acquire_mark_lock): Likewise.

11 years agoMark GC_started_thread_while_stopped() as GC_INNER
Ivan Maidanski [Mon, 15 Jul 2013 11:48:44 +0000 (15:48 +0400)]
Mark GC_started_thread_while_stopped() as GC_INNER

* mark.c (GC_started_thread_while_stopped): Declare as GC_INNER
(declared only if GC_WIN32_THREADS).
* win32_threads.c (GC_started_thread_while_stopped): Define as GC_INNER.