platform/upstream/libgc.git
12 years agoAdd assertion in GC_getspecific on qtid
Ivan Maidanski [Sat, 21 Apr 2012 19:51:41 +0000 (23:51 +0400)]
Add assertion in GC_getspecific on qtid

* include/private/specific.h (GC_getspecific): Add assertion on "qtid"
value.

12 years agoCode refactoring of specific.c and specific.h;
Ivan Maidanski [Sat, 21 Apr 2012 19:44:19 +0000 (23:44 +0400)]
Code refactoring of specific.c and specific.h;
cast pointers to word instead of unsigned long

* include/private/specific.h (CACHE_HASH, HASH): Add parentheses
around the argument.
* include/private/specific.h (CACHE_HASH): Remove unnecessary cast to
long.
* include/private/specific.h (HASH): Rename "n" argument to "p";
cast "p" to word instead of long; cast result to unsigned.
* include/private/specific.h (quick_thread_id, INVALID_QTID): Cast to
word instead of unsigned long.
* specific.c (GC_key_create_inner): Cast invalid_tse.next (pointer) to
word instead of unsigned long.
* include/private/specific.h (GC_slow_getspecific, GC_getspecific):
Change type of "qtid" from unsigned long to word.
* specific.c (GC_slow_getspecific): Likewise.
* include/private/specific.h (GC_getspecific): Remove "hash_val"
local variable.
* specific.c: Do not include gc_priv.h as included from
thread_local_alloc.h; do not include atomic_ops.h as included from
specific.h file.

12 years agoFix USE_CUSTOM_SPECIFIC mode (if manually enabled) for Win32
Ivan Maidanski [Sat, 21 Apr 2012 16:18:55 +0000 (20:18 +0400)]
Fix USE_CUSTOM_SPECIFIC mode (if manually enabled) for Win32

* win32_threads.c (GC_unregister_my_thread,
GC_remove_all_threads_but_me, GC_thread_exit_proc): Invoke
GC_remove_specific (if THREAD_LOCAL_ALLOC) after destroying
thread-local list (same as in pthread_support.c).

12 years agoFix GC_remove_all_threads_but_me to cleanup thread-specific data storage
Ivan Maidanski [Sat, 21 Apr 2012 15:57:25 +0000 (19:57 +0400)]
Fix GC_remove_all_threads_but_me to cleanup thread-specific data storage

* pthread_support.c (GC_remove_all_threads_but_me): Call
GC_remove_specific after destroying thread-local list.

12 years agoCode refactoring of GC_check_tls_for/GC_check_fl_marks
Ivan Maidanski [Fri, 20 Apr 2012 05:12:47 +0000 (09:12 +0400)]
Code refactoring of GC_check_tls_for/GC_check_fl_marks

* alloc.c (GC_check_fl_marks): Change prototype (pass pointer to
"freelist" element instead of value); do not define the function if
THREAD_LOCAL_ALLOC undefined.
* include/private/gc_priv.h (GC_check_fl_marks): Likewise.
* alloc.c (GC_check_fl_marks): Skip check if the argument points to
a special (non-pointer) value; update comment; rename "q" local
variable to "list".
* thread_local_alloc.c (GC_check_tls_for): Update code according to
GC_check_fl_marks functionality change (remove checks for special
value).

12 years agoCode refactoring of GC_generic_malloc_inner (eliminate recursion)
Ivan Maidanski [Fri, 20 Apr 2012 04:53:46 +0000 (08:53 +0400)]
Code refactoring of GC_generic_malloc_inner (eliminate recursion)

* malloc.c (GC_generic_malloc_inner): Update "lg" value after GC_init
and GC_extend_size_map calls; add assertion on "lg" value after
GC_extend_size_map call; update "opp" and "op" values and retry
allocation instead of recursive call; replace "goto" with return
(remove "out" label).

12 years agoUpdate AUTHORS file
Ivan Maidanski [Tue, 17 Apr 2012 04:04:47 +0000 (08:04 +0400)]
Update AUTHORS file

