platform/upstream/libgc.git
12 years agoUpdate ChangeLog
Ivan Maidanski [Tue, 21 Feb 2012 18:06:11 +0000 (22:06 +0400)]
Update ChangeLog

12 years agoFix Win32 GC_unregister_my_thread to ensure no ongoing incremental GC
Ivan Maidanski [Tue, 21 Feb 2012 17:12:47 +0000 (21:12 +0400)]
Fix Win32 GC_unregister_my_thread to ensure no ongoing incremental GC

* win32_threads.c (GC_wait_for_gc_completion): Add function (similar
implementation as in pthread_support.c).
* win32_threads.c (GC_unregister_my_thread, GC_thread_exit_proc):
Call GC_wait_for_gc_completion to prevent collecting from unregistered
thread; remove FIXME.

12 years agoFix gctest to include unistd.h if HANDLE_FORK
Ivan Maidanski [Tue, 21 Feb 2012 16:43:35 +0000 (20:43 +0400)]
Fix gctest to include unistd.h if HANDLE_FORK

* tests/test.c: Include unistd.h for fork() declaration if HANDLE_FORK
(and THREADS).

12 years agoMinor code adjustment (delete meaningless parentheses in abort messages)
Ivan Maidanski [Mon, 20 Feb 2012 18:09:17 +0000 (22:09 +0400)]
Minor code adjustment (delete meaningless parentheses in abort messages)

* os_dep.c (GC_setpagesize): Remove meaningless parentheses in abort
message.
* pthread_stop_world.c (GC_remove_allowed_signals, GC_stop_init):
Likewise.
* win32_threads.c (start_mark_threads, GC_acquire_mark_lock,
GC_release_mark_lock, GC_wait_for_reclaim, GC_notify_all_builder,
GC_wait_marker, GC_notify_all_marker, GC_thr_init): Likewise.

12 years agoCheck pthread_atfork result (POSIX threads)
Ivan Maidanski [Mon, 20 Feb 2012 17:58:21 +0000 (21:58 +0400)]
Check pthread_atfork result (POSIX threads)

* pthread_support.c (GC_thr_init): Abort on pthread_atfork failure
(only if HANDLE_FORK).

12 years agoFix gcconfig to turn on POSIX fork() support by default
Andy Wingo [Mon, 20 Feb 2012 17:51:21 +0000 (21:51 +0400)]
Fix gcconfig to turn on POSIX fork() support by default
(define HANDLE_FORK on Unix platforms with pthreads)

* doc/README.macros (HANDLE_FORK): Replace with NO_HANDLE_FORK; update
the documentation.
* include/private/gcconfig.h (HANDLE_FORK): Explicitly define if
GC_PTHREADS unless already defined or NO_HANDLE_FORK is defined, or
unsupported on the target.

12 years agoSimplify autogen.sh by using autoreconf
Ivan Maidanski [Mon, 20 Feb 2012 04:44:03 +0000 (08:44 +0400)]
Simplify autogen.sh by using autoreconf

12 years agoconfigure: Require automake 2.63 (widely spread) instead of 2.64
Ivan Maidanski [Mon, 20 Feb 2012 04:36:50 +0000 (08:36 +0400)]
configure: Require automake 2.63 (widely spread) instead of 2.64

* configure.ac (AC_PREREQ): Use value of 2.63 (instead of 2.64).

12 years agoUpdate ChangeLog
Ivan Maidanski [Thu, 16 Feb 2012 21:30:46 +0000 (01:30 +0400)]
Update ChangeLog

12 years agoAllow GC_exclude_static_roots() region start to be unaligned
Ivan Maidanski [Thu, 16 Feb 2012 19:17:23 +0000 (23:17 +0400)]
Allow GC_exclude_static_roots() region start to be unaligned
(let the client not to care about the alignment of excluded memory area)

* include/gc.h (GC_exclude_static_roots): Update the comment.
* mark_rts.c (GC_exclude_static_roots): Allow the lower boundary to be
unaligned as well; reverse boundary rounding direction (since the
boundaries specify exclusion region); update the comment.

12 years agoFix GC_push_all/selected boundaries check
Ivan Maidanski [Thu, 16 Feb 2012 18:47:28 +0000 (22:47 +0400)]
Fix GC_push_all/selected boundaries check

* mark.c (GC_push_all, GC_push_selected): Properly check for empty
region after boundaries alignment (for the case when boundaries
unaligned and the region is short than one word); simplify the checked
condition.

12 years agoAdd 'GC_' prefix to dl_head and fo_head (code refactoring)
Ivan Maidanski [Thu, 16 Feb 2012 18:40:11 +0000 (22:40 +0400)]
Add 'GC_' prefix to dl_head and fo_head (code refactoring)

* finalize.c (HASH2): Enclose argument in parentheses.
* finalize.c (dl_set_next, fo_set_next): Enclose the whole expression
in parentheses.
* finalize.c (dl_head, fo_head): Add GC_ prefix; use STATIC instead of
"static" (to make the symbols globally visible during debugging).
* finalize.c (log_dl_table_size, GC_finalize): Reformat the comment.
* finalize.c (GC_push_finalizer_structures,
GC_general_register_disappearing_link,
GC_unregister_disappearing_link, GC_move_disappearing_link,
GC_dump_finalization, GC_finalize): Rename dl_head to GC_dl_head.
* finalize.c (GC_push_finalizer_structures,
GC_register_finalizer_inner, GC_dump_finalization, GC_finalize,
GC_enqueue_all_finalizers); Rename fo_head to GC_fo_head.
* finalize.c (GC_general_register_disappearing_link,
GC_unregister_disappearing_link, GC_dump_finalization, GC_finalize):
Reformat code.

12 years agoFix GC_finalizer_nested size to workaround alignment problem in Watcom
Ivan Maidanski [Thu, 16 Feb 2012 18:05:31 +0000 (22:05 +0400)]
Fix GC_finalizer_nested size to workaround alignment problem in Watcom

* finalize.c (GC_finalizer_nested): Change type from char to int to
force GC symbols proper alignment for some compilers (e.g., Watcom);
add comment.
* finalize.c (GC_check_finalizer_nested): Cast GC_finalizer_nested
properly (since it holds an unsigned char value).
* os_dep.c (GC_get_maps): Remove static "init_buf" variable (of char
size) and initialize "maps_buf" to NULL since it is allocated anyway
(since maps_size is non-zero).
* os_dep.c (GC_register_data_segments): Remove static "dummy" variable
(of char size) and use GC_pages_executable instead.

12 years agoUpdate comment for GC_INNER macro
Ivan Maidanski [Thu, 16 Feb 2012 17:30:53 +0000 (21:30 +0400)]
Update comment for GC_INNER macro

* include/private/gc_priv.h (GC_INNER): Update comment.

12 years agoAdd assertion ensuring proper alignment of 'pushed' GC symbols
Ivan Maidanski [Thu, 16 Feb 2012 17:28:07 +0000 (21:28 +0400)]
Add assertion ensuring proper alignment of 'pushed' GC symbols

* finalize.c (GC_push_finalizer_structures): Assert word alignment of
dl_head, fo_head, GC_finalize_now.
* pthread_support.c (GC_thr_init): Assert word alignment of GC_threads
(passed to GC_push_all).
* win32_threads.c (GC_thr_init): Likewise.
* thread_local_alloc.c (GC_init_thread_local): Assert word alignment
of GC_thread_key.
* typd_mlc.c (GC_add_ext_descriptor): Assert word alignment of
GC_ext_descriptors.

