]> granicus.if.org Git - gc/log
gc
11 years agoTODO file: Add pending TODO/FIXME items
Ivan Maidanski [Sat, 20 Jul 2013 10:57:58 +0000 (14:57 +0400)]
TODO file: Add pending TODO/FIXME items

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

11 years agoMake GC_mark_lock_holder variable static
Ivan Maidanski [Mon, 15 Jul 2013 11:40:49 +0000 (15:40 +0400)]
Make GC_mark_lock_holder variable static

* include/private/gc_locks.h (GC_mark_lock_holder): Remove declaration.
* pthread_support.c (GC_mark_lock_holder): Change from GC_INNER to
STATIC (defined only if GC_ASSERTIONS).
* win32_threads.c (GC_mark_lock_holder): Likewise.

11 years agoAdd assertion to LOCK definition that lock is not already held
Ivan Maidanski [Mon, 15 Jul 2013 11:08:45 +0000 (15:08 +0400)]
Add assertion to LOCK definition that lock is not already held

* include/private/gc_locks.h (UNCOND_LOCK): Add assertion that
I_DONT_HOLD_LOCK (lock is not held precondition).

11 years agoFix GC_PTHREAD_PTRVAL definition for GC_PTHREADS_PARAMARK (Win32)
Ivan Maidanski [Mon, 15 Jul 2013 09:33:12 +0000 (13:33 +0400)]
Fix GC_PTHREAD_PTRVAL definition for GC_PTHREADS_PARAMARK (Win32)

* win32_threads.c (GC_PTHREAD_PTRVAL): Define also if
GC_PTHREADS_PARAMARK (even w/o GC_WIN32_PTHREADS).

11 years agoEnable thread-local allocation support for Clang on Cygwin
Ivan Maidanski [Thu, 11 Jul 2013 12:34:00 +0000 (16:34 +0400)]
Enable thread-local allocation support for Clang on Cygwin

* include/private/thread_local_alloc.h (USE_PTHREAD_SPECIFIC): Use
(instead of USE_COMPILER_TLS) for clang3.1/x86 cygwin to workaround
"thread-local storage is unsupported for the current target" error.

11 years agoFix more typos in comments and documentation
Ivan Maidanski [Thu, 11 Jul 2013 08:44:35 +0000 (12:44 +0400)]
Fix more typos in comments and documentation

* alloc.c: Fix typo ("overflow").
* configure.ac: Fix typo ("optimization").
* doc/README.amiga: Fix typos ("also", "specific", "unnecessary").
* doc/README.cords: Fix typos ("descendants", "highlighted").
* ChangeLog: Fix typos ("[un]collectible").
* README.md: Likewise.
* dbg_mlc.c: Likewise.
* doc/README.hp: Likewise.
* doc/README.linux: Likewise.
* doc/gcdescr.html: Likewise.
* doc/gcinterface.html: Likewise.
* include/gc_mark.h: Likewise.
* include/gc_pthread_redirects.h: Likewise.
* include/new_gc_alloc.h: Likewise.
* include/private/dbg_mlc.h: Likewise.
* include/private/gc_pmark.h: Likewise.
* include/private/gc_priv.h: Likewise.
* new_hblk.c: Likewise.
* ChangeLog: Fix typo ("multi-threaded").
* cord/cordxtra.c: Likewise.
* doc/debugging.html: Likewise.
* doc/gcinterface.html: Likewise.
* doc/leak.html: Likewise.
* doc/overview.html: Likewise.
* doc/simple_example.html: Likewise.
* include/gc_mark.h: Likewise.
* include/private/gc_priv.h: Likewise.
* os_dep.c: Likewise.
* ptr_chck.c: Likewise.
* README.md: Fix typo ("pointer-free").
* allchblk.c: Likewise.
* doc/debugging.html: Likewise.
* doc/gcdescr.html: Likewise.

11 years agoUpdate AUTHORS file
Ivan Maidanski [Thu, 11 Jul 2013 08:03:08 +0000 (12:03 +0400)]
Update AUTHORS file

11 years agoFix typos in comments
Ondrej Bilka [Thu, 11 Jul 2013 07:57:32 +0000 (11:57 +0400)]
Fix typos in comments

* blacklst.c: Fix typo ("even though").
* cord/cordbscs.c: Fix typo ("exponentially").
* cord/cordxtra.c: Fix typo ("represented").
* dyn_load.c: Fix typos ("uncollectible", "occurred").
* extra/AmigaOS: Fix typos ("specific", "necessary", "always",
"effectiveness").
* finalize.c: Fix typo ("descendants").
* include/cord.h: Fix typo ("idiosyncrasies").
* include/gc.h: Fix typo ("collectible").
* include/gc_allocator.h: Fix typos ("allocator", "[un]collectible").
* mach_dep.c: Fix typo ("erroneously").
* malloc.c: Fix typos ("[un]collectible", "pointer-free",
"initialization").
* mallocx.c: Fix typos ("largely", "pointer-free", "uncollectible").
* mark.c: Fix typos ("[un]collectible", "even though").
* misc.c: Fix typo ("erroneously").
* os_dep.c: Fix typos ("non-addressable", "happening", "pointer-free").
* tests/test.c: Fix typos ("uncollectible", "reversed").
* tests/test_cpp.cc: Fix typos ("[un]collectible").
* typd_mlc.c: Fix typo ("copyright").
* win32_threads.c: Fix typos ("optimization", "uncollectible").

11 years agoExpand tabs to spaces in rarely used (ancient) files
Ivan Maidanski [Wed, 10 Jul 2013 11:35:23 +0000 (15:35 +0400)]
Expand tabs to spaces in rarely used (ancient) files

* extra/AmigaOS.c: Expand tabs to spaces.
* extra/MacOS.c: Likewise.
* extra/Mac_files/dataend.c: Likewise.
* extra/Mac_files/datastart.c: Likewise.
* extra/symbian.cpp: Likewise.
* cord/cordxtra.c: Likewise.

11 years agoFix missing tabs in SMakefile.amiga
Ivan Maidanski [Wed, 10 Jul 2013 11:16:04 +0000 (15:16 +0400)]
Fix missing tabs in SMakefile.amiga

* SMakefile.amiga (clean, test, gctest, setjmp_t, gc*.lib, setjmp_t):
Fix indentation (replace spaces with tabs).

11 years agoCheck that SIG_SUSPEND and SIG_THR_RESTART are different (Pthreads)
Ivan Maidanski [Wed, 10 Jul 2013 08:19:09 +0000 (12:19 +0400)]
Check that SIG_SUSPEND and SIG_THR_RESTART are different (Pthreads)

