Ivan Maidanski [Sun, 26 Feb 2012 15:55:56 +0000 (19:55 +0400)]
Fix fork() handling on Cygwin (update child thread Id properly and
update child thread-local storage pointer)
* win32_threads.c (GC_remove_all_threads_but_me): Update comment;
re-hash GC_threads map as thread Win32 Id in the child differs from
that in the parent; rename "id" local variable to "pthread_id".
* win32_threads.c (GC_remove_all_threads_but_me): Call
GC_setspecific (if THREAD_LOCAL_ALLOC) to re-assign Win32-based
thread-local pointer to 'tlfs' (identified by GC_thread_key) of the
current thread.
Ivan Maidanski [Sun, 26 Feb 2012 15:36:11 +0000 (19:36 +0400)]
Fix GC_remove_all_threads_but_me for fork-unfriendly TLS implementations
* pthread_support.c (GC_remove_all_threads_but_me): Refine comment for
stop_info.mach_thread update.
* pthread_support.c (GC_remove_all_threads_but_me): Call
GC_setspecific (if THREAD_LOCAL_ALLOC) to re-assign thread-local
pointer to 'tlfs' (identified by GC_thread_key) of the current thread
(except for USE_CUSTOM_SPECIFIC).
Ivan Maidanski [Sun, 26 Feb 2012 15:16:37 +0000 (19:16 +0400)]
Remove unused DCL_LOCK_STATE in GC_free_inner
* malloc.c (GC_free_inner): Remove unused DCL_LOCK_STATE.
Ivan Maidanski [Sat, 25 Feb 2012 18:57:58 +0000 (22:57 +0400)]
Code refactoring of GC_destroy_thread_local (move assertion on 'tlfs'
out of function since otherwise assertion is skipped if HANDLE_FORK)
* pthread_support.c (GC_unregister_my_thread_inner): Add assertion on
"tlfs" value before GC_destroy_thread_local() invocation.
* win32_threads.c (GC_unregister_my_thread, GC_thread_exit_proc):
Likewise.
* thread_local_alloc.c (GC_destroy_thread_local): Remove assertion on
"tlfs" value (since it was skipped if HANDLE_FORK because of the
function invocation from GC_remove_all_threads_but_me).
Ivan Maidanski [Sat, 25 Feb 2012 16:56:28 +0000 (20:56 +0400)]
configure: Remove unused AM conditionals
* CMakeLists.txt: Remove FIXME for openbsd_threads and
ENABLE_GCJ_SUPPORT.
* configure.ac (openbsd_threads): Remove unused variable.
* configure.ac (OPENBSD_THREADS, ENABLE_GCJ_SUPPORT): Remove unused
AM conditional definition.
Ivan Maidanski [Sat, 25 Feb 2012 16:51:20 +0000 (20:51 +0400)]
Fix configure to compile win32_threads.c for MinGW pthreads-w32 target
* configure.ac (win32_threads): Set variable for "mingw" target
(causing definition of "WIN32_THREADS" AM conditional which, in turn,
causes win32_threads.c to be compiled and put to libgc.a).
Ivan Maidanski [Sat, 25 Feb 2012 10:59:05 +0000 (14:59 +0400)]
Fix SIG_SUSPEND definition (Win32)
* include/private/gc_priv.h (SIG_SUSPEND): Do not define for Cygwin
and pthreads-w32 (since signals are not used for threads
suspend/resume).
Ivan Maidanski [Sat, 25 Feb 2012 10:52:12 +0000 (14:52 +0400)]
.gitignore: Add 'pthreads-w32' external library
Ivan Maidanski [Fri, 24 Feb 2012 15:25:22 +0000 (19:25 +0400)]
Update TODO file (add TODO tasks regarding HANDLE_FORK)
Ivan Maidanski [Fri, 24 Feb 2012 15:18:18 +0000 (19:18 +0400)]
Update ChangeLog
Ivan Maidanski [Fri, 24 Feb 2012 10:34:34 +0000 (14:34 +0400)]
Fix Cygwin support to handle fork() properly
* include/private/gcconfig.h (HANDLE_FORK): Define also for Cygwin
(but not for win32-pthreads and not if Win32 memory allocation used).
* win32_threads.c: Include unistd.h if HANDLE_FORK (for
pthread_atfork).
* win32_threads.c (GC_wait_for_gc_completion): Add wait_for_all
argument.
* win32_threads.c (GC_unregister_my_thread, GC_thread_exit_proc): Pass
FALSE ("wait_for_all" argument) to GC_wait_for_gc_completion.
* win32_threads.c (GC_remove_all_threads_but_me, GC_fork_prepare_proc,
GC_fork_parent_proc, GC_fork_child_proc): New functions (similar to
that in pthread_support.c) if HANDLE_FORK.
* win32_threads.c (GC_thr_init): Invoke pthread_atfork if HANDLE_FORK.
Ivan Maidanski [Fri, 24 Feb 2012 07:29:48 +0000 (11:29 +0400)]
Fix fork() handling for Darwin partially
(still not handled well for Darwin if GC incremental mode is on)
* os_dep.c (GC_dirty_init): Add FIXME regarding fork (Darwin).
* pthread_support.c (GC_remove_all_threads_but_me): Update mach_thread
for "me" (Darwin).
* pthread_support.c (GC_fork_prepare_proc): Output warning if
GC_dirty_maintained (if DARWIN and MPROTECT_VDB).
* pthread_support.c (GC_fork_prepare_proc, GC_fork_child_proc): Add
FIXME (for Darwin).
* tests/test.c (run_one_test): Do not test fork() for Darwin with
incremental mode on (if HANDLE_FORK); add FIXME.
Ivan Maidanski [Tue, 21 Feb 2012 18:06:11 +0000 (22:06 +0400)]
Update ChangeLog
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.
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).
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.
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).
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.
Ivan Maidanski [Mon, 20 Feb 2012 04:44:03 +0000 (08:44 +0400)]
Simplify autogen.sh by using autoreconf
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).
Ivan Maidanski [Thu, 16 Feb 2012 21:30:46 +0000 (01:30 +0400)]
Update ChangeLog
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.
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.
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.
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.
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.
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.
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.
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.
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
Bruce Mitchener [Thu, 16 Feb 2012 03:47:39 +0000 (10:47 +0700)]
Check for automake / aclocal 1.11 as well.
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).
Ivan Maidanski [Tue, 14 Feb 2012 15:45:47 +0000 (19:45 +0400)]
Update ChangeLog
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.
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.
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).
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.
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.
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.
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.
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).
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.
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).
Ivan Maidanski [Thu, 9 Feb 2012 16:27:45 +0000 (20:27 +0400)]
Update TODO (failure in Cygwin resolved)
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.
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.
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.
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.
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.
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).
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.
Ivan Maidanski [Fri, 3 Feb 2012 17:19:46 +0000 (21:19 +0400)]
Update ChangeLog
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).
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.
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).
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+).
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+).
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+.
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.
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.
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).
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.
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).
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.
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.
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.
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.
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".
Ivan Maidanski [Tue, 31 Jan 2012 04:43:55 +0000 (08:43 +0400)]
Update ChangeLog
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.
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.
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).
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.
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.
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.
Ivan Maidanski [Sun, 29 Jan 2012 19:09:43 +0000 (23:09 +0400)]
Update TODO file
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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).
Ivan Maidanski [Thu, 26 Jan 2012 17:31:37 +0000 (21:31 +0400)]
Update ChangeLog
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.
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.
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).
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).
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.
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.
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.
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.