12 years agocord: Change function declaration style from K-R to ANSI C
Ivan Maidanski [Thu, 16 Feb 2012 17:15:02 +0000 (21:15 +0400)]
cord: Change function declaration style from K-R to ANSI C

* cord/cordxtra.c (refill_cache): Replace the K&R-style function
definition with the ANSI C one.

12 years agoPrevent compiler warning in specific GC_key_create_inner
Ivan Maidanski [Wed, 15 Feb 2012 05:12:35 +0000 (09:12 +0400)]
Prevent compiler warning in specific GC_key_create_inner
(fix commit e07b66f)

* specific.c (GC_key_create_inner): Add explicit cast of invalid_tse
pointer ("un-const") to prevent compiler warning.

12 years agoMerge pull request #12 from waywardmonkeys/automake-version
Ivan Maidanski [Thu, 16 Feb 2012 04:26:02 +0000 (20:26 -0800)]
Merge pull request #12 from waywardmonkeys/automake-version

autogen.sh: Check for automake/aclocal v1.11 as well

12 years agoCheck for automake / aclocal 1.11 as well.
Bruce Mitchener [Thu, 16 Feb 2012 03:47:39 +0000 (10:47 +0700)]
Check for automake / aclocal 1.11 as well.

12 years agoPrevent NO_DYLD_BIND_FULLY_IMAGE redefinition (Darwin)
Ivan Maidanski [Tue, 14 Feb 2012 19:34:30 +0000 (23:34 +0400)]
Prevent NO_DYLD_BIND_FULLY_IMAGE redefinition (Darwin)

* include/private/gcconfig.h (NO_DYLD_BIND_FULLY_IMAGE): Do not define
if already defined (e.g., by compiler -D option).

12 years agoUpdate ChangeLog
Ivan Maidanski [Tue, 14 Feb 2012 15:45:47 +0000 (19:45 +0400)]
Update ChangeLog

12 years agoAdd SHORT_DBG_HDRS macro template to configure
Ivan Maidanski [Tue, 14 Feb 2012 04:47:23 +0000 (08:47 +0400)]
Add SHORT_DBG_HDRS macro template to configure

* configure.ac (SHORT_DBG_HDRS): New AH template.

12 years agoReformat configure (wrap long lines and remove unnecessary backslash)
Ivan Maidanski [Tue, 14 Feb 2012 04:43:01 +0000 (08:43 +0400)]
Reformat configure (wrap long lines and remove unnecessary backslash)

* configure.ac (GC_THREADS, USE_WINALLOC): Remove unnecessary trailing
backslash.
* configure.ac (AC_MSG_WARN): Always put message in quotes.
* configure.ac (NO_EXECUTE_PERMISSION, AC_MSG_ERROR): Wrap long line.

12 years agoRemove unsupported MMAP_STACKS (specific to Solaris threads)
Ivan Maidanski [Tue, 14 Feb 2012 04:41:56 +0000 (08:41 +0400)]
Remove unsupported MMAP_STACKS (specific to Solaris threads)

* doc/README.macros (MMAP_STACKS): Remove.
* dyn_load.c (GC_register_dynamic_libraries): Remove check of
MMAP_STACKS since GC_is_thread_stack is missing since removal of
Solaris threads support (IRIX5).

12 years agoImprove GC_allochblk algorithm of block splitting when unmapping enabled
Ivan Maidanski [Tue, 14 Feb 2012 04:37:02 +0000 (08:37 +0400)]
Improve GC_allochblk algorithm of block splitting when unmapping enabled
(allow splitting up to limit based on per-list free space amount but
skipping unmapped blocks)

* allchblk.c (GC_allochblk_nth): Change type of "may_split" argument
from GC_bool to int (to hold 3rd value).
* allchblk.c (AVOID_SPLIT_REMAPPED): New macro (used as a value for
"may_split").
* allchblk.c (GC_allochblk): Add "may_split" local variable (set to
TRUE by default and passed to GC_allochblk_nth); do not zero
split_limit in case of USE_MUNMAP (and remove FIXME); set may_split to
AVOID_SPLIT_REMAPPED in case of USE_MUNMAP and split_limit is
a non-zero value computed by GC_enough_large_bytes_left.
* allchblk.c (GC_allochblk_nth): Update usage comment; if may_split is
AVOID_SPLIT_REMAPPED and hhdr is unmapped then continue search instead
of remapping memory and splitting the block.

12 years agoMinor code refactoring of GC_allochblk_nth
Ivan Maidanski [Tue, 14 Feb 2012 04:26:17 +0000 (08:26 +0400)]
Minor code refactoring of GC_allochblk_nth

* allchblk.c (N_HBLK_FLS): Enclose in parentheses.
* allchblk.c (GC_allochblk_nth): Reformat comment; move
GC_install_header invocation out of conditional expression.

12 years agoCode refactoring of GC_remove_from_fl
Ivan Maidanski [Mon, 13 Feb 2012 05:21:37 +0000 (09:21 +0400)]
Code refactoring of GC_remove_from_fl

* allchblk.c (INCR_FREE_BYTES, FREE_ASSERT, FL_UNKNOWN): Remove.
* allchblk.c (PHDR, NHDR): Enclose argument in parentheses.
* allchblk.c (IS_MAPPED): Replace 1 with TRUE.
* allchblk.c (GC_remove_from_fl, GC_add_to_fl, GC_split_block): Expand
FREE_ASSERT and INCR_FREE_BYTES macros.
* allchblk.c (GC_remove_from_fl): Decouple to GC_remove_from_fl_at
(for known free list index) and to single-argument GC_remove_from_fl;
update the comment.
* allchblk.c (GC_merge_unmapped, GC_get_first_part, GC_allochblk_nth,
GC_freehblk): Adjust GC_remove_from_fl invocation.
* allchblk.c (GC_split_block): Make assertion on GC_free_bytes element
stricter (check for overflow).
* allchblk.c (GC_free_block_ending_at, GC_add_to_fl): Reformat comment.

12 years agoDo not avoid splitting if nothing currently unmapped (USE_MUNMAP)
Ivan Maidanski [Mon, 13 Feb 2012 04:09:52 +0000 (08:09 +0400)]
Do not avoid splitting if nothing currently unmapped (USE_MUNMAP)

* allchblk.c (GC_free_bytes, GC_enough_large_bytes_left,
GC_compute_large_free_bytes): Define even for USE_MUNMAP case.
* allchblk.c (INCR_FREE_BYTES, FREE_ASSERT): Always define as
non-empty.
* allchblk.c (GC_compute_large_free_bytes, GC_print_hblkfreelist,
GC_remove_from_fl): Remove check of USE_MUNMAP (same implementation as
if without memory unmapping).
* allchblk.c (GC_compute_large_free_bytes): Remove FIXME.
* allchblk.c (GC_allochblk): Do not avoid splitting if
GC_unmapped_bytes is zero (meaning nothing unmapped); add FIXME to
relax the condition.

12 years agoMinor code refactoring of GC_freehblk (change type of local variable)
Ivan Maidanski [Sun, 12 Feb 2012 09:20:00 +0000 (13:20 +0400)]
Minor code refactoring of GC_freehblk (change type of local variable)

* allchblk.c (GC_freehblk): Change type of "size" local variable from
singed_word to word; cast "hbp" to ptr_t instead of word (for getting
"next" address).

12 years agoReport inconsistent configuration if PARALLEL_MARK but no THREADS
Ivan Maidanski [Fri, 10 Feb 2012 04:29:12 +0000 (08:29 +0400)]
Report inconsistent configuration if PARALLEL_MARK but no THREADS