* pthread_stop_world.c (GC_stop_init): Add a check that GC_sig_suspend
value differs from that of GC_sig_thr_restart (abort otherwise).

11 years agoImprove debug-only messages of add/remove_roots and init_linux_data_start
Ivan Maidanski [Wed, 12 Jun 2013 05:50:04 +0000 (09:50 +0400)]
Improve debug-only messages of add/remove_roots and init_linux_data_start

* mark_rts.c (GC_add_roots_inner, GC_remove_root_at_pos): Log r_tmp
value (only if DEBUG_ADD_DEL_ROOTS).
* os_dep.c (GC_init_linux_data_start): Log unresolved [__]data_start
symbol (only if DEBUG_ADD_DEL_ROOTS and LINUX).

11 years agoFix typo in comment of signalObjectAndWait_func (Win32)
Ivan Maidanski [Wed, 12 Jun 2013 05:20:45 +0000 (09:20 +0400)]
Fix typo in comment of signalObjectAndWait_func (Win32)

* win32_threads.c (signalObjectAndWait_func): Fix a typo in comment.

11 years agoUse compiler TLS for Android NDK gcc/arm
Ivan Maidanski [Mon, 10 Jun 2013 20:02:34 +0000 (00:02 +0400)]
Use compiler TLS for Android NDK gcc/arm

* include/private/thread_local_alloc.h (USE_COMPILER_TLS): Define for
Android NDK gcc/arm v4.6 or higher.

11 years agoWorkaround 'unresolved __tls_get_addr' error for Android NDK Clang/x86
Ivan Maidanski [Mon, 10 Jun 2013 18:39:08 +0000 (22:39 +0400)]
Workaround 'unresolved __tls_get_addr' error for Android NDK Clang/x86

* include/private/thread_local_alloc.h (USE_COMPILER_TLS): Do not use
for Android NDK Clang (to workaround "unresolved __tls_get_addr" linker
error reported both by clang/x86 and clang/mips).

11 years agoTag GC malloc routines with alloc_size attribute for Clang 3.2+
Ivan Maidanski [Mon, 10 Jun 2013 17:03:33 +0000 (21:03 +0400)]
Tag GC malloc routines with alloc_size attribute for Clang 3.2+

* include/gc_config_macros.h (GC_ATTR_ALLOC_SIZE): Define as alloc_size
attribute for Clang 3.2+ as well.

11 years agoWorkaround 'unresolved __tls_get_addr' error for Android NDK clang/mips
Ivan Maidanski [Sun, 9 Jun 2013 15:34:43 +0000 (19:34 +0400)]
Workaround 'unresolved __tls_get_addr' error for Android NDK clang/mips

* include/private/thread_local_alloc.h (USE_COMPILER_TLS): Do not use
for Android NDK Clang/mips (to workaround "unresolved __tls_get_addr"
linker error).

11 years agoUse pthread API to operate thread-local data on Linux if no compiler TLS
Ivan Maidanski [Sun, 9 Jun 2013 14:47:44 +0000 (18:47 +0400)]
Use pthread API to operate thread-local data on Linux if no compiler TLS

* include/private/thread_local_alloc.h (USE_PTHREAD_SPECIFIC): Define
for GC_LINUX_THREADS (instead of default USE_CUSTOM_SPECIFIC) if
compiler TLS is unavailable (e.g., for linux/arm).

11 years agoMove GC_OPENBSD_UTHREADS definition to private/gcconfig.h (OpenBSD)
Ivan Maidanski [Sat, 8 Jun 2013 13:37:03 +0000 (17:37 +0400)]
Move GC_OPENBSD_UTHREADS definition to private/gcconfig.h (OpenBSD)

* include/gc_config_macros.h (GC_OPENBSD_UTHREADS): Move definition
to gcconfig.h (i.e., do not export to client code).

11 years agoSuppress 'GC_dont_gc deprecated' warning in gc.h if GC_DONT_GC
Ivan Maidanski [Sat, 8 Jun 2013 13:16:19 +0000 (17:16 +0400)]
Suppress 'GC_dont_gc deprecated' warning in gc.h if GC_DONT_GC

* include/gc.h (GC_dont_gc): Do not specify GC_ATTR_DEPRECATED if
GC_DONT_GC defined (to avoid deprecated warning in
GC_INIT_CONF_MAX_RETRIES which assigns GC_dont_gc directly).

11 years agoSupport rthreads introduced in OpenBSD 5.2+
Kurt Miller [Sat, 8 Jun 2013 12:45:23 +0000 (16:45 +0400)]
Support rthreads introduced in OpenBSD 5.2+

* include/gc_config_macros.h (GC_OPENBSD_UTHREADS): New macro (defined
only if OpenBSD prior to 5.2 release and threads).
* include/private/gc_priv.h (SIG_SUSPEND): Define for OpenBSD (unless
GC_OPENBSD_UTHREADS).
* include/private/pthread_stop_world.h (thread_stop_info): Test
GC_OPENBSD_UTHREADS macro instead of GC_OPENBSD_THREADS.
* misc.c (GC_set_suspend_signal, GC_set_thr_restart_signal,
GC_get_suspend_signal, GC_get_thr_restart_signal): Likewise.
* os_dep.c (GC_dirty_init): Likewise.
* pthread_stop_world.c: Likewise.
* tests/initsecondarythread.c (main): Likewise.

11 years agoRemove unused UTHREAD_SP_OFFSET macro (OpenBSD)
Ivan Maidanski [Sat, 8 Jun 2013 07:52:02 +0000 (11:52 +0400)]
Remove unused UTHREAD_SP_OFFSET macro (OpenBSD)

* include/private/gcconfig.h (UTHREAD_SP_OFFSET): Do not define (since
no longer used for OpenBSD because pthread_stackseg_np is used to get
thread stack pointer).

11 years agoUpdate AUTHORS file
Ivan Maidanski [Sun, 2 Jun 2013 14:26:39 +0000 (18:26 +0400)]
Update AUTHORS file

11 years agoRegister dynamic libraries via dl_iterate_phdr on OpenBSD
Kurt Miller [Sun, 2 Jun 2013 14:24:36 +0000 (18:24 +0400)]
Register dynamic libraries via dl_iterate_phdr on OpenBSD

* dyn_load.c (HAVE_DL_ITERATE_PHDR): Define for OpenBSD (with release
date 2005.19 or later).