12 years agoMinor code refactoring regarding HAVE_BUILTIN_UNWIND_INIT
Ivan Maidanski [Tue, 17 Apr 2012 03:52:08 +0000 (07:52 +0400)]
Minor code refactoring regarding HAVE_BUILTIN_UNWIND_INIT

* include/private/gcconfig.h (HAVE_BUILTIN_UNWIND_INIT): Do not define
for Darwin/ppc and RTEMS.
* mach_dep.c (GC_with_callee_saves_pushed): Remove target-specific
checks for Darwin/ppc and RTEMS as HAVE_BUILTIN_UNWIND_INIT is not
defined in that case.

12 years agoFix GC_with_callee_saves_pushed for clang (disable __builtin_unwind_init)
Niklas Therning [Tue, 17 Apr 2012 11:38:29 +0000 (15:38 +0400)]
Fix GC_with_callee_saves_pushed for clang (disable __builtin_unwind_init)

* include/private/gcconfig.h (HAVE_BUILTIN_UNWIND_INIT): Do not define
for clang (as __builtin_unwind_init seems to be a no-op in the latest
clang release).

12 years agotests: Fix subthread_create to have PARALLEL_MARK as requested
Ivan Maidanski [Thu, 12 Apr 2012 20:02:47 +0000 (00:02 +0400)]
tests: Fix subthread_create to have PARALLEL_MARK as requested

* tests/subthread_create.c: Include config.h if HAVE_CONFIG_H (to have
PARALLEL_MARK defined if configured so).

12 years agoFix disclaim_test to get GC_PTHREADS macro defined if multi-threaded
Ivan Maidanski [Thu, 12 Apr 2012 19:53:50 +0000 (23:53 +0400)]
Fix disclaim_test to get GC_PTHREADS macro defined if multi-threaded

* tests/disclaim_test.c: Include config.h if HAVE_CONFIG_H to define
GC_PTHREADS (indirectly) if multi-threading is on.

12 years agoRemove redundant check for GC_RTEMS_PTHREADS in gc_config_macros.h
Ivan Maidanski [Thu, 12 Apr 2012 19:49:30 +0000 (23:49 +0400)]
Remove redundant check for GC_RTEMS_PTHREADS in gc_config_macros.h

* include/gc_config_macros.h (GC_PTHREADS): Do not test
GC_RTEMS_PTHREADS macro in case of GC_WIN32_THREADS defined.

12 years agoRemove code duplication in gc_locks.h regarding USE_PTHREAD_LOCKS
Ivan Maidanski [Thu, 12 Apr 2012 19:44:00 +0000 (23:44 +0400)]
Remove code duplication in gc_locks.h regarding USE_PTHREAD_LOCKS

* include/private/gc_locks.h (USE_PTHREAD_LOCKS): Remove code
duplication.

12 years agoFix a typo in comment in pthread_support.h
Ivan Maidanski [Wed, 11 Apr 2012 20:01:55 +0000 (00:01 +0400)]
Fix a typo in comment in pthread_support.h

* include/private/pthread_support.h (DETACHED): Fix a typo in comment.

12 years agoMerge branch 'disclaim-test-add'
Ivan Maidanski [Wed, 11 Apr 2012 19:59:33 +0000 (23:59 +0400)]
Merge branch 'disclaim-test-add'

12 years agoFix a typo in comment inside GC_finalized_malloc
Ivan Maidanski [Wed, 11 Apr 2012 19:56:06 +0000 (23:56 +0400)]
Fix a typo in comment inside GC_finalized_malloc

12 years agoFix bug in finalized allocation.
Petter Urkedal [Wed, 11 Apr 2012 19:11:03 +0000 (21:11 +0200)]
Fix bug in finalized allocation.

* fnlz_mlc.c (GC_register_disclaim_proc): Make sure to re-read our
GC_size_map entry after calling GC_generic_malloc, in case it had to be
extended.