* include/private/gcconfig.h (PARALLEL_MARK): Add an explicit check
for THREADS to be defined if PARALLEL_MARK is defined.

12 years agoFix GC_root_size update in GC_add_roots_inner (Win32)
Ivan Maidanski [Fri, 10 Feb 2012 04:26:40 +0000 (08:26 +0400)]
Fix GC_root_size update in GC_add_roots_inner (Win32)

* mark_rts.c (GC_add_roots_inner): Fix update of GC_root_size value
for Win32 (adjust GC_root_size before altering r_start/r_end).

12 years agoUpdate TODO (failure in Cygwin resolved)
Ivan Maidanski [Thu, 9 Feb 2012 16:27:45 +0000 (20:27 +0400)]
Update TODO (failure in Cygwin resolved)

12 years agoAllow to get memory via Win32 VirtualAlloc (USE_WINALLOC) on Cygwin
Ivan Maidanski [Thu, 9 Feb 2012 15:56:48 +0000 (19:56 +0400)]
Allow to get memory via Win32 VirtualAlloc (USE_WINALLOC) on Cygwin

* README.macros (USE_WINALLOC): Document.
* include/private/gcconfig.h (USE_WINALLOC): Add comment.
* include/private/gcconfig.h (USE_MMAP): Explicitly undefine if
USE_WINALLOC.
* os_dep.c (GC_wince_get_mem): Move definition up to simplify ifdef.
* os_dep.c (GC_win32_get_mem): Test USE_WINALLOC instead of CYGWIN32;
test GLOBAL_ALLOC_TEST value only if MSWIN32.

12 years agoCode refactoring (test single macro instead of MSWIN32/MSWINCE pair)
Ivan Maidanski [Thu, 9 Feb 2012 15:15:52 +0000 (19:15 +0400)]
Code refactoring (test single macro instead of MSWIN32/MSWINCE pair)

* alloc.c (GC_stopped_mark): Test USE_WINALLOC macro instead of
MSWIN32 and MSWINCE.
* include/private/gc_priv.h (GC_add_current_malloc_heap): Likewise.
* os_dep.c (MMAP_SUPPORTED, SBRK_ARG_T, GC_mem_top_down, GC_unmap,
GC_remap, GC_unmap_gap, PROTECT, UNPROTECT): Likewise.
* include/private/gcconfig.h (USE_WINALLOC): New macro (defined if
MSWIN32 or MSWINCE).
* os_dep.c (GC_sysinfo): Define just before GC_setpagesize.
* os_dep.c (GC_malloc_heap_list, GC_is_malloc_heap_base,
GC_get_allocation_base, GC_add_current_malloc_heap, GC_is_heap_base):
Test USE_WINALLOC macro instead of CYGWIN32.
* os_dep.c (USE_GLOBAL_ALLOC): Define macro even if CYGWIN32 (to
remove redundant macro test).
* os_dep.c (GC_mem_top_down): Remove STATIC (as used for debugging);
define as macro in case of 0 value.

12 years agoCode refactoring of GC_remap
Ivan Maidanski [Tue, 7 Feb 2012 05:12:47 +0000 (09:12 +0400)]
Code refactoring of GC_remap

* os_dep.c (GC_remap): Move start_addr testing out of ifdef block;
move "result" local variable to the block where used; swap NaCl and
non-NaCl code blocks.

12 years agoTurn internal GC_mark_stack_empty function into macro
Ivan Maidanski [Mon, 6 Feb 2012 16:53:01 +0000 (20:53 +0400)]
Turn internal GC_mark_stack_empty function into macro

* include/private/gc_pmark.h (GC_mark_stack_empty): Define as macro.
* include/private/gc_priv.h (GC_mark_stack_empty): Remove.
* mark.c (GC_mark_stack_empty): Remove inner function.

12 years agoAllow to exclude finalization support by GC_NO_FINALIZATION macro
Ivan Maidanski [Mon, 6 Feb 2012 15:49:06 +0000 (19:49 +0400)]
Allow to exclude finalization support by GC_NO_FINALIZATION macro

* doc/README.macros (GC_NO_FINALIZATION): Document.
* alloc.c (GC_finish_collection): Do not call GC_finalize and
GC_print_finalization_stats if GC_NO_FINALIZATION.
* dbg_mlc.c (closure, GC_make_closure, GC_debug_invoke_finalizer,
OFN_UNSET, store_old, GC_debug_register_finalizer,
GC_debug_register_finalizer_no_order,
GC_debug_register_finalizer_unreachable,
GC_debug_register_finalizer_ignore_self): Do not define if
GC_NO_FINALIZATION.
* finalize.c: Skip all definitions if GC_NO_FINALIZATION.
* finalize.c (GC_call_with_alloc_lock): Move to misc.c.
* include/private/gc_priv.h (GC_INVOKE_FINALIZERS): Define to empty
if GC_NO_FINALIZATION.
* include/private/gc_priv.h (GC_notify_or_invoke_finalizers,
GC_push_finalizer_structures, GC_finalize,
GC_print_finalization_stats): Do not declare if GC_NO_FINALIZATION.
* mark_rts.c (GC_push_gc_structures): Do not call
GC_push_finalizer_structures if GC_NO_FINALIZATION.
* misc.c (GC_call_with_alloc_lock): Move from "finalize" module.
* tests/test.c (mktree): Do not declare "my_index" and "new_link"
local variables, do not update live_indicators_count, do not call
GC_REGISTER_FINALIZER, GC_GENERAL_REGISTER_DISAPPEARING_LINK,
GC_move_disappearing_link, GC_unregister_disappearing_link if
GC_NO_FINALIZATION.
* tests/test.c (check_heap_stats): Do not declare "still_live",
"late_finalize_count" local variables and do not check finalization
for failures if GC_NO_FINALIZATION.

12 years agoAdd missing GC_ATTR_UNUSED annotation to GC_store_debug_info_inner
Ivan Maidanski [Fri, 3 Feb 2012 18:16:40 +0000 (22:16 +0400)]
Add missing GC_ATTR_UNUSED annotation to GC_store_debug_info_inner

* dbg_mlc.c (CROSSES_HBLK): Add missing parentheses.
* dbg_mlc.c (GC_store_debug_info_inner): Tag "sz" argument with
GC_ATTR_UNUSED (as unused if SHORT_DBG_HDRS).

12 years agoMove finalize.c global variables outside to alloc.c and misc.c
Ivan Maidanski [Fri, 3 Feb 2012 18:11:28 +0000 (22:11 +0400)]
Move finalize.c global variables outside to alloc.c and misc.c
(to minimize number of linked global symbols of 'finalize' module in
case finalization not unused)

* alloc.c (GC_fo_entries): Move global variable definition from
finalize.c.
* finalize.c (GC_fo_entries): Likewise.
* finalize.c (GC_finalize_on_demand, GC_java_finalization,
GC_finalizer_notifier): Move global variable definition to misc.c.
* misc.c (GC_finalize_on_demand, GC_java_finalization,
GC_finalizer_notifier): Likewise.

12 years agoUpdate ChangeLog
Ivan Maidanski [Fri, 3 Feb 2012 17:19:46 +0000 (21:19 +0400)]
Update ChangeLog

12 years agoImplement GC_get_stack_base for Darwin if threads support is off
Ivan Maidanski [Fri, 3 Feb 2012 16:13:11 +0000 (20:13 +0400)]
Implement GC_get_stack_base for Darwin if threads support is off