11 years agoRegister dynamic libraries via dl_iterate_phdr on Android if possible
Ivan Maidanski [Sat, 1 Jun 2013 10:33:33 +0000 (14:33 +0400)]
Register dynamic libraries via dl_iterate_phdr on Android if possible

* dyn_load.c (HAVE_DL_ITERATE_PHDR): Define also for Android.
* dyn_load.c (dl_iterate_phdr): Declare explicitly for Android (since
no prototype in NDK link.h for ARM).

11 years agoFix GC_INIT_CONF_ROOTS in gc.h for Android (define __data_start as weak)
Ivan Maidanski [Sat, 1 Jun 2013 10:21:09 +0000 (14:21 +0400)]
Fix GC_INIT_CONF_ROOTS in gc.h for Android (define __data_start as weak)

* include/gc.h (GC_INIT_CONF_ROOTS): Define __data_start as weak
symbol for Android (including x86 and MIPS targets); do not call
GC_add_roots if __data_start symbol is unresolved.

11 years agoDefault to use libc_stack_end in single-threaded GC on glibc targets
Ludovic Courtes [Wed, 22 May 2013 21:16:46 +0000 (01:16 +0400)]
Default to use libc_stack_end in single-threaded GC on glibc targets

* include/private/gcconfig.h (USE_LIBC_PRIVATES): Define for glibc
(unless DONT_USE_LIBC_PRIVATES is defined).

11 years agoAdjust README.md title and references to doc .html files in it
Ivan Maidanski [Sat, 18 May 2013 19:36:28 +0000 (23:36 +0400)]
Adjust README.md title and references to doc .html files in it

11 years agoAdjust README filename in README.QUICK
Ivan Maidanski [Sat, 18 May 2013 19:24:00 +0000 (23:24 +0400)]
Adjust README filename in README.QUICK

11 years agoConvert readme to markdown.
David Terei [Fri, 10 May 2013 19:54:10 +0000 (12:54 -0700)]
Convert readme to markdown.

11 years agoAdjust build scripts to enable additional test library in staticrootstest
Ivan Maidanski [Sun, 5 May 2013 20:02:40 +0000 (00:02 +0400)]
Adjust build scripts to enable additional test library in staticrootstest
(The 2nd test library contains global data too but has no GC_INIT call.)

* tests/tests.am (staticrootstest_CFLAGS,
libstaticrootslib2_test_la_CFLAGS): New definition (to test with
libsrl_getpelem2() enabled).
* tests/tests.am (staticrootstest_LDADD, check_LTLIBRARIES): Add
libstaticrootslib2_test.la.
* tests/tests.am (libstaticrootslib2_test_la_SOURCES,
libstaticrootslib2_test_la_LIBADD,
libstaticrootslib2_test_la_LDFLAGS): New definition (similar to that
of libstaticrootslib_test_la_X).

11 years agoImprove staticrootstest: add global data to library, add lib w/o GC_INIT
Ivan Maidanski [Sun, 5 May 2013 13:13:54 +0000 (17:13 +0400)]
Improve staticrootstest: add global data to library, add lib w/o GC_INIT

* tests/staticrootslib.c: Do not include stdio.h (not needed).
* tests/staticrootslib.c (root, root_nz): New static variables.
* tests/staticrootstest.c (root_nz): Likewise.
* tests/staticrootslib.c (libsrl_getpelem): New exported function
(exported as "libsrl_getpelem2" if STATICROOTSLIB2).
* tests/staticrootslib.c (libsrl_mktree, libsrl_init): Do not define
if STATICROOTSLIB2.
* tests/staticrootslib.c (libsrl_init): Do not call GC_INIT if
STATICROOTSLIB_INIT_IN_MAIN defined.
* tests/staticrootstest.c (libsrl_getpelem, libsrl_getpelem2): Declare
imported function.
* tests/staticrootstest.c (main): Call GC_INIT if
STATICROOTSLIB_INIT_IN_MAIN defined; set *libsrl_getpelem2() (only if
STATICROOTSLIB2 defined), *libsrl_getpelem() and root_nz[] elements
(similar to that of root[]).

11 years agoEnable staticrootstest for the case of GC shared library build
Ivan Maidanski [Sat, 4 May 2013 09:56:34 +0000 (13:56 +0400)]
Enable staticrootstest for the case of GC shared library build

* tests/staticrootslib.c (GC_TEST_EXPORT_API): New macro (defined to
set GCC default visibility attribute if GC_VISIBILITY_HIDDEN_SET
unless Win32).
* tests/staticrootslib.c (root): Remove unused global variable.
* tests/staticrootslib.c (libsrl_mktree, libsrl_init): Decorate with
GC_TEST_EXPORT_API.
* tests/staticrootstest.c (GC_VISIBILITY_HIDDEN_SET): Do not check (do
not skip the test).
* tests/staticrootstest.c (GC_TEST_IMPORT_API): New macro.
* tests/staticrootstest.c (root): Explicitly specify zero initializer.
* tests/staticrootstest.c (libsrl_mktree, libsrl_init): Decorate with
GC_TEST_IMPORT_API.
* tests/staticrootstest.c (mktree, main): Remove commented out code.
* tests/staticrootstest.c (main): Avoid code duplication.
* tests/tests.am (staticrootstest_LDADD, check_LTLIBRARIES,
libstaticrootslib_la): Rename libstaticrootslib to
libstaticrootslib_test.

11 years agoRemove GC_BUILD definition from build scripts
Ivan Maidanski [Sat, 4 May 2013 07:23:44 +0000 (11:23 +0400)]
Remove GC_BUILD definition from build scripts

* CMakeLists.txt (ADD_DEFINITIONS): Remove -D GC_BUILD (not
needed since it is defined in gc_priv.h, gc_pmark.h and
gc_cpp.cc).
* WCC_MAKEFILE (CFLAGS): Likewise.
* build/s60v3/libgc.mmp: Likewise.
* digimars.mak (DEFINES, tests/test.obj): Likewise.
* windows-untested/vc60/gc.dsp (ADD CPP): Likewise.
* windows-untested/vc60/libgc.dsp (ADD CPP): Likewise.
* windows-untested/vc60/libgcmt.dsp (ADD CPP): Likewise.
* windows-untested/vc70/gc.vcproj (PreprocessorDefinitions): Likewise.
* windows-untested/vc70/libgc.vcproj (PreprocessorDefinitions):
Likewise.
* windows-untested/vc70/libgcmt.vcproj (PreprocessorDefinitions):
Likewise.
* windows-untested/vc71/gc.vcproj (PreprocessorDefinitions): Likewise.
* windows-untested/vc71/libgc.vcproj (PreprocessorDefinitions):
Likewise.
* windows-untested/vc71/libgcmt.vcproj (PreprocessorDefinitions):
Likewise.
* extra/MacOS.c: Define GC_BUILD (before include of gc.h).
* extra/msvc_dbg.c: Likewise.
* windows-untested/vc60/gc.dsp (MESSAGE, ENDIF): Remove trailing
spaces at EOLn.
* windows-untested/vc60/libgc.dsp (MESSAGE, ENDIF): Likewise.
* windows-untested/vc60/libgcmt.dsp (MESSAGE, ENDIF): Likewise.