12 years agoImprove disclaim_test to detect bug in fnlz_mlc
Ivan Maidanski [Tue, 10 Apr 2012 04:38:22 +0000 (08:38 +0400)]
Improve disclaim_test to detect bug in fnlz_mlc

* tests/disclaim_test.c (misc_sizes_dct): Add "log_size" local
variable (used for "size" evaluation); add assertion on "log_size"
value.

12 years agoUpdate ChangeLog
Ivan Maidanski [Mon, 9 Apr 2012 04:15:01 +0000 (08:15 +0400)]
Update ChangeLog

12 years agoDo not compile backgraph.c unless configure '--enable-gc-debug'
Ivan Maidanski [Mon, 9 Apr 2012 04:02:42 +0000 (08:02 +0400)]
Do not compile backgraph.c unless configure '--enable-gc-debug'

* Makefile.am (libgc_la_SOURCES): Exclude "backgraph" entry from
unconditional list; add this entry only if MAKE_BACK_GRAPH.
* configure.ac (MAKE_BACK_GRAPH): New AM conditional (defined only if
enable_gc_debug explicitly set to yes).

12 years agoUpdate ChangeLog
Ivan Maidanski [Tue, 3 Apr 2012 04:50:23 +0000 (08:50 +0400)]
Update ChangeLog

12 years agoUpdate TODO file
Ivan Maidanski [Mon, 2 Apr 2012 18:45:21 +0000 (22:45 +0400)]
Update TODO file

12 years agoFIX: Disable incremental mode on Darwin if fork handling requested
Ivan Maidanski [Mon, 2 Apr 2012 18:31:22 +0000 (22:31 +0400)]
FIX: Disable incremental mode on Darwin if fork handling requested

* doc/README.macros (NO_HANDLE_FORK): Replace back with HANDLE_FORK
and update.
* include/private/gcconfig.h (CAN_HANDLE_FORK): Define also for Darwin
in case of MPROTECT_VDB.
* misc.c (GC_set_handle_fork): Handle Darwin properly; add comment.
* os_dep.c (GC_dirty_init): Do not turn on GC_dirty_maintained for
Darwin if GC_handle_fork is on; add comment; remove FIXME.
* pthread_support.c (GC_fork_prepare_proc): Remove WARN for Darwin
(since GC_dirty_maintained is off in that case).
* pthread_support.c (GC_fork_child_proc): Remove comment (for Darwin).

12 years agoAdd public GC_set_handle_fork to control forked child handling support
Ivan Maidanski [Mon, 2 Apr 2012 16:18:12 +0000 (20:18 +0400)]
Add public GC_set_handle_fork to control forked child handling support

* include/gc.h (GC_set_handle_fork): New API function.
* misc.c (GC_set_handle_fork): Likewise.
* include/private/gc_priv.h (GC_handle_fork): New internal variable
declaration (only if CAN_HANDLE_FORK).
* misc.c (GC_handle_fork): New internal variable (defined only if
CAN_HANDLE_FORK); initialize to TRUE if HANDLE_FORK.
* include/private/gcconfig.h (HANDLE_FORK): Replace with
CAN_HANDLE_FORK.
* pthread_support.c (HANDLE_FORK): Likewise.
* win32_threads.c (HANDLE_FORK): Likewise.
* include/private/gcconfig.h (CAN_HANDLE_FORK): Always define macro if
HANDLE_FORK.
* pthread_support.c (GC_thr_init): Replace HANDLE_FORK with
CAN_HANDLE_FORK; call pthread_atfork only if GC_handle_fork; update
the comment.
* win32_threads.c (GC_thr_init): Likewise.
* tests/test.c (NO_TEST_HANDLE_FORK): Define new macro if fork
handling is not supported (or is a no-op) on the target.
* tests/test.c (INIT_FORK_SUPPORT): New macro (invoke
GC_set_handle_fork unless NO_TEST_HANDLE_FORK).
* tests/test.c (GC_OPT_INIT): New macro (defined to GC_INIT or empty).
* tests/test.c (GC_COND_INIT): Use INIT_FORK_SUPPORT and GC_OPT_INIT.
* tests/test.c (run_one_test): Test NO_TEST_HANDLE_FORK (instead of
target-specific macros).
* win32_threads.c (GC_remove_all_threads_but_me, GC_fork_prepare_proc,
GC_fork_parent_proc, GC_fork_child_proc): Do not test GC_PTHREADS.
* configure.ac (HANDLE_FORK, NO_HANDLE_FORK): Update message.