* os_dep.c (GC_get_stack_base): Define separately for NEED_FIND_LIMIT
case; tag the argument with "unused" attribute for the case when
GC_UNIMPLEMENTED is returned; add implementation (as the last
alternative) based on GC_get_main_stack_base (e.g., for Darwin)
for the single-threaded case unless GC_stack_base has more that
one field (IA-64).

12 years agoDeclare privately and use handy GC_base_C() for constant object pointers
Ivan Maidanski [Fri, 3 Feb 2012 15:56:22 +0000 (19:56 +0400)]
Declare privately and use handy GC_base_C() for constant object pointers

* dbg_mlc.c (GC_debug_change_stubborn, GC_debug_end_stubborn_change):
Use GC_base_C() instead of GC_base() (remove cast to void pointer).
* finalize.c (GC_general_register_disappearing_link): Likewise.
* finalize.c (GC_register_disappearing_link, GC_finalize): Remove
redundant cast to void pointer and ptr_t.
* include/private/gc_priv.h (GC_base_C): New macro definition.

12 years agoPrevent compiler warnings in GC_FindTopOfStack and GC_ports (Darwin)
Ivan Maidanski [Fri, 3 Feb 2012 15:34:47 +0000 (19:34 +0400)]
Prevent compiler warnings in GC_FindTopOfStack and GC_ports (Darwin)