11 years agoFix triple-letter typos in comments and documentation
Ivan Maidanski [Fri, 3 May 2013 20:21:20 +0000 (00:21 +0400)]
Fix triple-letter typos in comments and documentation

* ChangeLog: Fix triple-letter typos.
* doc/overview.html: Likewise.
* mark.c (GC_push_marked1): Fix a triple-letter typo in a comment.
* os_dep.c (GC_register_data_segments): Likewise.

11 years agoFix AM_CONFIG_HEADER in configure for autoconf-2.69-1
Manuel Serrano [Wed, 3 Apr 2013 03:54:47 +0000 (07:54 +0400)]
Fix AM_CONFIG_HEADER in configure for autoconf-2.69-1

* configure.ac (AM_CONFIG_HEADER): Replace obsolete macro with with
AC_CONFIG_HEADERS one.

11 years agoFix GC_INIT_CONF_ROOTS in gc.h for Android/x86 and Android/mips
Ivan Maidanski [Thu, 14 Mar 2013 17:31:05 +0000 (21:31 +0400)]
Fix GC_INIT_CONF_ROOTS in gc.h for Android/x86 and Android/mips

* include/gc.h (GC_INIT_CONF_ROOTS): Do not define to register static
data root in range from __data_start to _end on non-ARM Android
(because __data_start symbol does not exist for x86 and mips); refine
the comment.

11 years agoFix make disclaim_test to link with new GNU ld linking rules
Ivan Maidanski [Thu, 28 Feb 2013 03:48:05 +0000 (07:48 +0400)]
Fix make disclaim_test to link with new GNU ld linking rules

* tests/tests.am (disclaim_test_LDADD): Link to pthreads (or appropriate
threading libraries) as needed.

11 years agoFix tests makefile to link with new GNU ld linking rules
Andy Wingo [Wed, 13 Feb 2013 14:45:33 +0000 (15:45 +0100)]
Fix tests makefile to link with new GNU ld linking rules

* tests/tests.am (gctest_LDADD, threadleaktest_LDADD,
threadkey_test_LDADD, subthread_create_LDADD,
initsecondarythread_LDADD): Link to pthreads (or appropriate
threading libraries) as needed; fixes failure to link with new GNU ld
linking rules.

11 years agoWorkaround 'ELF_DATA/EM_ALPHA redefined' warning in Android linker.h
Ivan Maidanski [Fri, 22 Feb 2013 04:25:27 +0000 (08:25 +0400)]
Workaround 'ELF_DATA/EM_ALPHA redefined' warning in Android linker.h

* dyn_load.c: Include asm/elf.h and linux/elf-em.h explicitly, and
undefine ELF_DATA and EM_ALPHA (if PLATFORM_ANDROID and
BIONIC_ELFDATA_REDEF_BUG are defined) to workaround a bug (avoiding
"macro redefined" warnings) in Android 4.1 (and 4.2) Bionic which has
the mismatching macro definitions in headers included from linker.h.

11 years agoAdd assertion on number_of_objs to GC_extend_size_map
Ivan Maidanski [Sat, 16 Feb 2013 19:42:24 +0000 (23:42 +0400)]
Add assertion on number_of_objs to GC_extend_size_map

* misc.c (GC_extend_size_map): Add assertion for number_of_objs (result
of integer division) to be non-zero (this assertion violation is
observed in some Android emulators when gcc -march value does not match
target CPU).

11 years agoAllow not to rely on __data_start value (Linux)
Ivan Maidanski [Wed, 13 Feb 2013 20:47:30 +0000 (00:47 +0400)]
Allow not to rely on __data_start value (Linux)

* os_dep.c (GC_init_linux_data_start): Skip use of [__]data_start if
IGNORE_PROG_DATA_START (useful if give wrong value).
* os_dep.c (GC_init_linux_data_start): Add assertion checks for
[__]data_start to be not greater than _end.

11 years agoAllow to omit libc atexit() call
Ivan Maidanski [Wed, 13 Feb 2013 20:29:44 +0000 (00:29 +0400)]
Allow to omit libc atexit() call

* misc.c (GC_exit_check): Do not define if DONT_USE_ATEXIT (since
unused in this case).
* misc.c (GC_init): Do not call atexit if DONT_USE_ATEXIT (useful if
atexit is missing in libc, e.g., to workaround linkage problems in
Android NDK).

11 years ago.gitignore: Ignore .gch files
Ivan Maidanski [Sun, 27 Jan 2013 10:33:59 +0000 (14:33 +0400)]
.gitignore: Ignore .gch files

11 years agoAdjust punctuation in comments and documentation
Ivan Maidanski [Wed, 23 Jan 2013 19:59:19 +0000 (23:59 +0400)]
Adjust punctuation in comments and documentation

* win32_threads.c (GC_pthread_join): Add a space character after comma
in comment.
* include/private/gcconfig.h: Likewise.
* doc/README.Mac: Likewise.
* doc/porting.html: Likewise.
* ptr_chck.c (GC_same_obj): Remove redundant comma in comment.

11 years agoUpdate AUTHORS file
Ivan Maidanski [Wed, 23 Jan 2013 19:20:50 +0000 (23:20 +0400)]
Update AUTHORS file

11 years agoAdd AArch64 (64-bit ARM) target support
Yvan Roux [Wed, 23 Jan 2013 19:15:57 +0000 (23:15 +0400)]
Add AArch64 (64-bit ARM) target support

* include/private/gcconfig.h (AARCH64): New macro (defined only if
__aarch64__).
* include/private/gcconfig.h (mach_type_known): Update comment adding
ARM AArch64 target.
* include/private/gcconfig.h (NOSYS, mach_type_known, CPP_WORDSZ,
MACH_TYPE, ALIGNMENT, HBLKSIZE, OS_TYPE, LINUX_STACKBOTTOM,
DYNAMIC_LOADING, DATASTART, DATAEND, STACKBOTTOM): Define for AArch64.