12 years agoRemove redundant public GC_HAVE_GET_HEAP_USAGE_SAFE macro
Ivan Maidanski [Fri, 30 Mar 2012 03:53:06 +0000 (07:53 +0400)]
Remove redundant public GC_HAVE_GET_HEAP_USAGE_SAFE macro

* include/gc.h (GC_HAVE_GET_HEAP_USAGE_SAFE): Remove public HAVE_
macro (since function availability could be determined by autotools);
update the comment.

12 years agoconfigure: add --enable-handle-fork option
Andy Wingo [Tue, 27 Mar 2012 11:20:37 +0000 (13:20 +0200)]
configure: add --enable-handle-fork option

* configure.ac: Add --enable-handle-fork option; if explicitly passed,
enables or disables the pthread_atfork support; if not passed, the
default, as determined by gcconfig.h, is to enable HANDLE_FORK if it
is supported on the target platform.

12 years agodoc: Update README for Solaris regarding multi-threading support
Ivan Maidanski [Wed, 28 Mar 2012 16:17:33 +0000 (20:17 +0400)]
doc: Update README for Solaris regarding multi-threading support

* doc/README.solaris2 (SOLARIS THREADS): Update.
* doc/overview.html: Remove information about Solaris old-style
threads support.

12 years agoFix autogen.sh to prevent reporting success if autoreconf failed
Ivan Maidanski [Wed, 28 Mar 2012 15:16:07 +0000 (19:16 +0400)]
Fix autogen.sh to prevent reporting success if autoreconf failed

* autogen.sh: Add "set -e" command to abort script execution on
autoreconf failure (thus not printing "ready" in that case).

12 years agoFix ChangeLog (regarding autoconf)
Ivan Maidanski [Wed, 28 Mar 2012 04:52:13 +0000 (08:52 +0400)]
Fix ChangeLog (regarding autoconf)

12 years agoFix a typo and improve comment in dyn_load.c (Android)
Ivan Maidanski [Mon, 26 Mar 2012 03:30:07 +0000 (07:30 +0400)]
Fix a typo and improve comment in dyn_load.c (Android)

12 years agoUpdate ChangeLog
Ivan Maidanski [Sun, 25 Mar 2012 08:11:59 +0000 (12:11 +0400)]
Update ChangeLog

12 years agoFix GC_clear_stack declaration and make it public
Ivan Maidanski [Sat, 24 Mar 2012 10:24:27 +0000 (14:24 +0400)]
Fix GC_clear_stack declaration and make it public
(Includes reverting part of commit b2345fb)

* include/gc_mark.h (GC_clear_stack): New API function.
* include/private/gc_priv.h (GC_clear_stack): Remove declaration.
* misc.c (GC_clear_stack): Replace GC_INNER with GC_API; add GC_CALL
calling conventions modifier.

12 years agoReplace GC_ms_entry declaration with opaque definition for public API
Ivan Maidanski [Sun, 25 Mar 2012 07:07:25 +0000 (11:07 +0400)]
Replace GC_ms_entry declaration with opaque definition for public API

* include/gc_mark.h (GC_ms_entry): Define structure as opaque unless
GC_BUILD (otherwise remains as declaration which is defined in
private/gc_pmark.h).

12 years agoFix visibility of some GC internal symbols used by GCJ
Ivan Maidanski [Sun, 25 Mar 2012 06:32:05 +0000 (10:32 +0400)]
Fix visibility of some GC internal symbols used by GCJ
(Includes reverting part of commits 68b9f27, 91d5df5, b2345fb)

