platform/upstream/libgc.git
12 years agoFix calloc() overflow
Xi Wang [Wed, 14 Mar 2012 20:46:49 +0000 (04:46 +0800)]
Fix calloc() overflow

* malloc.c (calloc): Check multiplication overflow in calloc(),
assuming REDIRECT_MALLOC.

12 years agoUpdate ChangeLog
Ivan Maidanski [Thu, 8 Mar 2012 07:10:28 +0000 (11:10 +0400)]
Update ChangeLog

12 years agoFix configure enabling 'make check' with C++ support for Cygwin/MinGW
Ivan Maidanski [Tue, 6 Mar 2012 19:33:39 +0000 (23:33 +0400)]
Fix configure enabling 'make check' with C++ support for Cygwin/MinGW

* configure.ac (CXXLIBS): New variable; set it to "-lsupc++" for
Cygwin and MinGW if enable_cplusplus and the library is available.
* tests/tests.am (test_cpp_LDADD): Use "CXXLIBS" variable.

12 years agoUpdate ChangeLog
Ivan Maidanski [Tue, 6 Mar 2012 18:19:41 +0000 (22:19 +0400)]
Update ChangeLog

12 years agoDefine GC_DLL if DLL_EXPORT at GC build
Kai Tietz [Fri, 10 Feb 2012 16:30:47 +0000 (16:30 +0000)]
Define GC_DLL if DLL_EXPORT at GC build
(Apply part of commit 6488760 from 'gcc_boehmgc' branch.)

* include/gc_config_macros.h (GC_DLL): Define if we are actually in GC
build and DLL_EXPORT is defined (unless prohibited by GC_NOT_DLL)
preventing GC internal symbols exporting on Cygwin and MinGW.

12 years agoFix gctest (for Win32) to avoid GC_print_stats internal variable usage
Ivan Maidanski [Tue, 6 Mar 2012 16:26:24 +0000 (20:26 +0400)]
Fix gctest (for Win32) to avoid GC_print_stats internal variable usage

* include/private/gc_priv.h (GC_print_stats): Update the comment.
* tests/test.c (GC_print_stats, run_one_test, check_heap_stats):
Rename GC_print_stats to print_stats (since the former is used
internally by GC and not exported).
* tests/test.c (print_stats): Always define (either as a macro or
a static int variable) regardless of GC_DLL and SMALL_CONFIG.
* tests/test.c (INIT_PRINT_STATS): New macro (used to initialize
print_stats if needed); GETENV is used if needed and available.
* tests/test.c (GC_COND_INIT): Invoke INIT_PRINT_STATS.

12 years agoFix GC_READ_ENV_FILE code for Cygwin
Ivan Maidanski [Tue, 6 Mar 2012 16:10:11 +0000 (20:10 +0400)]
Fix GC_READ_ENV_FILE code for Cygwin

* misc.c: Include windows.h for Cygwin if GC_READ_ENV_FILE (required
for GC_envfile_init).
* misc.c (_MAX_PATH): Move definition to the place before the first
use (only Win32).

12 years agoUpdate ChangeLog
Ivan Maidanski [Mon, 5 Mar 2012 18:11:20 +0000 (22:11 +0400)]
Update ChangeLog

12 years agoconfigure: Require automake 2.61 instead of 2.63
Ivan Maidanski [Mon, 5 Mar 2012 17:16:21 +0000 (21:16 +0400)]
configure: Require automake 2.61 instead of 2.63

* configure.ac (AC_PREREQ): Use value of 2.63 (relax requirement to
enable autoreconf on current Mac OS X).

12 years agoUpdate AUTHORS file
Ivan Maidanski [Mon, 5 Mar 2012 15:57:35 +0000 (19:57 +0400)]
Update AUTHORS file

12 years agoupdate ChangeLog
Ivan Maidanski [Mon, 5 Mar 2012 04:19:05 +0000 (08:19 +0400)]
update ChangeLog

12 years agoReplace pointer relational comparisons with non-pointer ones
Ivan Maidanski [Mon, 5 Mar 2012 04:08:31 +0000 (08:08 +0400)]
Replace pointer relational comparisons with non-pointer ones