11 years agoDo not include sigcontext.h if NO_SIGCONTEXT_H (Linux)
Ivan Maidanski [Sun, 6 Jan 2013 09:32:09 +0000 (13:32 +0400)]
Do not include sigcontext.h if NO_SIGCONTEXT_H (Linux)

* os_dep.c: Do not include [asm/]sigcontext.h (and linux/version.h)
if NO_SIGCONTEXT_H is defined (only if LINUX and not POWERPC).

11 years agoDo not use pthread_getattr_np if NO_PTHREAD_GETATTR_NP specified
Ivan Maidanski [Sun, 6 Jan 2013 09:05:24 +0000 (13:05 +0400)]
Do not use pthread_getattr_np if NO_PTHREAD_GETATTR_NP specified

* include/private/gcconfig.h (NO_PTHREAD_GETATTR_NP): Define new macro
for NaCl.
* os_dep.c (GC_get_main_stack_base, GC_get_stack_base): Test
NO_PTHREAD_GETATTR_NP instead of NACL (i.e., do not use
pthread_getattr_np if NO_PTHREAD_GETATTR_NP).

12 years agoFix reference to debugging-related README file in README and Makefile.dj
Ivan Maidanski [Fri, 28 Dec 2012 03:22:06 +0000 (07:22 +0400)]
Fix reference to debugging-related README file in README and Makefile.dj

* README: Change README.debugging to debugging.html.
* Makefile.dj (OTHER_FILES): Likewise.

12 years agoFix GC_win32_free_heap compilation error for Cygwin
Ivan Maidanski [Sun, 23 Dec 2012 12:03:36 +0000 (16:03 +0400)]
Fix GC_win32_free_heap compilation error for Cygwin
(fix commit 'caa5af9')

* os_dep.c (GC_win32_free_heap): Do not invoke virtual free for
Cygwin, remove "else" branch  (only if MSWIN32 but not CYGWIN32).

12 years agoFix: VirtualAlloc leaks when freeing the heap on win32
Max Mouratov [Sun, 21 Oct 2012 14:39:17 +0000 (20:39 +0600)]
Fix: VirtualAlloc leaks when freeing the heap on win32

12 years agoFix GC_win32_free_heap to prevent memory leak if USE_GLOBAL_ALLOC
Ivan Maidanski [Sun, 23 Dec 2012 14:52:10 +0000 (18:52 +0400)]
Fix GC_win32_free_heap to prevent memory leak if USE_GLOBAL_ALLOC

* os_dep.c (GC_win32_free_heap): Test GLOBAL_ALLOC_TEST instead of
GC_no_win32_dlls to determine whether the memory is allocated using
GlobalAlloc (only if MSWIN32).

12 years agoFix dwSize argument of VirtualFree call in detect_GetWriteWatch (Win32)
Ivan Maidanski [Sun, 23 Dec 2012 12:13:45 +0000 (16:13 +0400)]
Fix dwSize argument of VirtualFree call in detect_GetWriteWatch (Win32)

* os_dep.c (detect_GetWriteWatch): Pass 0 (instead of GC_page_size)
to Win32 VirtualFree if GWW_VDB (dwSize must be 0 if MEM_RELEASE
according to MSDN).

12 years agoAdd assertion to LONG_MULT and remove useless assert in PUSH_CONTENTS_HDR
Ivan Maidanski [Sun, 23 Dec 2012 10:47:09 +0000 (14:47 +0400)]
Add assertion to LONG_MULT and remove useless assert in PUSH_CONTENTS_HDR

* include/private/gc_pmark.h (LONG_MULT): Add static assertion that
the size of variable is large enough to hold multiplication result.
* include/private/gc_pmark.h (PUSH_CONTENTS_HDR): Remove useless
assertion check for a unsigned "high_prod" value to be non-negative
(only if MARK_BIT_PER_OBJ).

12 years agoMake GC_print_trace always thread-safe and remove 'lock' argument
Ivan Maidanski [Sun, 23 Dec 2012 10:23:50 +0000 (14:23 +0400)]
Make GC_print_trace always thread-safe and remove 'lock' argument

* mark.c (GC_print_trace): Remove "lock" argument assuming always true
(GC_print_trace is used for debugging purposes only and not exported
publicly).

12 years agoMove GC_print_trace code inside LOCK/UNLOCK to GC_print_trace_inner
Ivan Maidanski [Sun, 23 Dec 2012 09:25:59 +0000 (13:25 +0400)]
Move GC_print_trace code inside LOCK/UNLOCK to GC_print_trace_inner
(code refactoring)

* mark.c (GC_print_trace_inner): New function (only if TRACE_BUF).
* mark.c (GC_print_trace): Move code to GC_print_trace_inner (except
for LOCK/UNLOCK); invoke GC_print_trace_inner (either with lock held
or not depending on "lock" variable value).

12 years agoAdjust printf format specifiers in GC_print_trace
Ivan Maidanski [Sun, 23 Dec 2012 09:13:37 +0000 (13:13 +0400)]
Adjust printf format specifiers in GC_print_trace

* mark.c (GC_print_trace): Adjust printf format specifier for
arguments of word type (cast to long type).
* mark.c (GC_print_trace): Replace printf() call with GC_printf.

12 years agoFix GC_print_trace missing unlock
Ivan Maidanski [Sun, 23 Dec 2012 08:53:34 +0000 (12:53 +0400)]
Fix GC_print_trace missing unlock

* mark.c (GC_print_trace): Perform UNLOCK (if "lock" is on) before
return (inside loop).

12 years agoChange definition of macros represented as block to be simple statement
Ivan Maidanski [Sun, 23 Dec 2012 07:58:21 +0000 (11:58 +0400)]
Change definition of macros represented as block to be simple statement
(code refactoring)