* allchblk.c (GC_hblkfreelist, GC_free_bytes): Do not define array as
STATIC again but only if GC_GCJ_SUPPORT (for GNU GCJ client).
* blacklst.c (GC_is_black_listed): Do not define as GC_INNER again
(for GNU GCJ client).
* include/private/gc_priv.h (GC_is_black_listed): Likewise.
* include/private/gc_priv.h (GC_hblkfreelist): Restore removed
declaration (but only if GC_GCJ_SUPPORT).
* reclaim.c (GC_n_set_marks): Do not define as STATIC again (for GCJ);
update the comment.

12 years agoFix HIDE_POINTER definition in gc.h
Ivan Maidanski [Sat, 24 Mar 2012 08:08:45 +0000 (12:08 +0400)]
Fix HIDE_POINTER definition in gc.h
(Revert part of commit 14d2724)

* include/gc.h (HIDE_POINTER): Test GC_I_HIDE_POINTERS macro (as
a synonym to I_HIDE_POINTERS) again (remains for backward
compatibility only).

12 years agoFix gc.h compatibility regression by adding GC_PTR
Ivan Maidanski [Sat, 24 Mar 2012 06:01:22 +0000 (10:01 +0400)]
Fix gc.h compatibility regression by adding GC_PTR
(Revert part of commit e35a417)

* include/gc.h (GC_PTR): Add typedef again (for source-level backward
compatibility useful for clients currently using gcc_boehmgc or
mono_libgc).

12 years agoMove Symbian data-roots-related files to 'extra/symbian' folder
Ivan Maidanski [Wed, 21 Mar 2012 20:48:31 +0000 (00:48 +0400)]
Move Symbian data-roots-related files to 'extra/symbian' folder

* extra/init_global_static_roots.cpp: Move to "extra/symbian" folder.
* extra/global_start.cpp: Likewise.
* extra/global_end.cpp: Likewise.
* Makefile.am (EXTRA_DIST): Update references to moved Symbian files.
* Makefile.direct (OTHER_MAKEFILES): Likewise.

12 years agoMove 'Mac_files' folder to 'extra' one
Ivan Maidanski [Wed, 21 Mar 2012 20:24:02 +0000 (00:24 +0400)]
Move 'Mac_files' folder to 'extra' one

* Mac_files: Move to "extra" folder.
* Makefile.am (EXTRA_DIST): Update references to Mac_files.
* Makefile.direct (OTHER_MAKEFILES): Likewise.
* Makefile.dj (OTHER_MAKEFILES): Likewise.
* doc/README.Mac: Update reference to MacOS_config.h file.

12 years agoUpdate TODO file
Ivan Maidanski [Wed, 21 Mar 2012 15:37:14 +0000 (19:37 +0400)]
Update TODO file

12 years agoMakefile: add Symbian build script files to package
Ivan Maidanski [Wed, 21 Mar 2012 15:36:39 +0000 (19:36 +0400)]
Makefile: add Symbian build script files to package

* Makefile.am (EXTRA_DIST): Add Symbian build/s60v3 script files.
* Makefile.direct (OTHER_FILES): Likewise.

12 years agoMakefile: Add fnlz_mlc.c and gcj_mlc.c to source files list (Symbian)
Ivan Maidanski [Wed, 21 Mar 2012 15:25:12 +0000 (19:25 +0400)]
Makefile: Add fnlz_mlc.c and gcj_mlc.c to source files list (Symbian)

* build/s60v3/libgc.mmp (SOURCE): Add fnlz_mlc.c and gcj_mlc.c files.

12 years agoDummy merge branch 'iphone_libgc_6x'
Ivan Maidanski [Tue, 20 Mar 2012 19:00:57 +0000 (23:00 +0400)]
Dummy merge branch 'iphone_libgc_6x'

12 years agoUpdate ChangeLog and AUTHORS files
Ivan Maidanski [Tue, 20 Mar 2012 18:59:19 +0000 (22:59 +0400)]
Update ChangeLog and AUTHORS files