* allchblk.c (GC_dump_regions, GC_allochblk_nth): Cast pointers to
word type in relational (less-greater) comparisons.
* alloc.c (GC_add_to_heap, GC_print_heap_sects, GC_expand_hp_inner):
Likewise.
* backgraph.c (ensure_struct, add_back_edges): Likewise.
* blacklst.c (GC_number_stack_black_listed): Likewise.
* checksums.c (GC_checksum, GC_check_dirty): Likewise.
* darwin_stop_world.c (GC_push_all_stacks): Likewise.
* dbg_mlc.c (GC_get_back_ptr_info, GC_print_smashed_obj,
GC_check_heap_block): Likewise.
* dyn_load.c (sort_heap_sects, GC_register_map_entries,
GC_register_dynlib_callback,
GC_register_dynamic_libraries_dl_iterate_phdr,
GC_register_dynamic_libraries, GC_cond_add_roots): Likewise.
* finalize.c (GC_ignore_self_finalize_mark_proc): Likewise.
* headers.c (GC_scratch_alloc, GC_install_counts, GC_remove_counts):
Likewise.
* include/private/gc_pmark.h (PUSH_OBJ, PUsH_CONTENTS_HDR,
GC_PUSH_ONE_STACK, GC_PUSH_ONE_HEAP, GC_mark_stack_empty): Likewise.
* include/private/gc_priv.h (MAKE_COOLER, COOLER_THAN): Likewise.
* mach_dep.c (GC_with_callee_saves_pushed): Likewise.
* malloc.c (calloc, free): Likewise.
* mark.c (GC_mark_some_inner, GC_mark_from, GC_steal_mark_stack,
GC_return_mark_stack, GC_do_local_mark, GC_mark_local, GC_push_all,
GC_push_selected, GC_push_all_eager, GC_push_marked1, GC_push_marked2,
GC_push_marked4, GC_push_marked, GC_push_unconditionally): Likewise.
* mark_rts.c (GC_is_static_root, GC_add_roots_inner,
GC_remove_roots_inner, GC_is_tmp_root, GC_exclude_static_roots_inner,
GC_push_conditional_with_exclusions, GC_push_all_register_sections,
GC_push_all_stack_sections, GC_push_all_stack_partially_eager,
GC_push_all_stack_part_eager_sections, GC_push_current_stack):
Likewise.
* misc.c (GC_clear_stack_inner, GC_clear_stack, GC_base,
GC_call_with_gc_active): Likewise.
* new_hblk.c (GC_build_fl_clear2, GC_build_fl_clear4,  GC_build_fl2,
GC_build_fl4, GC_build_fl): Likewise.
* os_dep.c (GC_enclosing_mapping, GC_text_mapping, tiny_sbrk,
GC_find_limit_openbsd, GC_skip_hole_openbsd, GC_find_limit_with_bound,
GC_get_main_stack_base, GC_get_stack_base, GC_least_described_address,
GC_register_root_section, GC_register_data_segments, GC_unmap_start,
GC_gww_read_dirty, GC_remove_protection, GC_protect_heap,
GC_unprotect_range, GC_read_dirty, GC_page_was_dirty,
GC_save_callers, GC_print_callers): Likewise.
* pcr_interface.c (GC_enumerate_block): Likewise.
* pthread_support.c (GC_is_thread_tsd_valid,
GC_segment_is_thread_stack, GC_greatest_stack_base_below,
GC_call_with_gc_active): Likewise.
* ptr_chck.c (GC_same_obj, GC_is_valid_displacement, GC_on_stack,
GC_is_visible): Likewise.
* reclaim.c (GC_reclaim_clear, GC_reclaim_uninit,
GC_disclaim_and_reclaim, GC_reclaim_check, GC_start_reclaim):
Likewise.
* tests/test.c (cons): Likewise.
* tools/setjmp_t.c (main): Likewise.
* typd_mlc.c (GC_typed_mark_proc): Likewise.
* win32_threads.c (GC_is_thread_tsd_valid, GC_call_with_gc_active,
GC_push_stack_for, GC_get_next_stack): Likewise.
* extra/msvc_dbg.c (GetDescriptionFromAddress,
GetDescriptionFromStack): Cast pointers to GC_ULONG_PTR in relational
comparisons.
* include/gc.h (GC_DATASTART, GC_DATAEND): Cast pointers to GC_word in
relational comparisons.
* misc.c (GC_init): Remove static assertion on ((ptr_t)-1 > 0) since
no longer required; add the comment.
* pcr_interface.c: Expand tabs to spaces.

12 years agoFix DATASTART (and other minor improvements) for NaCl target
Elijah Taylor [Tue, 9 Aug 2011 20:03:46 +0000 (22:03 +0200)]
Fix DATASTART (and other minor improvements) for NaCl target