* backgraph.c (FOR_EACH_PRED): Wrap outermost block into do/while (0).
* include/gc_inline.h (GC_FAST_MALLOC_GRANS, GC_MALLOC_WORDS,
GC_MALLOC_ATOMIC_WORDS, GC_CONS): Likewise.
* include/private/gc_hdrs.h (HC_GET_HDR, GET_BI, GET_HDR_ADDR,
GET_HDR, SET_HDR): Likewise.
* include/private/gc_locks.h (LOCK, UNLOCK): Likewise.
* include/private/gc_pmark.h (PUSH_OBJ, PUSH_CONTENTS,
SET_MARK_BIT_EXIT_IF_SET, OR_WORD_EXIT_IF_SET, LONG_MULT,
PUSH_CONTENTS_HDR, GC_PUSH_ONE_STACK, GC_PUSH_ONE_HEAP, GC_MARK_FO):
Likewise.
* include/private/gc_priv.h (GET_TIME, GC_ASSERT, COND_DUMP_CHECKS,
DISABLE_CANCEL, RESTORE_CANCEL): Likewise.
* include/private/gcconfig.h (PREFETCH): Likewise.
* mark.c (PUSH_GRANULE): Likewise.
* misc.c (GC_PRINTF_FILLBUF): Likewise.
* include/private/gc_locks.h (SET_LOCK_HOLDER, UNSET_LOCK_HOLDER):
Define as "(void)0" instead of empty.
* include/private/gc_priv.h (ASSERT_CANCEL_DISABLED): Likewise.
* include/private/gcconfig.h (PREFETCH, PREFETCH_FOR_WRITE): Likewise.
* win32_threads.c (UNPROTECT_THREAD): Likewise.
* include/private/gc_priv.h (GC_INLINE): Refine comment.
* include/private/gc_priv.h (MAKE_COOLER, MAKE_HOTTER,
GC_ADD_TO_BLACK_LIST_NORMAL, GC_ADD_TO_BLACK_LIST_STACK, COND_DUMP):
Replace block in "else" branch with a statement and remove trailing
';' symbol.
* include/private/gc_priv.h (ABORT_RET): Invert "if" condition moving
statement from "then" branch to "else" one; remove outermost {};
remove trailing ';' symbol
* os_dep.c (PROTECT, UNPROTECT): Likewise.
* pthread_support.c (INIT_REAL_SYMS): Likewise.
* win32_threads.c (SET_PTHREAD_MAP_CACHE): Cast result to void.
* win32_threads.c (PUSH2, PUSH4): Add outermost parentheses.

12 years agoDefine CORD_ec_append macro to expression instead of block (cord)
Ivan Maidanski [Sat, 22 Dec 2012 19:09:00 +0000 (23:09 +0400)]
Define CORD_ec_append macro to expression instead of block (cord)
(code refactoring)

* include/ec.h (CORD_ec_init): Cast result to void (no return value).
* include/ec.h (CORD_ec_append): Replace block with void expression;
remove redundant parentheses.

12 years agoRefine comment of GC_is_heap_ptr and GC_thread_is_registered in gc.h
Ivan Maidanski [Sat, 22 Dec 2012 18:45:11 +0000 (22:45 +0400)]
Refine comment of GC_is_heap_ptr and GC_thread_is_registered in gc.h

* include/gc.h (GC_is_heap_ptr, GC_thread_is_registered): Refine
comment (specify TRUE is encoded as any non-zero value).

12 years agoUse EXPECT in GC_COND/VERBOSE_LOG_PRINTF
Ivan Maidanski [Sat, 22 Dec 2012 17:55:45 +0000 (21:55 +0400)]
Use EXPECT in GC_COND/VERBOSE_LOG_PRINTF

* include/private/gc_priv.h (GC_COND_LOG_PRINTF,
GC_VERBOSE_LOG_PRINTF): Use EXPECT to test GC_print_stats value.

12 years agoUpdate AUTHORS (add email)
Ivan Maidanski [Sat, 22 Dec 2012 09:31:09 +0000 (13:31 +0400)]
Update AUTHORS (add email)

12 years agoDefine functions in darwin_semaphore.h as inline instead of static
Ivan Maidanski [Fri, 14 Dec 2012 21:13:06 +0000 (01:13 +0400)]
Define functions in darwin_semaphore.h as inline instead of static

* include/private/darwin_semaphore.h: Reformat comment.
* include/private/darwin_semaphore.h (sem_init, sem_post, sem_wait,
sem_destroy): Define as GC_INLINE instead of static.

12 years agoReplace '`' symbol with double-quote in comments
Ivan Maidanski [Fri, 14 Dec 2012 21:03:50 +0000 (01:03 +0400)]
Replace '`' symbol with double-quote in comments

* doc/README.win32: Replace "`" symbol (and paring single-quote) with
double-quote symbol.
* dyn_load.c (GC_register_dynlib_callback): Likewise.
* finalize.c (GC_should_invoke_finalizers): Likewise.
* include/private/gc_priv (GC_INLINE, ptr_t): Likewise.
* include/private/gcconfig.h (DATAEND): Likewise.

12 years agoTurn on world-stop delay logging at debug level by default for Android
Ivan Maidanski [Wed, 12 Dec 2012 19:45:32 +0000 (23:45 +0400)]
Turn on world-stop delay logging at debug level by default for Android