12 years agoMerge branch 'symbian-port'
Ivan Maidanski [Tue, 20 Mar 2012 18:42:40 +0000 (22:42 +0400)]
Merge branch 'symbian-port'

12 years agoSelect GC_REGISTER_MAIN_STATIC_DATA behavior in build script (Symbian)
Ivan Maidanski [Tue, 20 Mar 2012 18:35:51 +0000 (22:35 +0400)]
Select GC_REGISTER_MAIN_STATIC_DATA behavior in build script (Symbian)

* build/s60v3/libgc.mmp (GC_DONT_REGISTER_MAIN_STATIC_DATA): Define
macro.
* misc.c (GC_REGISTER_MAIN_STATIC_DATA): Do not define specially for
SYMBIAN.

12 years agoMakefile: add Symbian-specific source and README files
Ivan Maidanski [Mon, 19 Mar 2012 17:18:28 +0000 (21:18 +0400)]
Makefile: add Symbian-specific source and README files

* Makefile.am (EXTRA_DIST): Add Symbian C++ files from "extra" folder.
* Makefile.direct (OTHER_MAKEFILES): Likewise.
* Makefile.direct (DOC_FILES): Add Symbian README file.
* doc/doc.am (dist_pkgdata_DATA): Likewise.

12 years agoFix GC_ALPHA_VERSION comparison in gctest and tools files
Ivan Maidanski [Fri, 16 Mar 2012 15:11:08 +0000 (19:11 +0400)]
Fix GC_ALPHA_VERSION comparison in gctest and tools files

* tests/test.c (GC_ALPHA_VERSION): Define to GC_TMP_ALPHA_VERSION if
not defined by gc_version.h.
* tools/add_gc_prefix.c (GC_ALPHA_VERSION): Likewise.
* tools/gcname.c (GC_ALPHA_VERSION): Likewise.

12 years agoMove Symbian cpp files to 'extra' folder;
Ivan Maidanski [Sun, 18 Mar 2012 13:50:45 +0000 (17:50 +0400)]
Move Symbian cpp files to 'extra' folder;
add GC prefix to init_global_static_roots Symbian-special API function.

12 years agoMerge with symbian_libgc_7x branch
Ivan Maidanski [Sun, 18 Mar 2012 12:04:58 +0000 (16:04 +0400)]
Merge with symbian_libgc_7x branch

12 years agomark.c: Replace C++ style comments with C ones in GC_is_marked
Ivan Maidanski [Sun, 18 Mar 2012 08:59:47 +0000 (12:59 +0400)]
mark.c: Replace C++ style comments with C ones in GC_is_marked

12 years agoSpeedup calloc size overflow check by preventing division if small values
Hans Boehm [Thu, 15 Mar 2012 17:09:05 +0000 (21:09 +0400)]
Speedup calloc size overflow check by preventing division if small values

* malloc.c (GC_SQRT_SIZE_MAX): New macro.
* malloc.c (calloc): Add fast initial size overflow check to avoid
integer division for reasonably small values passed.

12 years agoFix calloc-related code to prevent SIZE_MAX redefinition in sys headers
Ivan Maidanski [Thu, 15 Mar 2012 16:30:11 +0000 (20:30 +0400)]
Fix calloc-related code to prevent SIZE_MAX redefinition in sys headers

* malloc.c: Include limits.h for SIZE_MAX.
* malloc.c (SIZE_MAX, calloc): Define GC_SIZE_MAX instead of SIZE_MAX.

12 years agoUpdate AUTHORS and ChangeLog files
Ivan Maidanski [Thu, 15 Mar 2012 15:57:45 +0000 (19:57 +0400)]
Update AUTHORS and ChangeLog files

12 years agoFix allocation size overflows due to rounding.
Xi Wang [Wed, 14 Mar 2012 20:55:08 +0000 (04:55 +0800)]
Fix allocation size overflows due to rounding.

* malloc.c (GC_generic_malloc): Check if the allocation size is
rounded to a smaller value.
* mallocx.c (GC_generic_malloc_ignore_off_page): Likewise.

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).