* include/private/gcconfig.h (DATASTART): Define to a fixed address
for NaCl.
* pthread_stop_world.c (GC_suspend_all): Issue GC warning if it
appears stalled waiting for some threads to park (NaCl only).
* pthread_stop_world.c (nacl_register_gc_hooks): Declare external
function (available from NaCl runtime).
* pthread_stop_world.c (GC_nacl_initialize_gc_thread): Invoke
nacl_register_gc_hooks registring nacl_pre_syscall_hook and
nacl_post_syscall_hook (NaCl only).

12 years agoMake __data_start a weak symbol to allow loading modules on mips
Paolo Molaro [Tue, 13 Dec 2011 15:35:10 +0000 (15:35 +0000)]
Make __data_start a weak symbol to allow loading modules on mips

* include/private/gcconfig.h (__data_start): Add "pragma weak" for
MIPS target (to allow loading modules).

12 years agotests: Fix subthread_create.c by defining AO_REQUIRE_CAS
Ivan Maidanski [Sun, 4 Mar 2012 10:20:10 +0000 (14:20 +0400)]
tests: Fix subthread_create.c by defining AO_REQUIRE_CAS

* subthread_create.c (AO_REQUIRE_CAS): Define in case of PARALLEL_MARK
(guaranteeing AO_fetch_and_add to be defined at least if GC is built
with parallel marking enabled).

12 years agotests: Minor code refactoring of disclaim_bench and subthread_create
Ivan Maidanski [Sun, 4 Mar 2012 09:56:29 +0000 (13:56 +0400)]
tests: Minor code refactoring of disclaim_bench and subthread_create

* disclaim_bench.c: Remove unused include of atomic_ops.h.
* subthread_create.c: Use include "atomic_ops.h" instead of
include <atomic_ops.h>.

12 years agotools: Prevent compiler warnings regarding unused argument and printf
Ivan Maidanski [Wed, 29 Feb 2012 17:40:53 +0000 (21:40 +0400)]
tools: Prevent compiler warnings regarding unused argument and printf

* tools/if_mach.c (main): Remove unused "envp" argument.
* tools/if_not_there.c (main): Likewise.
* tools/if_mach.c: Expand tabs to spaces.
* tools/if_not_there.c: Likewise.
* tools/setjmp_t.c (getpagesize): Define for Win32; include windows.h.
* tools/setjmp_t.c (main): Make printf() format specifier string
non-empty (to suppress compiler warning).
* tools/setjmp_t.c (main): Adjust printf() format specifier for WORDSZ
value (unsigned long instead of int).

12 years agotools: Change some functions declaration style from K-R to ANSI C
Ivan Maidanski [Wed, 29 Feb 2012 04:39:50 +0000 (08:39 +0400)]
tools: Change some functions declaration style from K-R to ANSI C

* tools/add_gc_prefix.c (main): Remove unused "envp" argument.
* tools/add_gc_prefix.c (main): Replace the K&R-style function
definition with the ANSI C one.
* tools/gcname.c (main): Likewise.

12 years agoUpdate ChangeLog
Ivan Maidanski [Mon, 27 Feb 2012 18:06:42 +0000 (22:06 +0400)]
Update ChangeLog

12 years agoFix GC_register_my_thread marking thread as detached (Cygwin/pthreads-w32)
Ivan Maidanski [Mon, 27 Feb 2012 17:49:35 +0000 (21:49 +0400)]
Fix GC_register_my_thread marking thread as detached (Cygwin/pthreads-w32)

* win32_threads.c (GC_register_my_thread): Fix SEGV by setting "me"
to the newly-created thread GC descriptor (if lookup failed) before
altering flags of "me" (only if GC_PTHREADS); add comment (same as
in pthread_support.c).

12 years agoRemove GC_win32_dll_threads checking inside pthread-specific code
Ivan Maidanski [Mon, 27 Feb 2012 17:30:22 +0000 (21:30 +0400)]
Remove GC_win32_dll_threads checking inside pthread-specific code

* win32_threads.c (GC_unregister_my_thread): Remove check for
GC_PTHREADS inside GC_win32_dll_threads (since DllMain-based thread
registration is not supported for pthreads).
* win32_threads.c (GC_pthread_join, GC_pthread_create): Replace check
for non-GC_win32_dll_threads mode with the assertion; move local
variable declarations to function beginning.

12 years agoReport GC_pthread_join/detach failure with appropriate message
Ivan Maidanski [Mon, 27 Feb 2012 16:44:21 +0000 (20:44 +0400)]
Report GC_pthread_join/detach failure with appropriate message