* darwin_stop_world.c (GC_FindTopOfStack): Initialize "frame" local
variable from "stack_start" unless done via PPC lwz/ld instruction (to
prevent "uninitialized variable use" compiler warning;
add assertion for "stack_start" value; add 'U' suffix to int constant
to prevent comparison of signed and unsigned value.
* os_dep.c (GC_ports): Explicitly initialize "reply" field to zero if
THREADS (to suppress compiler warning on Darwin).

12 years agoTag must-be-non-null arguments of GC API functions with the attribute
Ivan Maidanski [Wed, 1 Feb 2012 20:12:30 +0000 (00:12 +0400)]
Tag must-be-non-null arguments of GC API functions with the attribute

* include/gc.h (GC_set_oom_fn, GC_strndup, GC_posix_memalign,
GC_change_stubborn, GC_end_stubborn_change, GC_size,
GC_try_to_collect, GC_set_stop_func, GC_debug_strndup,
GC_debug_change_stubborn, GC_debug_end_stubborn_change, GC_wcsdup,
GC_debug_wcsdup, GC_register_finalizer, GC_debug_register_finalizer,
GC_register_finalizer_ignore_self,
GC_debug_register_finalizer_ignore_self,
GC_register_finalizer_no_order, GC_debug_register_finalizer_no_order,
GC_register_finalizer_unreachable,
GC_debug_register_finalizer_unreachable,
GC_register_disappearing_link, GC_general_register_disappearing_link,
GC_move_disappearing_link, GC_set_warn_proc, GC_call_with_alloc_lock,
GC_call_with_stack_base, GC_register_my_thread, GC_do_blocking,
GC_call_with_gc_active, GC_get_stack_base, GC_pre_incr, GC_post_incr):
Specify 'non-null' attribute for the relevant function argument.
* include/gc_backptr.h (GC_get_back_ptr_info, GC_print_backtrace):
Likewise.
* include/gc_mark.h (GC_new_kind, GC_new_kind_inner, GC_is_marked,
GC_clear_mark_bit, GC_set_mark_bit): Likewise.
* include/gc_config_macros.h (GC_ATTR_NONNULL): New macro (support
'non-null' attribute for GCC v4+).

12 years agoTag deprecated variables in GC API with the corresponding attribute
Ivan Maidanski [Wed, 1 Feb 2012 19:58:59 +0000 (23:58 +0400)]
Tag deprecated variables in GC API with the corresponding attribute

* include/gc.h (GC_gc_no, GC_parallel, GC_oom_fn, GC_on_heap_resize,
GC_find_leak, GC_all_interior_pointers, GC_finalize_on_demand,
GC_java_finalization, GC_finalizer_notifier, GC_dont_gc,
GC_dont_expand, GC_use_entire_heap, GC_full_freq, GC_non_gc_bytes,
GC_no_dls, GC_free_space_divisor, GC_max_retries, GC_get_max_retries,
GC_stackbottom, GC_dont_precollect, GC_time_limit): Add
GC_ATTR_DEPRECATED attribute.
* include/gc_config_macros.h (GC_ATTR_DEPRECATED): Add new attribute
for tagging deprecated symbols (support GCC v4+ and MS VC v12+).

12 years agoAdd support of GC_ATTR_MALLOC for MS VS
Ivan Maidanski [Wed, 1 Feb 2012 19:45:20 +0000 (23:45 +0400)]
Add support of GC_ATTR_MALLOC for MS VS

* include/gc.h (GC_malloc, GC_malloc_atomic, GC_strdup, GC_strndup,
GC_malloc_uncollectable, GC_malloc_stubborn, GC_memalign,
GC_malloc_ignore_off_page, GC_malloc_atomic_ignore_off_page,
GC_malloc_atomic_uncollectable, GC_debug_malloc_atomic_uncollectable,
GC_debug_malloc, GC_debug_malloc_atomic, GC_debug_strdup,
GC_debug_strndup, GC_debug_malloc_uncollectable,
GC_debug_malloc_stubborn, GC_debug_malloc_ignore_off_page,
GC_debug_malloc_atomic_ignore_off_page, GC_debug_malloc_replacement,
GC_debug_realloc_replacement, GC_wcsdup, GC_debug_wcsdup): Move
GC_ATTR_MALLOC and GC_ATTR_ALLOC_SIZE from the function declaration
tail to the beginning (just after GC_API) for compatibility with MS VC.
* include/gc_gcj.h (GC_gcj_malloc, GC_debug_gcj_malloc,
GC_gcj_malloc_ignore_off_page): Likewise.
* include/gc_config_macros.h (GC_ATTR_MALLOC): Implement for
MS VC (Visual Studio) v14+.

12 years agoTag auxiliary malloc-like API functions with 'malloc' attribute
Ivan Maidanski [Wed, 1 Feb 2012 19:21:00 +0000 (23:21 +0400)]
Tag auxiliary malloc-like API functions with 'malloc' attribute

* include/gc.h (GC_malloc_many): Add GC_ATTR_MALLOC attribute.
* include/gc_mark.h (GC_generic_malloc): Likewise.
* include/gc_typed.h (GC_calloc_explicitly_typed): Likewise.
* include/gc_disclaim.h (GC_finalized_malloc): Add GC_ATTR_MALLOC and
GC_ATTR_ALLOC_SIZE attributes.
* include/gc_typed.h (GC_malloc_explicitly_typed,
GC_malloc_explicitly_typed_ignore_off_page): Likewise.

12 years agoRemove duplicate compiler option in NT_X64_THREADS_MAKEFILE
Ivan Maidanski [Wed, 1 Feb 2012 18:51:55 +0000 (22:51 +0400)]
Remove duplicate compiler option in NT_X64_THREADS_MAKEFILE

* NT_X64_THREADS_MAKEFILE (.cpp.obj): Remove duplicate
-D ALL_INTERIOR_POINTERS option.

12 years agoRefine documentation comments and minor code refactoring in allchblk.c
Ivan Maidanski [Wed, 1 Feb 2012 17:47:08 +0000 (21:47 +0400)]
Refine documentation comments and minor code refactoring in allchblk.c

* allchblk.c (GC_enough_large_bytes_left, GC_allochblk_nth): Refine
and reformat comment.
* allchblk.c (INCR_FREE_BYTES): Add missing parentheses.
* allchblk.c (GC_allochblk): Remove "i" and nested "result" local
variable declarations; replace "return" statement in the trailing loop
with "break" (code refactoring).

12 years agoAdd GC_is_disabled new function to GC API
Ivan Maidanski [Wed, 1 Feb 2012 17:25:44 +0000 (21:25 +0400)]
Add GC_is_disabled new function to GC API

* include/gc.h (GC_dont_gc): Improve comment (add note for new client
code).
* include/gc.h (GC_is_disabled): New API function.
* misc.c (GC_is_disabled): Likewise.

12 years agoRefine GC_stackbottom description in gc.h
Ivan Maidanski [Wed, 1 Feb 2012 17:17:18 +0000 (21:17 +0400)]
Refine GC_stackbottom description in gc.h

* include/gc.h (GC_stackbottom): Improve comment (add note for
new client code).

12 years agoAdd assertion to GC_incremental_protection_needs, refine documentation
Ivan Maidanski [Wed, 1 Feb 2012 17:12:07 +0000 (21:12 +0400)]
Add assertion to GC_incremental_protection_needs, refine documentation

* include/gc.h (GC_incremental_protection_needs): Improve comment.
* os_dep.c (GC_incremental_protection_needs): Add assertion on GC is
initialized.

12 years agoFix a typo in gc.h comment
Ivan Maidanski [Wed, 1 Feb 2012 16:56:28 +0000 (20:56 +0400)]
Fix a typo in gc.h comment

* include/gc.h (GC_base): Fix a typo in the comment.

12 years agogctest: Avoid use of deprecated GC_dont_gc and GC_stackbottom
Ivan Maidanski [Wed, 1 Feb 2012 16:49:25 +0000 (20:49 +0400)]
gctest: Avoid use of deprecated GC_dont_gc and GC_stackbottom

* tests/test.c (GC_amiga_gctest_malloc_explicitly_typed,
GC_amiga_gctest_calloc_explicitly_typed): Do not unnecessarily check
GC_dont_gc value.
* tests/test.c (check_heap_stats): Get stack base via
GC_get_stack_base() (report error if failed) instead of accessing
GC_stackbottom.

12 years agocordtest: Report success to stdout instead of stderr
Ivan Maidanski [Wed, 1 Feb 2012 16:36:20 +0000 (20:36 +0400)]
cordtest: Report success to stdout instead of stderr

* cord/tests/cordtest.c (main): Print "SUCCEEDED" message to stdout
instead of stderr.

12 years agoAdd assertions to check GC_large_free_bytes and GC_root_size values by
Ivan Maidanski [Tue, 31 Jan 2012 16:10:14 +0000 (20:10 +0400)]
Add assertions to check GC_large_free_bytes and GC_root_size values by
GC_finish_collection even if GC_dump_regularly is off

* allchblk.c (GC_compute_large_free_bytes): New inner function
(defined only if GC_ASSERTIONS or not NO_DEBUGGING).
* mark_rts.c (GC_compute_root_size): Likewise.
* allchblk.c (GC_print_hblkfreelist): Call GC_compute_large_free_bytes
instead of computing large_free_bytes itself (only if not USE_MUNMAP
for now); remove "sz" local variable.
* allchblk.c (GC_print_hblkfreelist): Refine logged messages (for
total value).
* mark_rts.c (GC_print_static_roots): Likewise.
* include/private/gc_priv.h (GC_dump_regularly, COND_DUMP): Move
definition down below GC_ASSERT one.
* include/private/gc_priv.h (GC_compute_large_free_bytes,
GC_compute_root_size): New function declaration (only if
GC_ASSERTIONS).
* include/private/gc_priv.h (COND_DUMP_CHECKS): New macro (invoke
GC_ASSERT for GC_large_free_bytes and GC_root_size).
* include/private/gc_priv.h (COND_DUMP): Invoke COND_DUMP_CHECKS
unless GC_dump_regularly.
* mark_rts.c (GC_print_static_roots): Call GC_compute_root_size
instead of computing root size itself; rename "total" local variable
to "size".

12 years agoUpdate ChangeLog
Ivan Maidanski [Tue, 31 Jan 2012 04:43:55 +0000 (08:43 +0400)]
Update ChangeLog

12 years agoFix FREE_ASSERT usage (fix missing trailing semi-colon)
Ivan Maidanski [Tue, 31 Jan 2012 04:24:26 +0000 (08:24 +0400)]
Fix FREE_ASSERT usage (fix missing trailing semi-colon)

* allchblk.c (GC_add_to_fl): Append ';' after FREE_ASSERT().
* allchblk.c (GC_remove_from_fl): Fix a typo in a comment.

12 years agoAdjust GC_requested_heapsize on GC_init if GC_INITIAL_HEAP_SIZE given
Ivan Maidanski [Tue, 31 Jan 2012 04:22:16 +0000 (08:22 +0400)]
Adjust GC_requested_heapsize on GC_init if GC_INITIAL_HEAP_SIZE given

* misc.c (GC_init): Adjust GC_requested_heapsize if GC_expand_hp_inner
(called with the value passed by "GC_INITIAL_HEAP_SIZE" environment
variable) succeeded.

12 years agoMake logged info of GC_stopped_mark and GC_print_heap_sects more compact
Ivan Maidanski [Tue, 31 Jan 2012 04:01:06 +0000 (08:01 +0400)]
Make logged info of GC_stopped_mark and GC_print_heap_sects more compact

* alloc.c (GC_stopped_mark, GC_print_heap_sects): Make output of
GC_log_printf (printing amount of reclaimed memory and total heap
size) more compact (to fit into 80-characters line for reasonable
values).

12 years agoOpen log file in APPEND mode (Win32) if file name given via
Ivan Maidanski [Mon, 30 Jan 2012 19:11:16 +0000 (23:11 +0400)]
Open log file in APPEND mode (Win32) if file name given via
environment variable (to match behavior in Unix/Cygwin)

* misc.c (GC_CreateLogFile): Declare "appendToFile" local variable;
open log file either in CREATE_ALWAYS mode (and move file pointer to
log end) if the log file name is specified via environment variable.

12 years agoCode refactoring of GC_CreateLogFile (Win32)
Ivan Maidanski [Mon, 30 Jan 2012 18:20:04 +0000 (22:20 +0400)]
Code refactoring of GC_CreateLogFile (Win32)

* misc.c (GC_LOG_STD_NAME): New macro.
* misc.c (GC_init, GC_CreateLogFile): Use GC_LOG_STD_NAME instead
of "gc.log".
* misc.c (GC_CreateLogFile): Rename "logPath" local variable to
"pathBuf".
* misc.c (GC_CreateLogFile): Declare/use "hFile" and "logPath" local
variables.

12 years agoCode refactoring of GC_get_nprocs (define for every supported target
Ivan Maidanski [Mon, 30 Jan 2012 12:42:29 +0000 (16:42 +0400)]
Code refactoring of GC_get_nprocs (define for every supported target
and simplify GC_thr_init)

* pthread_support.c (GC_get_nprocs): Define for all targets (either as
macro as inline function); group all implementations together.
* pthread_support.c (get_ncpu): Rename to GC_get_nprocs.
* pthread_support.c (GC_thr_init): Call GC_get_nprocs() for all
targets.
* pthread_support.c (GC_get_nprocs): Remove debug logging (of CPUs
number).
* pthread_support.c (GC_thr_init): Log number of CPUs (if
GC_print_stats) even in case PARALLEL_MARK is disabled.

12 years agoUpdate TODO file
Ivan Maidanski [Sun, 29 Jan 2012 19:09:43 +0000 (23:09 +0400)]
Update TODO file

12 years agoUse union of AO_t and word for mse_descr to avoid type casting
Ivan Maidanski [Sun, 29 Jan 2012 18:52:30 +0000 (22:52 +0400)]
Use union of AO_t and word for mse_descr to avoid type casting
(which breaks 'strict-aliasing' compiler optimization)

* include/private/gc_pmark.h (GC_ms_entry): Change type of mse_descr
from word to word_ptr_ao_u.
* include/private/gc_pmark.h (GC_mark_stack_top): Add FIXME.
* include/private/gc_pmark.h (OR_WORD_EXIT_IF_SET): Add 'volatile'
keyword to type cast for AO_or argument.
* include/private/gc_priv.h (counter_t): Add 'volatile' in case of
defining as AO_t (replace typedef with a macro).
* include/private/gc_priv.h (word_ptr_ao_u): New union type.
* include/private/gc_pmark.h (PUSH_OBJ): Add ".w" suffix to mse_descr.
* mark.c (GC_mark_from, GC_steal_mark_stack, GC_push_all): Likewise.
* mark.c (GC_steal_mark_stack): Use "ao" element of union to load and
clear mse_descr atomically; remove pointer type casts.

12 years agoCode refactoring regarding GC_PUSH_ONE_HEAP (mark)
Ivan Maidanski [Sun, 29 Jan 2012 17:46:40 +0000 (21:46 +0400)]
Code refactoring regarding GC_PUSH_ONE_HEAP (mark)

* finalize.c (GC_ignore_self_finalize_mark_proc): Pass
GC_mark_stack_top to GC_PUSH_ONE_HEAP.
* mark.c (PUSH_GRANULE): Likewise.
* include/private/gc_pmark.h (GC_PUSH_ONE_HEAP): Replace
hard-coded GC_mark_stack_top with mark_stack_top argument; reformat
comment; add missing brackets.

12 years agoCode refactoring of Darwin GC_dyld_image_add/remove (make read-only
Ivan Maidanski [Sun, 29 Jan 2012 16:17:31 +0000 (20:17 +0400)]
Code refactoring of Darwin GC_dyld_image_add/remove (make read-only
array 'const' and remove trailing NULL)

* dyn_load.c (GC_dyld_add_sect_fmts): Add 'const' keyword to global
array definition; remove trailing NULL.
* dyn_load.c (GC_dyld_image_add, GC_dyld_image_remove): Test array
index boundary instead of testing for trailing NULL.

12 years agoUse union of AO_t and 'tse' data pointer in specific.c to avoid type
Ivan Maidanski [Sun, 29 Jan 2012 16:07:31 +0000 (20:07 +0400)]
Use union of AO_t and 'tse' data pointer in specific.c to avoid type
casting (breaking strict-aliasing rules)

* include/private/specific.h (ptse_ao_u): New union type.
* include/private/specific.h (thread_specific_data): Change type of
"hash" field from "tse" pointer to ptse_ao_u.
* specific.c (invalid_tse): Put to 'const' data section.
* specific.c (GC_key_create_inner, GC_setspecific, GC_remove_specific,
GC_slow_getspecific, GC_check_tsd_marks): Use "p" element of union to
access "tse" pointer of hash table.
* specific.c (GC_setspecific): Use "ao" element of union to store
"hash" table entry atomically; remove type cast.

12 years agoRemove part of DllMain-specific code which is always disabled (Win32)
Ivan Maidanski [Sun, 29 Jan 2012 15:15:46 +0000 (19:15 +0400)]
Remove part of DllMain-specific code which is always disabled (Win32)

* win32_threads.c (first_thread, GC_push_thread_structures): Refine
the comment.
* win32_threads.c (GC_delete_gc_thread, GC_push_thread_structures):
Remove pthread-specific code from the code specific to DllMain-based
thread registration (since GC_PTHREADS cannot be defined if
GC_NO_THREADS_DISCOVERY is undefined).
* win32_threads.c (GC_DllMain): Reformat the code.

12 years agoAdd missing 'volatile' for AO_t variable definitions
Ivan Maidanski [Sun, 29 Jan 2012 14:03:27 +0000 (18:03 +0400)]
Add missing 'volatile' for AO_t variable definitions
(to minimize number of casts breaking strict-aliasing rules)

* mallocx.c (GC_bytes_allocd_tmp): Change type from signed_word to
AO_t.
* mallocx.c (GC_generic_malloc_many): Use AO_load to get
GC_bytes_allocd_tmp value; remove type cast for GC_bytes_allocd_tmp
passed to AO_fetch_and_add.
* pthread_support.c (GC_spin_count, GC_block_count,
GC_unlocked_count): Add "volatile" for AO_t global variable (defined
only if LOCK_STATS).
* win32_threads.c (GC_attached_thread, GC_block_count,
GC_unlocked_count): Likewise.
* win32_threads.c (GC_Thread_Rep): Add "volatile" for "in_use" AO_t
field.
* win32_threads.c (GC_started_thread_while_stopped): Remove "result"
local variable; use AO_compare_and_swap_release (if available) instead
of AO_nop_full/load/store for GC_attached_thread.
* win32_threads.c (GC_stop_world): Clear GC_attached_thread using
AO_store.

12 years agoMove some GC_arrays non-pointer fields to module where they are used
Ivan Maidanski [Sun, 29 Jan 2012 10:41:46 +0000 (14:41 +0400)]
Move some GC_arrays non-pointer fields to module where they are used

* include/private/gc_priv.h (_GC_arrays): Move _max_heapsize and
_non_gc_bytes_at_gc fields to alloc.c.
* include/private/gc_priv.h (GC_max_heapsize, GC_non_gc_bytes_at_gc):
Remove.
* alloc.c (GC_non_gc_bytes_at_gc, GC_max_heapsize): Define global
variables as STATIC.

12 years agoAdjust GC_log_printf format specifiers (regarding signed/unsigned long)
Ivan Maidanski [Sat, 28 Jan 2012 18:33:58 +0000 (22:33 +0400)]
Adjust GC_log_printf format specifiers (regarding signed/unsigned long)

* alloc.c (GC_maybe_gc, GC_expand_hp_inner): Change printf "%ld"
format specifier to "%lu" one according to printed value.
* backgraph.c (GC_print_back_graph_stats): Likewise.
* blacklst.c (GC_default_print_heap_obj_proc,
GC_promote_black_lists): Likewise.
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
* mark_rts.c (GC_print_static_roots): Likewise.
* alloc.c (GC_stopped_mark): Correct logged GC number.
* dbg_mlc.c (GC_print_backtrace): Cast printed value to proper type.
* mark.c (GC_mark_from): Likewise.
* dbg_mlc.c (GC_debug_malloc, GC_debug_malloc_ignore_off_page,
GC_debug_malloc_atomic_ignore_off_page, GC_debug_malloc_stubborn,
GC_debug_malloc_atomic, GC_debug_malloc_uncollectable): Change printf
"%ld" format specifier for line number to "%d" one.
* malloc.c (GC_free): Improve logged message (if LOG_ALLOCS).
* thread_local_alloc.c (GC_malloc): Likewise.
* os_dep.c (GC_dirty_init): Improve logged message (for VERBOSE level).

12 years agogctest: Output marker threads count at end
Ivan Maidanski [Sat, 28 Jan 2012 17:39:28 +0000 (21:39 +0400)]
gctest: Output marker threads count at end

* tests/test.c (run_one_test): Adjust printf format specifier.
* tests/test.c (main): Move printf for completed collections number
to check_heap_stats().
* tests/test.c (check_heap_stats): Print number of marker threads.

12 years agoMake GC_parallel a synonym to GC_markers_m1
Ivan Maidanski [Sat, 28 Jan 2012 15:28:13 +0000 (19:28 +0400)]
Make GC_parallel a synonym to GC_markers_m1

* include/gc.h (GC_parallel, GC_enable_incremental): Update comment.
* include/private/gc_priv.h (GC_markers_m1): Define as a synonym
(macro) to GC_parallel instead of declaring a global variable (only
if PARALLEL_MARKER); update the comment.
* mark.c (GC_markers_m1): Remove global variable.
* pthread_support.c (start_mark_threads): Remove unnecessary
GC_parallel zeroing (after setting GC_markers_m1 to 0).
* win32_threads.c (start_mark_threads): Likewise.
* pthread_support.c (GC_fork_child_proc, GC_thr_init): Remove
unnecessary GC_markers_m1 zeroing (after setting GC_parallel to FALSE).
* win32_threads.c (GC_thr_init): Likewise.
* pthread_support.c (GC_thr_init): Set GC_parallel to FALSE instead of
zeroing GC_markers_m1; remove GC_parallel assignment to TRUE (since
GC_markers_m1 is set to non-zero value); add the comment.
* pthread_support.c (GC_thr_init): Set GC_parallel to FALSE instead of
zeroing GC_markers_m1; add the comment.
* pthread_support.c (GC_thr_init): Remove GC_parallel assignment to
TRUE (since GC_markers_m1 is set to non-zero value).
* win32_threads.c (GC_thr_init): Likewise.

12 years agoParallel-marker code refactoring (replace GC_markers with GC_markers_m1)
Ivan Maidanski [Sat, 28 Jan 2012 13:19:25 +0000 (17:19 +0400)]
Parallel-marker code refactoring (replace GC_markers with GC_markers_m1)

* include/private/gc_priv.h (GC_markers): Replace with GC_markers_m1
(which is GC_markers minus one); update the comment.
* mark.c (GC_markers): Likewise.
* mark.c (GC_help_marker): Replace GC_markers with GC_markers_m1.
* pthread_support.c (GC_is_mach_marker, start_mark_threads,
GC_segment_is_thread_stack, GC_fork_child_proc, GC_thr_init): Likewise.
* win32_threads.c (GC_get_next_stack, start_mark_threads,
GC_wait_marker, GC_notify_all_marker, GC_thr_init): Likewise.

12 years agoChange GC_markers and GC_nprocs type to int
Ivan Maidanski [Sat, 28 Jan 2012 09:17:51 +0000 (13:17 +0400)]
Change GC_markers and GC_nprocs type to int

* include/private/gc_priv.h (GC_markers): Change type from long to int.
* mark.c (GC_markers): Likewise.
* pthread_support.c (GC_nprocs): Likewise.
* pthread_support.c (start_mark_threads, GC_thr_init): Adjust printf
format specifier for GC_markers and GC_nprocs.
* win32_threads.c (GC_thr_init): Likewise.
* pthread_support.c (GC_thr_init): Cast sysconf() result to int.
* win32_threads.c (start_mark_threads, GC_wait_marker,
GC_notify_all_marker): Remove unnecessary cast of GC_markers.
* win32_threads.c (GC_thr_init): Cast dwNumberOfProcessors to int.

12 years agoLog amount of unmapped memory (if enabled) on marking-for-collection
Ivan Maidanski [Fri, 27 Jan 2012 15:07:20 +0000 (19:07 +0400)]
Log amount of unmapped memory (if enabled) on marking-for-collection

* alloc.c (GC_stopped_mark, GC_print_heap_sects): Print
GC_unmapped_bytes value to log if USE_MUNMAP.

12 years agoCode refactoring of GC_finish_collection (eliminate code duplication
Ivan Maidanski [Fri, 27 Jan 2012 05:46:55 +0000 (09:46 +0400)]
Code refactoring of GC_finish_collection (eliminate code duplication
via COMMA_IF_USE_MUNMAP new macro)

* alloc.c (IF_USE_MUNMAP, COMMA_IF_USE_MUNMAP): New macro (defined
conditionally based on USE_MUNMAP).
* alloc.c (GC_finish_collection): Eliminate code duplication via
[COMMA_]IF_USE_MUNMAP macro.
* alloc.c (GC_try_to_collect_general): Use IF_USE_MUNMAP instead of
ifdef USE_MUNMAP.

12 years agoFix GC_init_linux_data_start to set GC_data_start to valid address
Ivan Maidanski [Fri, 27 Jan 2012 05:40:15 +0000 (09:40 +0400)]
Fix GC_init_linux_data_start to set GC_data_start to valid address
even if GC_no_dls
(fix commit db0da19)

* os_dep.c (GC_init_linux_data_start): Test GC_no_dls only to avoid
GC_find_limit call; initialize GC_data_start to DATAEND in case of
GC_no_dls to make data root empty (to prevent incorrect argument
passed to GC_add_roots_inner call in GC_register_data_segments).
* os_dep.c (GC_register_data_segments): Do not invoke
GC_add_roots_inner if upper bound (obtained from sbrk) is not upper
than DATASTART (e.g., if the latter is set to DATAEND on GC_no_dls).

12 years agoUpdate ChangeLog
Ivan Maidanski [Thu, 26 Jan 2012 17:31:37 +0000 (21:31 +0400)]
Update ChangeLog

12 years agoFix static data roots registration on Android (if GC is shared
Ivan Maidanski [Thu, 26 Jan 2012 16:36:57 +0000 (20:36 +0400)]
Fix static data roots registration on Android (if GC is shared
library) by defining GC_INIT_CONF_ROOTS

* include/gc.h (GC_INIT_CONF_ROOTS): Define to register static data
root in range from "__data_start" to "_end" on Android (unless
explicitly prohibited by client via GC_NOT_DLL macro) since the client
data root is not registered automatically if GC is build as a shared
library.
* tests/test.c (GC_COND_INIT): Invoke GC_INIT also on Android.

12 years agoFix gcconfig.h to define USE_GET_STACKBASE_FOR_MAIN for Android
Ivan Maidanski [Thu, 26 Jan 2012 05:16:10 +0000 (09:16 +0400)]
Fix gcconfig.h to define USE_GET_STACKBASE_FOR_MAIN for Android
(causing pthread_attr_getstack to be used to get main stack base
even in single-threaded mode instead of GC_linux_main_stack_base)

* include/private/gcconfig.h (USE_GET_STACKBASE_FOR_MAIN): Define if
PLATFORM_ANDROID.

12 years agoAdd debug logging on data roots addition or removal (enabled by
Ivan Maidanski [Thu, 26 Jan 2012 05:13:48 +0000 (09:13 +0400)]
Add debug logging on data roots addition or removal (enabled by
DEBUG_ADD_DEL_ROOTS new macro)

* mark_rts.c (GC_add_roots_inner): Debug logging at adding new entry
to GC_static_roots (only if DEBUG_ADD_DEL_ROOTS).
* mark_rts.c (GC_clear_roots, GC_remove_root_at_pos): Add debug
logging (only if DEBUG_ADD_DEL_ROOTS).

12 years agoAdjust OK_DISCLAIM_INITZ definition
Ivan Maidanski [Thu, 26 Jan 2012 04:44:15 +0000 (08:44 +0400)]
Adjust OK_DISCLAIM_INITZ definition

* include/private/gc_priv.h (OK_DISCLAIM_INITZ): Replace NULL with
0 for function pointer (in case of ENABLE_DISCLAIM).

12 years agoFix GC_add_roots_inner for Mac OS X (enable GC_dyld_image_add to
Daniel R. Grayson [Thu, 26 Jan 2012 04:42:33 +0000 (08:42 +0400)]
Fix GC_add_roots_inner for Mac OS X (enable GC_dyld_image_add to
pass unaligned segment start to GC_add_roots)

* mark_rts.c (GC_add_roots_inner): Round "b" pointer up to word
boundary.
* include/gc.h (GC_add_roots): Update the comment.

12 years agoRemove closure data from GC_register_disclaim_proc.
Petter Urkedal [Wed, 25 Jan 2012 19:30:02 +0000 (03:30 +0800)]
Remove closure data from GC_register_disclaim_proc.

* include/gc_disclaim.h, fnlz_mlc.c (GC_disclaim_proc, GC_register_disclaim_proc):
Remove CD from typedef and function.
* reclaim.c (GC_reclaim_uninit, GC_reclaim_block): Adjust calls.
* include/private/gc_priv.h, misc.c: Remove CD from object kind struct and
initializers.

12 years agoRemove Android-specific code inside Solaris-specific code in dyn_load
Ivan Maidanski [Wed, 25 Jan 2012 15:18:39 +0000 (19:18 +0400)]
Remove Android-specific code inside Solaris-specific code in dyn_load

* dyn_load.c (GC_register_dynamic_libraries): Remove PLATFORM_ANDROID
macro check from Solaris-specific code.

12 years agoMove GC_register_disclaim_proc to fnlz_mlc
Ivan Maidanski [Wed, 25 Jan 2012 15:12:36 +0000 (19:12 +0400)]
Move GC_register_disclaim_proc to fnlz_mlc

* misc.c (GC_register_disclaim_proc): Move definition to fnlz_mlc.c
(to minimize linked code size in case "disclaim" finalization is
unused).
* misc.c: Do not include gc_disclaim.h.
* fnlz_mlc.c (GC_register_disclaim_proc): Add GC_ASSERT for kind
passed by the client.

12 years agoCode refactoring of GC_init_real_syms (GC_USE_DLOPEN_WRAP case)
Ivan Maidanski [Wed, 25 Jan 2012 15:01:02 +0000 (19:01 +0400)]
Code refactoring of GC_init_real_syms (GC_USE_DLOPEN_WRAP case)

* pthread_support.c (GC_init_real_syms): Remove LIBPTHREAD_NAME,
LIBPTHREAD_NAME_LEN, len, namebuf, libpthread_name and simplify the
code invoking dlopen (if RTLD_NEXT not defined).

12 years agoWorkaround some Linux/arm kernels bug to get correct GC_nprocs value
Ivan Maidanski [Tue, 24 Jan 2012 15:31:53 +0000 (19:31 +0400)]
Workaround some Linux/arm kernels bug to get correct GC_nprocs value

* pthread_support.c (STAT_READ, STAT_BUF_SIZE): Move the definition
out of PLATFORM_ANDROID condition.
* pthread_support.c (GC_get_nprocs_present): New static function
obtaining number of avalable CPUs from
"/sys/devices/system/cpu/present" (only Linux/arm excluding NaCl).
* pthread_support.c (GC_thr_init): Invoke GC_get_nprocs_present
(unless set from the environment variable) to workaround a bug in
some Linux/arm kernels (including Android).

12 years agoFix GC_get_nprocs (Linux) returned variable type
Ivan Maidanski [Tue, 24 Jan 2012 04:39:47 +0000 (08:39 +0400)]
Fix GC_get_nprocs (Linux) returned variable type

* pthread_support.c (GC_get_nprocs): Change "result" local variable
type to int from word (to match returned value type); remove redundant
cast; initialize "result" variable just before its use.

12 years ago.gitignore: Add gc.log
Ivan Maidanski [Tue, 24 Jan 2012 04:23:17 +0000 (08:23 +0400)]
.gitignore: Add gc.log

12 years agoRecognize GC_LOG_TO_FILE_ALWAYS macro to log to 'gc.log' by default
Ivan Maidanski [Tue, 24 Jan 2012 04:22:01 +0000 (08:22 +0400)]
Recognize GC_LOG_TO_FILE_ALWAYS macro to log to 'gc.log' by default

* misc.c (GC_init): If "GC_LOG_FILE" environment variable is unset and
GC_LOG_TO_FILE_ALWAYS macro defined then open "gc.log" file for GC
logging (only Unix and Cygwin).

12 years agoEnable GC_MIN_MARKERS to set minimal number of pthread-based markers
Ivan Maidanski [Tue, 24 Jan 2012 04:16:14 +0000 (08:16 +0400)]
Enable GC_MIN_MARKERS to set minimal number of pthread-based markers

* pthread_support.c (GC_thr_init): Allow to specify GC_markers
minimum value (by GC_MIN_MARKERS).

12 years agoPrevent 'unused var' warnings and adjust ABORT message in GC_DllMain
Ivan Maidanski [Mon, 23 Jan 2012 18:23:39 +0000 (22:23 +0400)]
Prevent 'unused var' warnings and adjust ABORT message in GC_DllMain

* win32_threads.c (GC_DllMain): Do not declare "sb" and "sb_result"
local variables if unused.
* win32_threads (GC_DllMain): Remove redundant test for
THREAD_LOCAL_ALLOC (since it is always off if GC_NO_THREADS_DISCOVERY);
adjust ABORT message (for DLL_PROCESS_ATTACH case if PARALLEL_MARK).

12 years agoUpdate TODO file
Ivan Maidanski [Mon, 23 Jan 2012 17:48:54 +0000 (21:48 +0400)]
Update TODO file

12 years agoUpdate ChangeLog
Ivan Maidanski [Mon, 23 Jan 2012 17:26:29 +0000 (21:26 +0400)]
Update ChangeLog

12 years agoIntegrate ancient 'pcbeard' GC port for MacOS 9 Classic
Patrick C. Beard [Mon, 23 Jan 2012 17:21:48 +0000 (21:21 +0400)]
Integrate ancient 'pcbeard' GC port for MacOS 9 Classic

* include/private/gc_priv.h (bcopy, bzero, BCOPY_EXISTS): Add
definition for ancient MacOS/ppc.
* mach_dep.c (PushMacRegisters): Add implementation for MacOS/ppc.
* mach_dep.c (GC_push_regs): Fix to work on MacOS/ppc.

12 years agoRemove unused USE_GENERIC_PUSH_REGS macro (avr32)
Ivan Maidanski [Mon, 23 Jan 2012 16:58:01 +0000 (20:58 +0400)]
Remove unused USE_GENERIC_PUSH_REGS macro (avr32)

* include/private/gcconfig.h (USE_GENERIC_PUSH_REGS): Remove.

12 years agoconfigure: Enable parallel mark by default (only Linux, Solaris,
Ivan Maidanski [Mon, 23 Jan 2012 16:38:03 +0000 (20:38 +0400)]
configure: Enable parallel mark by default (only Linux, Solaris,
Darwin, Win32)