* alloc.c (GC_stopped_mark): Use GC_PRINT_STATS_FLAG instead of
GC_print_stats in the condition for logging world-stop pause time.
* include/private/gc_priv.h (GC_PRINT_STATS_FLAG): New macro (defined
as !GC_quiet if GC_ANDROID_LOG otherwise as GC_print_stats.
* include/private/gc_priv.h (GC_DBGLOG_PRINTF): Define using
GC_PRINT_STATS_FLAG instead of GC_quiet; update comment.

12 years agoImprove logged messages about heap size and usage
Ivan Maidanski [Wed, 12 Dec 2012 19:05:36 +0000 (23:05 +0400)]
Improve logged messages about heap size and usage

* alloc.c (GC_stopped_mark): Print heap size to debug log in KiB
(using TO_KiB_UL macro) excluding unmapped memory size.
* alloc.c (GC_compute_heap_usage_percent): New inline function.
* alloc.c (GC_finish_collection): Use GC_DBGLOG_PRINTF instead of
GC_COND_LOG_PRINTF for heap usage logging; print heap usage in KiB;
log memory heap utilization in percent (using
GC_compute_heap_usage_percent).
* alloc.c (GC_expand_hp_inner): Log increased heap size (in KiB)
instead of increment size.
* include/private/gc_priv.h (TO_KiB_UL): New macro.

12 years agoReplace GC_stats_log_printf with GC_DBG/INFOLOG_PRINTF
Ivan Maidanski [Wed, 12 Dec 2012 16:49:07 +0000 (20:49 +0400)]
Replace GC_stats_log_printf with GC_DBG/INFOLOG_PRINTF
(minimize logging for Android when print_stats is off)

* alloc.c (GC_try_to_collect_inner, GC_stopped_mark,
GC_finish_collection): Use GC_log_printf instead of
GC_stats_log_printf.
* finalize.c (GC_print_finalization_stats): Likewise.
* include/private/gc_priv.h (GC_COND_LOG_PRINTF): Likewise.
* alloc.c (GC_stopped_mark): Use GC_DBGLOG_PRINTF instead of
GC_COND_LOG_PRINTF (useful for Android).
* alloc.c (GC_expand_hp_inner): Reformat comment.
* alloc.c (GC_expand_hp_inner): Use GC_INFOLOG_PRINTF instead of
GC_COND_LOG_PRINTF (useful for Android).
* include/private/gc_priv.h (GC_stats_log_printf): Remove (macro and
prototype).
* include/private/gc_priv.h (GC_DBGLOG_PRINTF, GC_INFOLOG_PRINTF):
New macro (redirecting either to GC_COND_LOG_PRINTF or to
GC_log_printf/GC_info_log_printf if GC_ANDROID_LOG).
* include/private/gc_priv.h (GC_info_log_printf): New prototype (only
if GC_ANDROID_LOG).
* misc.c (GC_stats_log_printf): Rename to GC_info_log_printf.

12 years agoRedirect WRITE to __android_log_write if GC_ANDROID_LOG (Android)
Ivan Maidanski [Wed, 12 Dec 2012 14:52:14 +0000 (18:52 +0400)]
Redirect WRITE to __android_log_write if GC_ANDROID_LOG (Android)
(code refactoring)

* misc.c (GC_stdout, GC_stderr, GC_log): Do not define as static
variable if GC_ANDROID_LOG.
* misc.c (GC_init): Do not allow to set GC_log and GC_stdout/err if
GC_ANDROID_LOG.
* misc.c (GC_ANDROID_LOG_TAG): Move definition (and include
android/log.h) upper to precede GC_write definition for Unix.
* misc.c (GC_stdout, GC_stderr, GC_long): Define specially
for GC_ANDROID_LOG (define to ANDROID_LOG_DEBUG/ERROR logging level).
* misc.c (WRITE): Define specially for GC_ANDROID_LOG (first argument
is used as logging level) redirecting to __android_log_write.
* misc.c (GC_printf, GC_stats_log_printf, GC_verbose_log_printf,
GC_warn_printf, GC_err_puts): Remove __android_log_write call
(unconditionally invoke WRITE instead).
* misc.c (GC_log_printf): Remove Android-specific implementation (use
general instead).
* misc.c (GC_stats_log_printf, GC_verbose_log_printf): Expand
GC_LOG_PRINTF_IMPL macro.
* misc.c (GC_LOG_PRINTF_IMPL): Remove macro.

12 years agoDo not duplicate android_log_write output to GC log file (Android)
Ivan Maidanski [Wed, 12 Dec 2012 04:16:30 +0000 (08:16 +0400)]
Do not duplicate android_log_write output to GC log file (Android)

* include/private/gc_priv.h (GC_real_print_stats): Remove macro.
* include/private/gc_priv.h (GC_print_stats): Define as external
variable (instead of a macro) for GC_ANDROID_LOG (only if not
SMALL_CONFIG).
* misc.c (GC_real_print_stats, GC_init): Replace GC_real_print_stats
back to GC_print_stats.
* misc.c (GC_printf, GC_LOG_PRINTF_IMPL, GC_warn_printf, GC_err_puts):
Do not duplicate output to GC_stdout/err, GC_log if GC_ANDROID_LOG
(after calling __android_log_write).
* misc.c (GC_LOG_PRINTF_IMPL): Remove unused "fileLogCond" argument.
* misc.c (GC_default_warn_proc): Do not duplicate output to
GC_stderr if GC_ANDROID_LOG (before __android_log_assert invocation).

12 years agoReplace GC_COND_LOG_PRINTF calls with WARN for allocation failure messages
Ivan Maidanski [Tue, 11 Dec 2012 16:17:16 +0000 (20:17 +0400)]
Replace GC_COND_LOG_PRINTF calls with WARN for allocation failure messages

* alloc.c (GC_expand_hp_inner): Replace GC_COND_LOG_PRINTF call to
WARN() call (with WARN_PRIdPTR argument type format specifier) for the
message about failure.
* headers.c (GC_scratch_alloc): Likewise.
* mark.c (GC_mark_some, alloc_mark_stack): Likewise.

12 years agoReplace GC_log/err_printf() followed by ABORT with ABORT_ARGn()
Ivan Maidanski [Tue, 11 Dec 2012 05:28:12 +0000 (09:28 +0400)]
Replace GC_log/err_printf() followed by ABORT with ABORT_ARGn()
(code refactoring)

* allchblk.c (GC_freehblk): Replace GC_COND_LOG_PRINTF (or
GC_log_printf, or GC_err_printf) followed by ABORT with ABORT_ARG<n>
(where 'n' is the number of arguments matching format string).
* alloc.c (GC_check_fl_marks): Likewise.
* dbg_mlc.c (GC_debug_change_stubborn, GC_debug_end_stubborn_change,
GC_debug_free, GC_debug_realloc): Likewise.
* dyn_load.c (GC_register_dynamic_libraries): Likewise.
* os_dep.c (GC_get_maps, GC_register_data_segments, GC_remap, PROTECT,
GC_write_fault_handler, GC_mprotect_thread): Likewise.
* pthread_stop_world.c (GC_suspend_all, GC_start_world): Likewise.
* ptr_chck.c (GC_default_same_obj_print_proc,
GC_default_is_valid_displacement_print_proc,
GC_default_is_visible_print_proc): Likewise.
* specific.c (GC_check_tsd_marks): Likewise.
* win32_threads.c (GC_register_my_thread_inner): Likewise.
* include/private/gc_priv.h (ABORT_ARG1, ABORT_ARG2, ABORT_ARG3): New
macro.

12 years agoRemove redundant GC_err_printf before abort
Ivan Maidanski [Tue, 11 Dec 2012 04:11:50 +0000 (08:11 +0400)]
Remove redundant GC_err_printf before abort

* dbg_mlc.c (GC_debug_realloc): Remove redundant GC_err_printf
invocation before abort; refine abort message.
* os_dep.c (GC_register_data_segments): Likewise.

12 years agoEnable on-demand debug logging in GC_FindTopOfStack (Darwin)
Ivan Maidanski [Tue, 11 Dec 2012 04:05:42 +0000 (08:05 +0400)]
Enable on-demand debug logging in GC_FindTopOfStack (Darwin)

* darwin_stop_world.c (GC_FindTopOfStack): Test DEBUG_THREADS_EXTRA
instead of DEBUG_THREADS; uncomment GC_log_printf calls inside
DEBUG_THREADS_EXTRA.

12 years agoPrepend '#' symbol to GC number in logged messages
Ivan Maidanski [Mon, 10 Dec 2012 16:14:43 +0000 (20:14 +0400)]
Prepend '#' symbol to GC number in logged messages

* alloc.c (GC_maybe_gc, GC_stopped_mark): Put '#' sign in printed
messages preceding GC_gc_no value (to identify it as a collection
number).
* include/private/gc_pmark.h (PUSH_CONTENTS_HDR): Likewise.
* malloc.c (GC_free): Likewise.
* mark.c (GC_mark_from): Likewise.
* thread_local_alloc.c (GC_malloc): Likewise.

12 years agoRemove abort on open log failure from GC_write (Win32)
Ivan Maidanski [Mon, 10 Dec 2012 04:40:19 +0000 (08:40 +0400)]
Remove abort on open log failure from GC_write (Win32)

* misc.c (GC_write): Do not abort (unconditionally) if
GC_CreateLogFile failed, return -1 (or, even, 0 if NO_DEBUGGING)
instead; update comment (Win32 only).

12 years agoRemove DebugBreak on WriteFile failure (Win32)
Ivan Maidanski [Mon, 10 Dec 2012 04:31:32 +0000 (08:31 +0400)]
Remove DebugBreak on WriteFile failure (Win32)

* misc.c (GC_write): Rename "tmp" local variable to "res"; remove
DebugBreak on WriteFile failure since DebugBreak is a part of ABORT
unless NO_DEBUGGING (only for MSWIN32 and MSWINCE targets).

12 years agoPrevent abort on GC_err/warn_printf write failure
Ivan Maidanski [Mon, 10 Dec 2012 03:46:03 +0000 (07:46 +0400)]
Prevent abort on GC_err/warn_printf write failure

* misc.c (GC_LOG_PRINTF_IMPL, GC_warn_printf): Do not abort in case of
failure of write which duplicates message to log/stderr (if
GC_ANDROID_LOG).
* misc.c (GC_err_puts): Do not abort in case of stderr write failure.

12 years agoMerge branch 'add-long-weakref'
Ivan Maidanski [Sun, 9 Dec 2012 19:30:22 +0000 (23:30 +0400)]
Merge branch 'add-long-weakref'

12 years agoAdd assertion to GC_enable() ensuring no counter underflow
Ivan Maidanski [Sun, 9 Dec 2012 19:24:51 +0000 (23:24 +0400)]
Add assertion to GC_enable() ensuring no counter underflow

* misc.c (GC_enable): Add assertion against GC_dont_gc underflow.

12 years agoFix typo and refine comment of GC_enable in public header
Ivan Maidanski [Sun, 9 Dec 2012 19:15:28 +0000 (23:15 +0400)]
Fix typo and refine comment of GC_enable in public header

* include/gc.h (GC_enable): Fix typo and refine comment.

12 years agoMerge branch 'master' into add-long-weakref
Ivan Maidanski [Sun, 9 Dec 2012 18:41:54 +0000 (22:41 +0400)]
Merge branch 'master' into add-long-weakref

Conflicts:
finalize.c

12 years agoAdd tests for GC_register/move/unregister_long_link
Ivan Maidanski [Sun, 9 Dec 2012 18:36:09 +0000 (22:36 +0400)]
Add tests for GC_register/move/unregister_long_link

* tests/test.c (live_long_refs): New global variable (only if
not GC_LONG_REFS_NOT_NEEDED and not MACOS).
* tests/test.c (mktree): Test GC_REGISTER_LONG_LINK,
GC_move_long_link, GC_unregister_long_link (using live_long_refs)
unless GC_LONG_REFS_NOT_NEEDED.
* tests/test.c (check_heap_stats): Define "still_long_live" local
variable, count non-null elements of live_long_refs, print number of
non-null elements of live_long_refs (if any) unless
GC_LONG_REFS_NOT_NEEDED.

12 years agoUpdate TODO (add FIXME regarding Win32 threads)
Ivan Maidanski [Sat, 8 Dec 2012 08:49:15 +0000 (12:49 +0400)]
Update TODO (add FIXME regarding Win32 threads)

12 years agoMake GC_generic_malloc_ignore_off_page() public
Ivan Maidanski [Sat, 8 Dec 2012 08:39:07 +0000 (12:39 +0400)]
Make GC_generic_malloc_ignore_off_page() public

* include/gc_mark.h (GC_generic_malloc): Refine comment.
* include/gc_mark.h (GC_generic_malloc_ignore_off_page): Move
prototype from gc_priv.h and make it public; add GC_ATTR_MALLOC
attribute.
* include/private/gc_priv.h (GC_generic_malloc): Move comment to
gc_mark.h.
* include/private/gc_priv.h (GC_generic_malloc_ignore_off_page):
Remove GC-inner prototype.
* include/private/gc_priv.h (GC_generic_malloc_inner): Update comment.
* mallocx.c (GC_generic_malloc_ignore_off_page): Likewise.
* mallocx.c (GC_generic_malloc_ignore_off_page): Make public.

12 years agoUpdate AUTHORS file
Ivan Maidanski [Sat, 8 Dec 2012 06:34:50 +0000 (10:34 +0400)]
Update AUTHORS file

12 years agoFix GC_malloc_explicitly_typed_ignore_off_page for large allocations
Reimer Behrends [Sat, 8 Dec 2012 06:33:06 +0000 (10:33 +0400)]
Fix GC_malloc_explicitly_typed_ignore_off_page for large allocations

* typd_mlc.c (GC_malloc_explicitly_typed_ignore_off_page): Use
BYTES_TO_GRANULES instead of BYTES_TO_WORDS when calculating "lg"
local variable value.

12 years agoFix GC_remove_all_threads_but_me for Android (fork support)
Ivan Maidanski [Fri, 30 Nov 2012 14:01:30 +0000 (18:01 +0400)]
Fix GC_remove_all_threads_but_me for Android (fork support)

* pthread_support.c (GC_remove_all_threads_but_me): Update kernel_id
of "me" (if PLATFORM_ANDROID).

12 years agoAllow pthread_kill error code logging in GC_suspend/resume (debugging)
Ivan Maidanski [Fri, 30 Nov 2012 04:08:20 +0000 (08:08 +0400)]
Allow pthread_kill error code logging in GC_suspend/resume (debugging)

* pthread_stop_world.c (GC_suspend_all, GC_start_world): Log
pthread_kill error code on failure if DEBUG_THREADS.