* win32_threads.c (GC_pthread_join): Call GC_lookup_pthread only if
needed (in case of pthreads-w32 target).
* win32_threads.c (GC_pthread_join, GC_pthread_detach): If no thread
is found by GC_lookup_pthread (e.g., the thread has not been created
by GC_pthread_create) then abort with the appropriate message (instead
of null pointer dereference).

12 years agoDelete GC_init_parallel call in some redirected pthread functions (Win32)
Ivan Maidanski [Mon, 27 Feb 2012 16:23:19 +0000 (20:23 +0400)]
Delete GC_init_parallel call in some redirected pthread functions (Win32)

* win32_threads.c (GC_pthread_join, GC_pthread_sigmask,
GC_pthread_detach): Remove useless GC_init_parallel() call (since
parallel_initialized is set either by GC_allow_register_threads or by
redirected pthread_create).

12 years agoSuppress false 'unused argument' warnings for GCC v3
Ivan Maidanski [Mon, 27 Feb 2012 04:37:12 +0000 (08:37 +0400)]
Suppress false 'unused argument' warnings for GCC v3

* cord/cordxtra.c (CORD_ATTR_UNUSED): Use 'unused' attribute starting
from GCC v3.4 (instead of v4.0).
* include/private/gc_priv.h (GC_ATTR_UNUSED): Likewise.

12 years agoconfigure: Allow '--disable-parallel-mark' even if no threads
Ivan Maidanski [Mon, 27 Feb 2012 04:15:01 +0000 (08:15 +0400)]
configure: Allow '--disable-parallel-mark' even if no threads

* configure.ac (parallel-mark): Do not report configuration error if
"--disable-parallel-mark" is specified (and threads are not enabled).

12 years agoAdd item to TODO file (test_cpp compilation error if Sun CC used)
Ivan Maidanski [Mon, 27 Feb 2012 04:11:57 +0000 (08:11 +0400)]
Add item to TODO file (test_cpp compilation error if Sun CC used)

12 years agoFix 'volatile' keyword placement in GC_SysVGetDataStart
Ivan Maidanski [Mon, 27 Feb 2012 04:03:14 +0000 (08:03 +0400)]
Fix 'volatile' keyword placement in GC_SysVGetDataStart

* os_dep.c (GC_SysVGetDataStart): Place "volatile" keyword for
"result" local variable properly.

12 years agoconfigure: Enable PARALLEL_MARK and THREAD_LOCAL_ALLOC for FreeBSD
Ivan Maidanski [Mon, 27 Feb 2012 03:55:29 +0000 (07:55 +0400)]
configure: Enable PARALLEL_MARK and THREAD_LOCAL_ALLOC for FreeBSD

* configure.ac (PARALLEL_MARK): Define for freebsd if
enable_parallel_mark is yes.
* configure.ac (THREAD_LOCAL_ALLOC): Always define for freebsd (if
posix threads).

12 years agoAdd item to TODO file (failure on Cygwin)
Ivan Maidanski [Sun, 26 Feb 2012 17:16:04 +0000 (21:16 +0400)]
Add item to TODO file (failure on Cygwin)

12 years agoFix fork() handling on Cygwin (update child thread Id properly and
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.

12 years agoFix GC_remove_all_threads_but_me for fork-unfriendly TLS implementations
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).

12 years agoRemove unused DCL_LOCK_STATE in GC_free_inner
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.

12 years agoCode refactoring of GC_destroy_thread_local (move assertion on 'tlfs'
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).

12 years agoconfigure: Remove unused AM conditionals
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.

12 years agoFix configure to compile win32_threads.c for MinGW pthreads-w32 target
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).

12 years agoFix SIG_SUSPEND definition (Win32)
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).

12 years ago.gitignore: Add 'pthreads-w32' external library
Ivan Maidanski [Sat, 25 Feb 2012 10:52:12 +0000 (14:52 +0400)]
.gitignore: Add 'pthreads-w32' external library

12 years agoUpdate TODO file (add TODO tasks regarding HANDLE_FORK)
Ivan Maidanski [Fri, 24 Feb 2012 15:25:22 +0000 (19:25 +0400)]
Update TODO file (add TODO tasks regarding HANDLE_FORK)

12 years agoUpdate ChangeLog
Ivan Maidanski [Fri, 24 Feb 2012 15:18:18 +0000 (19:18 +0400)]
Update ChangeLog

12 years agoFix Cygwin support to handle fork() properly
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.

12 years agoFix fork() handling for Darwin partially
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.

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.