Fetching contributors…
Cannot retrieve contributors at this time
8276 lines (7466 sloc) 372 KB
== [7.3alpha4] (development) ==
* Add GC_push_all/conditional() to GC public API.
* Add note about 'pkg-config' solving problem with autoconf 2.68 or older.
* Add public GC_set/get_abort_func to replace default GC_on_abort.
* Add public setter and getter for GC_push_other_roots.
* Add thread suspend/resume signals public setters (POSIX threads).
* Call GC_on_abort (with NULL argument) on exit(1).
* Check GC_base result in GC_print_all_smashed_proc.
* Check traceable_allocator.allocate result before dereference in test_cpp.
* Code refactoring of GC_x_printf (move shared code to macro).
* Define old_bus_handler static variable only if used (Unix).
* Disable find-leak GC_gcollect on GC abnormal EXIT.
* Do not define _setjmp/_longjmp macros in mach_dep.c.
* Elaborate comment on dependencies in
* Eliminate 'cast from int to pointer' warning in GC_exclude_static_roots.
* Eliminate 'missing exception specification' warning in (Clang).
* Eliminate 'uninitialized variable use' warning in test_printf (cord).
* Eliminate 'unused result' compiler warning in main() of test_cpp.
* Eliminate 'unused value' compiler warning in GC_stop_world (Pthreads).
* Eliminate Clang warning for GC_pthread_exit attribute.
* Eliminate GCC warning in GC_get_main_stack_base (OpenBSD).
* Eliminate GCC warnings in setjmp_t.c, test_cpp and cord 'de' app.
* Eliminate SIGBUS-related dead code in GC_write_fault_handler (Linux).
* Eliminate warning and simplify expression in GC_init_explicit_typing.
* Enable 'force GC at every GC_malloc' debug-related functionality.
* Fix GC_CreateThread and GC_beginthreadex definition for Cygwin.
* Improve staticrootstest checks (tests).
* Include "config.h" instead of "private/config.h" on HAVE_CONFIG_H.
* Include proper header file in 'tools' for configuration macros.
* Include pthread_np.h from pthread_stop_world.c on OpenBSD.
* Log error messages to stderr instead of stdout in tests.
* Minimize code duplication in GC_mark_and_push.
* Move 'include setjmp.h' from mach_dep.c to gc_priv.h.
* Move GC_get_suspend/thr_restart_signal to misc.c for NaCl and OpenBSD.
* Port BDWGC to Android/x86.
* Postpone the suspend signal in GC_dirty_init only if used to stop world.
* Put gc_cpp symbols into 'boehmgc' namespace if GC_NAMESPACE defined.
* Recognize GC_DONT_GC macro in gc.h (causes GC_INIT to turn off GC).
* Recognize GC_SIG_SUSPEND and GC_SIG_THR_RESTART tuning macros in gc.h.
* Remove nested EXPECT in GC_core_finalized_malloc.
* Remove nested always-false ifdef for HPUX and FREEBSD.
* Replace SIG_SUSPEND/THR_RESTART macros to variables in pthread_stop_world.
* Replace sprintf with defensive snprintf.
* Replace var-args GC_noop with GC_noop6 (to eliminate Clang warning).
* Specify GC_malloc result is unused in some tests.
* Specify GC_pthread_join result is unused in threadkey_test.
* Turn off GC_LOOP_ON_ABORT functionality if GC compiled with NO_DEBUGGING.
* Use memcpy (BCOPY) instead of strcpy (to suppress GCC warning).
== [7.3alpha2] 2012-05-11 ==
* Add 'const' qualifier to pointer argument of some API functions.
* Add GC_UNDERSCORE_STDCALL, UNICODE macro templates to configure (Win32).
* Add GC_get_thr_restart_signal, GC_thread_is_registered to GC API.
* Add GC_is_heap_ptr, GC_move_disappearing_link to GC API.
* Add SHORT_DBG_HDRS macro template to configure.
* Add Symbian port to mainline.
* Add TODO file.
* Add assertion ensuring proper alignment of 'pushed' GC symbols.
* Add assertion in GC_getspecific on qtid.
* Add assertion to GC_incremental_protection_needs, refine documentation.
* Add assertion to check GC_large_free_bytes by GC_finish_collection.
* Add configure option to compile all library .c files into single gc.o.
* Add cordtest to make check.
* Add disclaim callbacks for efficient finalization (ENABLE_DISCLAIM).
* Add finalization.html to 'doc' folder.
* Add javaxfc.h to the installation set of GC header files (configure).
* Add on-heap-resize event notification to API.
* Adjust GC_log_printf format specifiers (regarding signed/unsigned long).
* Adjust GC_requested_heapsize on GC_init if GC_INITIAL_HEAP_SIZE given.
* Allow GC_exclude_static_roots() region start to be unaligned.
* Allow Win32 DllMain chaining on the client side.
* Allow to exclude finalization support by GC_NO_FINALIZATION macro.
* Allow to get memory via Win32 VirtualAlloc (USE_WINALLOC) on Cygwin.
* Avoid unnecessary GC_find_limit invocation if GC_no_dls.
* Avoid use of deprecated GC_dont_gc and GC_stackbottom in gctest.
* Cast pointers to word (instead of unsigned long) in specific.h.
* Changed the order in so ltmain exists in time for automake.
* Declare privately and use handy GC_base_C() for constant object pointers.
* Define GC_DLL if DLL_EXPORT at GC build (for Cygwin/MinGW).
* Define GC_READ_ENV_FILE in configure for WinCE unless gc-debug is off.
* Do not compile backgraph.c unless configure '--enable-gc-debug'.
* Do not compile pthread_stop_world.c for Cygwin/Darwin (configure).
* Do not install ancient new_gc_alloc.h broken for modern STL (configure).
* Enable GC_MIN_MARKERS to set minimal number of pthread-based markers.
* Enable PARALLEL_MARK and THREAD_LOCAL_ALLOC for FreeBSD in configure.
* Enable parallel mark by default in configure (Darwin/Linux/Solaris/Win32).
* Export GC_is_marked, GC_clear/set_mark_bit (for mark-bit manipulation).
* Extend thread-related debug messages.
* Fix 'configure --enable-cplusplus' for Cygwin/MinGW.
* Fix DATASTART (and other minor improvements) for NaCl target.
* Fix GC_setspecific to prevent garbage collection inside.
* Fix compiler warning in cordtest.
* Fix minor warnings reported by GCC with '-pedantic' option.
* Fix static data roots registration on Android (if GC is shared).
* Implement GC_get_stack_base for Darwin for single-threaded mode.
* Improve GC_allochblk algorithm of block splitting when unmapping enabled.
* Improve GC_collect_or_expand algorithm for many finalizers registered case.
* In tests, print a message in case a test is a no-op.
* Instruct configure to hide internal symbols if supported by GCC.
* Log amount of unmapped memory (if enabled) on marking-for-collection.
* Make __data_start a weak symbol to allow loading modules on mips.
* Move "cord" library tests to "cord/tests" folder.
* Move asm machine-dependent files to "src" folder.
* Move build tools sources to "tools" folder.
* Move cord_pos.h to public headers folder.
* Open log file in APPEND mode on Win32 (similar that on Unix/Cygwin).
* Optimize some functions by moving pthread_self calls out of LOCK section.
* Place only major per-release changes description to ChangeLog (this file).
* Prevent compiler warnings in GC_FindTopOfStack and GC_ports (Darwin).
* Recognize GC_LOG_TO_FILE_ALWAYS macro to log to 'gc.log' by default.
* Remove all auto-generated files from the repo.
* Remove binary icon file for de_win.
* Remove cordtest from "cord" library.
* Remove duplicate MacOS_Test_config.h file.
* Remove gc_amiga_redirects.h (included internally) from public headers.
* Remove obsolete Makefile.DLL (superseded by Cygwin/MinGW configure).
* Remove obsolete unused asm files for ALPHA, HPUX, SGI, RS6000, ULTRIX.
* Remove unsupported MMAP_STACKS (specific to Solaris threads).
* Remove unused ancient SILENT, __STDC__, NO_SIGNALS macros.
* Replace ARGSUSED comment-based annotation with GCC 'unused' attribute.
* Replace GC_ms_entry declaration with opaque definition for public API.
* Replace long GC_markers global variable with int GC_markers_m1.
* Replace pointer relational comparisons with non-pointer ones.
* Replace printf PRIxMAX specifier with '%p' for thread id debug output.
* Require autoconf 2.61 instead of v2.64.
* Simplify (use autoreconf).
* Split GC_abort with GC_on_abort and abort() invoked from ABORT.
* Support GC_ATTR_MALLOC for MS VisualStudio.
* Tag auxiliary malloc-like API functions with 'malloc' attribute.
* Tag deprecated variables in GC API.
* Tag must-be-non-null arguments of GC API functions.
* Turn on "extra" GCC warnings.
* Turn on unused-parameter checking for GCC.
* Update AUTHORS file.
* Use EXPECT for checking various 'initialized' boolean variables.
* Use USE_COMPILER_TLS on Cygwin.
* Use pthread_key for thread-local storage on FreeBSD.
* Use union of AO_t and word to favor strict-aliasing compiler optimization.
== [7.2e] (candidate) ==
* Fix GC_clear_stack by declaring 'dummy' local array as volatile.
* Fix GC_get_stack_base assembly code (Cygwin/Clang).
* Fix GC_unix_mmap_get_mem for open of /dev/zero failure.
* Fix min_bytes_allocd preventing potential infinite loop in GC_allocobj.
* Fix null-pointer dereference in CORD_substr_closure.
* Fix potential double fclose in test_extras (cordtest).
* Fix pthread_attr_t resource leak in pthread_create.
* Fix sizeof in GC_push_thread_structures.
* Fix unportable '==' test operators in configure.
* Fix vsprintf_args cleanup in CORD_vsprintf.
== [7.2d] 2012-08-09 ==
* Fix GC_call_with_stack_base to prevent its tail-call optimization.
* Fix all address-of-dummy operations by using GC_approx_sp() instead.
* Fix stop_info.stack_ptr assignment in GC_suspend_all for OpenBSD.
* Fix test_cpp (ensure the collector recognizes pointers to interiors).
* Fix thread-related tests for pthreads-w32.
* test_cpp: Fix WinMain to prevent SEGV if zero arguments passed (MinGW).
== [7.2c] 2012-06-11 ==
* Fix CORD_cat_char_star to prevent SEGV in case of out-of-memory.
* Fix GC_FirstDLOpenedLinkMap() for NetBSD 6 release.
* Fix GC_scratch_alloc and GC_get_maps invocations to prevent SEGV.
* Fix visibility of GC_clear/set_mark_bit (unhide symbols).
* Fix visibility of GC_push_all/conditional, GC_push_other_roots symbols.
== [7.2b] 2012-05-23 ==
* Fix assertion in GC_malloc_[atomic_]uncollectable (THREADS case only).
== [7.2] 2012-05-11 ==
* Abort in GC_thr_init on pthread_atfork failure (POSIX threads).
* Add GC_WIN32_PTHREADS target in configure.
* Add GC_is_disabled new function to GC API.
* Add info that getcontext() resets FPE mask no longer on Linux/x86_64.
* Add public GC_set_handle_fork to control forked child handling support.
* Add realloc_test.c test.
* Add support for Hexagon target.
* Add thread-safe GC_get_heap_usage_safe to GC API.
* Change GC_check_fl_marks prototype and implementation.
* Check pthread_create/join result in test.
* Define GC_DLL (in configure) if building only dynamic libraries.
* Define NO_DEBUGGING (in configure) if "--disable-gc-debug" is set.
* Disable incremental mode on Darwin if fork handling requested.
* Enable parallel marker in configure for Solaris.
* Fix "comparison of signed and unsigned values" compiler warnings.
* Fix 'volatile' keyword placement in GC_SysVGetDataStart.
* Fix GC_READ_ENV_FILE code for Cygwin.
* Fix GC_add_roots_inner for Mac OS X (align segment start).
* Fix GC_check_fl_marks regarding concurrent access.
* Fix GC_finalizer_nested size to workaround alignment problem in Watcom.
* Fix GC_find_limit_with_bound to always reset fault handler on return.
* Fix GC_init static assertion for clang/x64 (Darwin).
* Fix GC_init[_lib_bounds] and GC_get_main_stack_base for malloc redirection.
* Fix GC_push_all/selected boundaries check.
* Fix GC_register_my_thread marking thread as detached (Cygwin/pthreads-w32).
* Fix GC_remove_all_threads_but_me to cleanup thread-specific data storage.
* Fix GC_restart_handler to preserve errno if needed.
* Fix GC_root_size update in GC_add_roots_inner (Win32).
* Fix GC_unregister_my_thread to ensure no ongoing incremental GC (Win32).
* Fix GC_with_callee_saves_pushed for clang (disable __builtin_unwind_init).
* Fix calloc, GC_generic_malloc to check for allocation size overflows.
* Fix compiler warning in GC_dyld_image_add/remove (Darwin).
* Fix configure --enable-cplusplus make install.
* Fix configure to disable GCC aliasing optimization unless forced to.
* Fix duplicate definitions in gcconfig.h for NetBSD.
* Fix fork() support on Cygwin and Darwin targets.
* Fix gc.h compatibility regression regarding GC_PTR, GC_I_HIDE_POINTERS.
* Fix for Cygwin (remove duplicate function definition).
* Fix gcconfig.h to define USE_GET_STACKBASE_FOR_MAIN for Android.
* Fix gcconfig.h to handle mips64-linux target.
* Fix gctest (for Win32) to avoid GC_print_stats internal variable usage.
* Fix mach_dep.c to include sys/ucontext.h on Mac OS X 10.6.
* Fix tests to check GC_malloc result for NULL (out-of-memory).
* Fix thread model in configure for MinGW ("win32" instead of "posix").
* Fix various warnings reported by LINT-like tools.
* Fix visibility of some GC internal symbols used by GNU GCJ currently.
* Port some thread tests to Win32.
* Refine API GC setters and getter comments regarding locking.
* Refine GC_stackbottom description in gc.h.
* Remove duplicate calls in GC_register_dynamic_libraries.
* Remove locking in API GC_get_bytes_since_gc and friends.
* Remove newly-added GC_get_heap_size/free_bytes_inner from API.
* Remove some local variables that are unused.
* Support multi-threading for RTEMS target.
* Use global GC_noop_sink variable in GC_noop1 to suppress compiler warning.
* Use pkg-config to pick up libatomic_ops, etc.
* Workaround some Linux/arm kernels bug to get correct GC_nprocs value.
== [7.2alpha6] 2011-06-14 ==
* Remove.
* (dist gc.tar): Remove
* NT_STATIC_THREADS_MAKEFILE (.cpp.obj): Remove duplicate .cpp
filename passed.
* NT_X64_THREADS_MAKEFILE (.cpp.obj): Use lowercase file
* NT_X64_STATIC_THREADS_MAKEFILE (.cpp.obj): Likewise.
* NT_MAKEFILE (.cpp.obj): Likewise.
* alloc.c (GC_add_current_malloc_heap, GC_build_back_graph,
GC_traverse_back_graph): Move prototype to gc_priv.h.
* checksums.c (GC_page_was_ever_dirty): Likewise.
* dbg_mlc.c (GC_default_print_heap_obj_proc): Likewise.
* dyn_load.c (GC_parse_map_entry, GC_get_maps,
GC_segment_is_thread_stack, GC_roots_present, GC_is_heap_base,
GC_get_next_stack): Likewise.
* finalize.c (GC_reset_finalizer_nested,
GC_check_finalizer_nested): Likewise.
* gcj_mlc.c (GC_start_debugging, GC_store_debug_info): Likewise.
* malloc.c (GC_extend_size_map, GC_text_mapping): Likewise.
* mark_rts.c (GC_mark_thread_local_free_lists): Likewise.
* misc.c (GC_register_main_static_data, GC_init_win32,
GC_setpagesize, GC_init_linux_data_start,
GC_set_and_save_fault_handler, GC_init_dyld, GC_init_netbsd_elf,
GC_initialize_offsets, GC_bl_init, GC_do_blocking_inner,
GC_bl_init_no_interiors): Likewise.
* os_dep.c (GC_greatest_stack_base_below, GC_push_all_stacks):
* reclaim.c (GC_check_leaked): Likewise.
* win32_threads.c (GC_gww_dirty_init): Likewise.
* darwin_stop_world.c (GC_is_mach_marker, GC_mprotect_stop,
GC_mprotect_resume): Move prototype to darwin_stop_world.h.
* pthread_support.c (GC_FindTopOfStack): Likewise.
* dyn_load.c (GC_cond_add_roots): Merge adjacent definitions.
* mark.c (GC_page_was_ever_dirty): Remove (as already declared).
* mark_rts.c (GC_roots_present): Change return type to void
pointer (to match the prototype); return NULL instead of FALSE.
* mark_rts.c (GC_add_roots_inner): Cast GC_roots_present() result.
* os_dep.c (NEED_PROC_MAPS): Move definition to gcconfig.h.
* os_dep.c (GC_write_fault_handler): Make STATIC.
* os_dep.c (GC_set_write_fault_handler): New function (only if
* pthread_start.c (GC_start_rtn_prepare_thread,
GC_thread_exit_proc): Move prototype to pthread_support.h.
* pthread_support.c (GC_nacl_initialize_gc_thread,
GC_nacl_shutdown_gc_thread, GC_unblock_gc_signals):
* pthread_support.c (GC_stop_init): Move prototype to
* win32_threads.c (GC_write_fault_handler): Remove prototype.
* win32_threads.c (GC_register_my_thread_inner): Call
GC_set_write_fault_handler instead of SetUnhandledExceptionFilter
(only if MPROTECT_VDB).
* doc/README.win32: Add information about DMC.
* include/private/gc_priv.h (GC_set_write_fault_handler): New
prototype (only if GC_WIN32_THREADS and MPROTECT_VDB).
* misc.c (vsnprintf): Redirect to vsprintf() if NO_VSNPRINTF.
* win32_threads.c (GC_unregister_my_thread): Use KNOWN_FINISHED()
instead of FINISHED macro.
* tests/test.c (check_heap_stats): Round up max_heap_sz value for
Win32 (same as for USE_MMAP).
* tests/test.c (check_heap_stats): Adjust printf format specifier
for max_heap_sz; cast max_heap_sz accordingly.
* doc/README.solaris2: Add note.
* (SOLARIS25_PROC_VDB_BUG_FIXED): Don't define for
Solaris/x86 2.10+.
* tests/threadkey_test.c (SKIP_THREADKEY_TEST): Skip the test if
defined; explicitly define for some targets.
* mark.c (GC_dirty): Add prototype (only if MANUAL_VDB).
* stubborn.c (GC_dirty): Likewise.
* include/private/gcconfig.h (GWW_VDB, MPROTECT_VDB, PCR_VDB,
PROC_VDB): Undefine if MANUAL_VDB.
* include/private/gcconfig.h (DEFAULT_VDB): Don't define if
* os_dep.c (async_set_pht_entry_from_index): Define for
* os_dep.c (GC_read_dirty): Set GC_dirty_maintained only if
success; if ioctl() failed then just print warning instead of
* include/private/gc_priv.h (GC_ASSERT): Use "%d" (instead of %ld)
for line number printing.
* os_dep.c (GC_read_dirty): Add debug logging if DEBUG_DIRTY_BITS
(for PROC_VDB only); print errors via GC_err_printf; rename "ps"
and "np" local variables to npages and pagesize, respectively;
remove "current_addr" local variable.
* os_dep.c (GC_get_main_stack_base): Convert to GC_get_stack_base
for BeOS and OS/2; define HAVE_GET_STACK_BASE.
* os_dep.c (GET_MAIN_STACKBASE_SPECIAL): Define when a specific
GC_get_main_stack_base implementation is defined.
* os_dep.c (GC_get_main_stack_base): Define that based on
GC_get_stack_base() in a single place (only if
GET_MAIN_STACKBASE_SPECIAL is unset); check GC_get_stack_base()
* mark.c (GC_push_selected): Remove "push_fn" argument (use
GC_push_all directly); update the documentation.
* mark.c (GC_push_conditional): Simplify the code (for better
* mark.c (alloc_mark_stack): Use FALSE/TRUE (instead of 0/1) for
boolean local variables.
* doc/README.macros (GC_PREFER_MPROTECT_VDB): Update.
* os_dep.c (GC_page_was_dirty, GC_page_was_ever_dirty,
GC_remove_protection): Define for GWW_VDB and PROC_VDB in a single
* os_dep.c (GC_page_was_dirty, GC_page_was_ever_dirty): Compute
PHT_HASH(h) only once (store result to a local variable).
* doc/README.solaris2: Update.
* include/private/gcconfig.h (end, InitStackBottom): Declare
extern variable for RTEMS.
* include/private/gcconfig.h (DATASTART, DATAEND, STACKBOTTOM):
Update (for RTEMS).
* include/private/gcconfig.h (DATAEND): Fix a typo in the macro
name (for RTEMS).
* include/private/gcconfig.h (MPROTECT_VDB): Enable for Solaris in
single-threaded environment.
* include/private/gcconfig.h (MPROTECT_VDB): Undefine if PROC_VDB.
* tests/test.c (NUMBER_ROUND_UP): New macro.
* tests/test.c (check_heap_stats): Round up total expected heap
size to the nearest 4 MiB bound.
* tests/test.c (check_heap_stats): Print the current and expected
heap sizes in case of failure.
* checksums.c (GC_check_blocks, GC_check_dirty): Do log printing
only if GC_print_stats; print errors using GC_err_printf.
* checksums.c (GC_check_blocks): Join adjacent printf() calls into
a single one.
* pthread_support.c (pthread_join): Add assertion (check thread is
* pthread_support.c (GC_register_my_thread): Don't detach the
thread if invoked from the thread destructor.
* win32_threads.c (GC_register_my_thread): Likewise.
* win32_threads.c (GC_unregister_my_thread): Don't delete the
thread (just set FINISHED) if the thread is not detached (only if
GC_PTHREADS); add assertion (check the thread is not finished).
* tests/threadkey_test.c (main): Join some created threads.
* pthread_support.c (GC_delete_gc_thread): Rename "gc_id" local
variable to "t".
* win32_threads.c (GC_delete_gc_thread): Likewise.
* pthread_support.c (pthread_join, pthread_detach,
pthread_cancel): Rename "thread_gc_id" local variable to "t".
* win32_threads.c (GC_pthread_detach): Likewise.
* win32_threads.c (GC_delete_gc_thread): Remove "gc_nvid" local
* win32_threads.c (GC_pthread_join): Rename "joinee" local
variable to "t".
* pthread_stop_world.c (pthread_sigmask): Undefine even if not
* pthread_stop_world.c (GC_unblock_gc_signals): New function (only
* pthread_support.c (GC_unblock_gc_signals): New prototype.
* pthread_support.c (GC_register_my_thread_inner,
GC_register_my_thread): Call GC_unblock_gc_signals (only if
* include/private/gcconfig.h (GC_EXPLICIT_SIGNALS_UNBLOCK): New
* pthread_stop_world.c (GC_suspend_handler_inner): Remove "dummy",
"sig" local variables; rename my_thread local variable to "self".
* tests/threadkey_test.c (LIMIT): Use smaller value (don't create
more than 30 in parallel by default).
* tests/threadkey_test.c (key_once, main): Work around for Solaris
* tests/threadkey_test.c (LIMIT): Use smaller value for Solaris.
* dyn_load.c (GC_FirstDLOpenedLinkMap): Remove unused "r" local
* pthread_support.c (GC_unregister_my_thread_inner): Revert back
GC_remove_specific invocation; add a comment.
* include/private/thread_local_alloc.h (GC_remove_specific):
Revert back.
* specific.c (slow_getspecific): Cast qtid to AO_t.
* include/private/specific.h (key_create, setspecific,
remove_specific): Remove "extern" keyword.
* include/private/specific.h (getspecific): Change type of "qtid"
local variable to unsigned long.
* pthread_support.c (GC_check_tls): Fix "#endif" comment.
* include/gc.h (GC_REDIRECT_TO_LOCAL): Remove deprecated comment.
* include/private/thread_local_alloc.h (THREAD_LOCAL_ALLOC):
Remove redundant test of the macro.
* backgraph.c (add_edge): Recognize DEBUG_PRINT_BIG_N_EDGES macro.
* os_dep.c (GC_set_and_save_fault_handler): Recognize
* pthread_support.c (mark_mutex): Recognize GLIBC_2_1_MUTEX_HACK
* pthread_support.c (GC_acquire_mark_lock): Remove commented out
* include/private/gc_priv.h (SUNOS5SIGS): Don't include
sys/siginfo.h on Linux.
* include/private/gcconfig.h (FORCE_WRITE_PREFETCH): New macro
recognized, force PREFETCH_FOR_WRITE to be defined on x86.
* include/private/gcconfig.h (USE_HPUX_FIXED_STACKBOTTOM): New
macro recognized (for HP/UX).
* os_dep.c (GC_gww_page_was_ever_dirty): Fix comment (for
* os_dep.c (GC_dirty_init): Use memset() for GC_written_pages
resetting (for PROC_VDB).
* tests/threadkey_test.c: New file.
* tests/ (TESTS, check_PROGRAMS): Add 'threadkey_test'.
* tests/ (threadkey_test_SOURCES, threadkey_test_LDADD):
New variable.
* pthread_support.c (GC_unregister_my_thread_inner): Don't call
* include/private/thread_local_alloc.h (GC_remove_specific):
Remove (since it is empty for all targets).
* pthread_support.c (GC_record_stack_base): New inline function.
* win32_threads.c (GC_record_stack_base): Likewise.
* pthread_support.c (GC_register_my_thread_inner): Invoke
* win32_threads.c (GC_register_my_thread_inner): Likewise.
* pthread_support.c (GC_register_my_thread): If thread is FINISHED
then call GC_record_stack_base, clear FINISHED, initialize
thread-local list and return success.
* win32_threads.c (GC_register_my_thread): Likewise.
* include/gc.h (GC_register_my_thread): Update documentation.
* include/private/thread_local_alloc.h (GC_thread_key): Likewise.
* thread_local_alloc.c (GC_malloc, GC_malloc_atomic): Join
adjacent "#ifdef".
* thread_local_alloc.c (GC_malloc_atomic): Call
GC_core_malloc_atomic (instead of GC_core_malloc).
* pthread_start.c (GC_start_rtn_prepare_thread): Change return
type to GC_thread.
* pthread_start.c (GC_inner_start_routine): Pass the current
thread descriptor to pthread_cleanup_push (same as in
* pthread_stop_world.c (GC_push_all_stacks): Rename "me" local
variable to "self".
* win32_threads.c (GC_push_all_stacks): Likewise.
* pthread_stop_world.c (GC_suspend_all, GC_start_world): Rename
"my_thread" local variable to "self".
* pthread_support.c (GC_unregister_my_thread_inner): New static
* pthread_support.c (GC_unregister_my_thread,
GC_thread_exit_proc): Use GC_unregister_my_thread_inner.
* win32_threads.c (GC_register_my_thread, GC_unregister_my_thread,
GC_do_blocking_inner): Rename "t" local variable to "thread_id".
* win32_threads.c (GC_wait_marker, GC_notify_all_marker): Rename
"id" local variable to "thread_id".
* pthread_support.c (GC_unregister_my_thread): Call pthread_self
only once.
* win32_threads.c (GC_pthread_start_inner): Likewise.
* pthread_support.c (GC_unregister_my_thread): Add debug output.
* win32_threads.c (GC_unregister_my_thread): Likewise.
* pthread_support.c (GC_register_my_thread,
GC_start_rtn_prepare_thread): Rename "my_pthread" local variable
to "self".
* include/gc.h (GC_HIDE_POINTER, GC_REVEAL_POINTER): Define
unconditionally (do not test GC_I_HIDE_POINTERS); update the
* include/gc.h (HIDE_POINTER, REVEAL_POINTER): Define as alias to
* include/private/gc_pmark.h (GC_I_HIDE_POINTERS): Do not define.
* include/private/gc_priv.h (GC_I_HIDE_POINTERS): Likewise.
* include/gc.h (GC_register_my_thread): Refine the comment.
* include/gc_inline.h (GC_MALLOC_WORDS, GC_CONS): Add missing
* include/gc_typed.h (GC_get_bit, GC_set_bit,
* include/private/gcconfig.h (NO_GETCONTEXT): Add missing ')'.
* include/private/gcconfig.h (NO_GETCONTEXT): Do not use
getcontext(2) on m68k because it is not implemented there.
* alloc.c (GC_clear_a_few_frames): Use BZERO().
* mark_rts.c (GC_clear_roots, GC_rebuild_root_index): Likewise.
* reclaim.c (GC_start_reclaim): Likewise.
* blacklst.c (total_stack_black_listed): Remove "len" local
* dbg_mlc.c (GC_generate_random_valid_address): Replace "for"
statement with "do-while" one.
* dyn_load.c (GC_register_dynamic_libraries,
GC_register_dynlib_callback): Remove redundant parentheses.
* cord/cordxtra.c (CORD_from_file_lazy_inner): Suppress
"unused result" compiler warning for fread().
* os_dep.c (GC_write_fault_handler): Break when in_allocd_block
is set to true.
* dbg_mlc.c (GC_has_other_debug_info): Change return type to int;
return -1 if the object has (or had) debugging info but was
marked deallocated.
* include/private/dbg_mlc.h (GC_has_other_debug_info): Likewise.
* dbg_mlc.c (GC_has_other_debug_info): Update documentation;
remove "ohdr" local variable.
* dbg_mlc.c (GC_debug_free): Don't call GC_free if the object has
probably been deallocated.
* dbg_mlc.c (GC_debug_free): Don't actually free the object even
in the leak-finding mode if GC_findleak_delay_free.
* dbg_mlc.c (GC_check_leaked): New function (only unless
* doc/README.environment (GC_FINDLEAK_DELAY_FREE): Document.
* doc/README.macros (GC_FINDLEAK_DELAY_FREE): Likewise.
* include/private/dbg_mlc.h (START_FLAG, END_FLAG): Use GC_WORD_C
on 64-bit architectures.
* include/private/dbg_mlc.h (NOT_MARKED): Remove redundant
* include/private/dbg_mlc.h (GC_HAS_DEBUG_INFO): Update (due to
GC_has_other_debug_info change).
* include/private/gc_priv.h (GC_findleak_delay_free): New global
variable declaration (unless SHORT_DBG_HDRS).
* misc.c (GC_findleak_delay_free): New global variable; recognize
* misc.c (GC_init): Recognize GC_FINDLEAK_DELAY_FREE environment
variable (unless SHORT_DBG_HDRS).
* reclaim.c (GC_check_leaked): Declare (unless SHORT_DBG_HDRS).
* reclaim.c (GC_add_leaked): Don't add the object to leaked list
if marked as deallocated.
* dbg_mlc.c (GC_has_other_debug_info): Fix punctuation in the
* dbg_mlc.c (GC_FREED_MEM_MARKER): New macro.
* dbg_mlc.c (GC_debug_free): Use GC_FREED_MEM_MARKER.
* dbg_mlc.c (GC_smashed): Refine documentation.
* mark.c (GC_push_selected): Change dirty_fn return type to
* os_dep.c (GC_page_was_ever_dirty): Make GC_INNER.
* reclaim.c (GC_reclaim_small_nonempty_block): Remove "kind"
local variable.
* reclaim.c (GC_reclaim_block): Pass true constant to
GC_reclaim_small_nonempty_block (instead of report_if_found).
* doc/README.autoconf: Update; fix a typo.
* include/private/gcconfig.h (GC_WORD_C): New macro.
* dbg_mlc.c (GC_store_debug_info_inner): Cast "linenum".
* dbg_mlc.c (GC_check_annotated_obj): Fix punctuation in the
* dbg_mlc.c (GC_print_smashed_obj): Add (and print) "msg"
* dbg_mlc.c (GC_debug_free, GC_print_all_smashed_proc): Pass
message to GC_print_smashed_obj.
* dbg_mlc.c (GC_debug_free): Call GC_size once.
* dbg_mlc.c (GC_debug_realloc): Calculate old_sz only if
allocation succeeded; remove unnecessary check for object is
smashed (since this is done in GC_debug_free); remove "clobbered"
local variable.
* dbg_mlc.c (GC_store_debug_info_inner, GC_store_debug_info):
Rename "integer" argument to "linenum"; change the type of the
argument to int.
* gcj_mlc.c (GC_store_debug_info): Likewise.
* dbg_mlc.c (GET_OH_LINENUM): New macro.
* dbg_mlc.c (GC_print_obj, GC_print_smashed_obj): Use
GET_OH_LINENUM; adjust print format specifier.
* dbg_mlc.c (GC_debug_malloc, GC_debug_malloc_ignore_off_page,
GC_debug_malloc_stubborn, GC_debug_malloc_atomic,
GC_debug_malloc_atomic_uncollectable): Remove unnecessary cast of
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
* os_dep.c (GC_linux_stack_base): Rename to
* os_dep.c (GC_freebsd_stack_base): Rename to
GC_freebsd_main_stack_base; adjust error message.
* pthread_stop_world.c (GC_stop_init): Use GC_SEM_INIT_PSHARED
as an argument for sem_init().
* pthread_support.c (pthread_create): Likewise.
* pthread_support.c (pthread_create): Abort in case sem_init()
* include/private/gc_priv.h (GC_SEM_INIT_PSHARED): Define.
* tests/initsecondarythread.c: Include gcconfig.h; call GC_INIT
from main() if it should be done from the primordial thread only.
* alloc.c: Don't include sys/types.h for ArmCC.
* dyn_load.c: Likewise.
* os_dep.c: Likewise.
* mach_dep.c (_setjmp, _longjmp): Redirect to setjmp/longjmp for
* mark.c (GC_noop): Define specially for ArmCC.
* include/private/gc_priv.h (GC_noop): Likewise.
* misc.c (GC_init): Don't test pointers comparison for ArmCC.
* misc.c: Don't include unistd.h for ArmCC.
* os_dep.c (pages_executable): Rename to GC_pages_executable;
make STATIC.
* os_dep.c (GC_unix_mmap_get_mem): Don't define for ArmCC.
* ptr_chck.c (GC_is_visible): Explicitly cast
(GC_DS_PER_OBJECT-GC_INDIR_PER_OBJ_BIAS) to word (to suppress
a compiler warning).
* include/private/gcconfig.h: Recognize __arm.
* include/private/gcconfig.h (HBLKPTR): Define for ArmCC.
* include/private/gcconfig.h (HBLKPTR): Add parentheses for
"bytes" argument.
* pthread_support.c (GC_get_nprocs): Don't define for Android.
* pthread_support.c (GC_dummy_thread_local): Don't test
* include/gc_config_macros.h (GC_ADD_CALLER, GC_RETURN_ADDR):
Define for Android.
* mach_dep.c (NO_GETCONTEXT): Move to gcconfig.h.
* os_dep.c (GC_write_fault_handler): Don't include ucontext.h if
* include/private/gcconfig.h (GETPAGESIZE): Define as a sysconf
call for Android.
* include/private/gc_locks.h (WIN32_LEAN_AND_MEAN, NOSERVICE):
Define before including windows.h.
* include/private/gc_priv.h (WIN32_LEAN_AND_MEAN, NOSERVICE):
* include/private/thread_local_alloc.h (WIN32_LEAN_AND_MEAN,
NOSERVICE): Likewise.
* include/private/gc_priv.h (MS_TIME_DIFF): Avoid floating-point
arithmetics; add a comment.
* mark.c (GC_clear_hdr_marks): Don't test USE_MARK_BYTES.
* extra/setjmp_t.c (main): Don't test USE_MARK_BITS.
* include/private/gc_pmark.h (SET_MARK_BIT_EXIT_IF_SET): Likewise.
* include/private/gc_pmark.h (SET_MARK_BIT_EXIT_IF_SET): Remove
"mark_byte" local variable.
* include/private/gc_pmark.h (OR_WORD_EXIT_IF_SET): Add a comment
about that AO_or() is not used by GC unless USE_MARK_BITS
explicitly set.
* include/private/gc_priv.h (OR_WORD): Likewise.
* include/private/gc_pmark.h (INCR_MARKS): Remove trailing ';',
add parentheses.
* include/private/gc_priv.h (ONES): Define before use by
* include/private/gc_priv.h (MARK_BITS_SZ): Define where used.
* include/private/gc_priv.h (OR_WORD): Don't define if
* include/private/gcconfig.h (USE_MARK_BYTES); Remove duplicate
definition; simplify expression.
* os_dep.c (GC_get_maps): Always close the file.
* pthread_support.c (GC_get_nprocs): Likewise.
* os_dep.c (READ): Define similarly across the file (without
* pthread_support.c (GC_get_nprocs): Use signed int type for "i"
and "len" local variables (since read() may return -1).
* include/private/gc_pmark.h (LONG_MULT): Add prefix/suffix
double underscore; add "volatile" for asm.
* include/private/gc_pmark.h (LONG_MULT): Add missing
* include/private/gc_priv.h (OR_WORD): Likewise.
* include/private/gc_priv.h (OR_WORD): Remove unnecessary brackets
and ';' symbol.
* os_dep.c (GC_get_stack_base): Implement for Android (same as
for Linux).
* pthread_support.c (GC_get_nprocs): Return 1 (instead of -1) if
failed to open "stat" file (not to issue a warning twice); update
the comment.
* pthread_support.c (GC_thr_init): Call sysconf() on Android to
get the number of CPUs.
* include/private/gc_priv.h (_GNU_SOURCE): Revert one of the
recent patches regarding this macro as the macro should be set
(to 1) before including any other system header.
* doc/README.environment (GC_INITIAL_HEAP_SIZE,
* misc.c (GC_parse_mem_size_arg): Allow 'k', 'M', 'G' suffixes in
heap size specifier; return 0 if not a valid one.
* include/gc_cpp.h: Explicitly define inline one-argument delete
operator for Cygwin (as a workaround).
* tests/ (main): Suppress compiler warnings about
"assigned value is unused".
* misc.c (GC_parse_mem_size_arg): New function.
* misc.c (GC_init): Use GC_parse_mem_size_arg().
* pthread_stop_world.c (tkill): Declare for Android.
* include/private/gc_priv.h (_GNU_SOURCE): Include features.h
first (except for NaCl) and then define the macro to 1 if not yet.
* tests/ (TESTS, check_PROGRAMS): Add
* tests/ (initsecondarythread_SOURCES,
initsecondarythread_LDADD): New variable.
* dbg_mlc.c (GC_store_debug_info_inner): Always define; add
"const" to its string argument.
* dbg_mlc.c (GC_store_debug_info): Call GC_store_debug_info_inner.
* dbg_mlc.c (GC_debug_free): Set GC_have_errors in case of
smashed or previously deallocated found.
* dbg_mlc.c (GC_check_heap_block): Replace while loop with a for
* reclaim.c (GC_reclaim_check): Likewise.
* dbg_mlc.c (GC_check_heap_proc): Remove redundant cast to word.
* os_dep.c (GC_get_stack_base): Don't initialize
stackbase_main_self/ss_sp on Solaris if thr_main() is zero (thus
calling GC_INIT() from a non-primordial thread is possible now).
* reclaim.c (GC_add_leaked): Turn into an inline one.
* reclaim.c (GC_reclaim_small_nonempty_block):
Change report_if_found type from int/word to boolean.
* include/private/gc_priv.h (GC_start_reclaim): Likewise.
* include/private/gc_priv.h (set_mark_bit_from_hdr,
clear_mark_bit_from_hdr): Place closing parenthesis properly.
* os_dep.c (GC_get_main_stack_base): Try to use
pthread_attr_getstack first for Linux if THREADS.
* doc/README.macros (USE_GET_STACKBASE_FOR_MAIN): Adjust text
* dbg_mlc.c (GC_generate_random_backtrace_no_gc): Fix a message
* dbg_mlc.c (GC_debug_malloc): Add a comment (about zero size).
* dbg_mlc.c (GC_strdup): Call GC_err_printf instead of WARN (in
case of NULL argument).
* dbg_mlc.c (GC_free): In case of NULL argument, just return
(without any warning printed); eliminate "uncollectable" local
* (THREADDLLIBS): Use alternate thread library on
Solaris 8.
* (need_atomic_ops_asm): Set to true only for SPARC
* Don't use libdl on mips-sgi-irix6.
* mach_dep.c (NO_GETCONTEXT); Define for RTEMS.
* mach_dep.c (GC_with_callee_saves_pushed): Don't call
__builtin_unwind_init() for RTEMS; use setjmp() without the
leading underscore (for RTEMS).
* tests/test.c (BIG): Use smaller value for RTEMS.
* tests/test.c (main): Customize for RTEMS.
* Remove doubled words in comments.
* os_dep.c: Likewise.
* doc/README: Likewise.
* extra/setjmp_t.c: Likewise.
* tests/huge_test.c: Likewise.
* extra/setjmp_t.c (getpagesize, nested_sp, main, g): Replace the
K&R-style function definition with the ANSI C one.
* extra/setjmp_t.c (nested_sp): Implement in the same way as
* dyn_load.c (GC_dyld_sections): Add more sctions.
* dyn_load.c (GC_dyld_add_sect_fmts): New static varaible.
* dyn_load.c (L2_MAX_OFILE_ALIGNMENT): New macro.
* dyn_load.c (GC_dyld_image_add, GC_dyld_image_remove): Improve
logging; add support for on-demand sections.
* gcj_mlc.c (GC_gcj_malloc_initialized): Use STATIC unless
* include/private/gc_priv.h (GC_gcj_malloc_initialized): Don't
declare (as external) unless GC_ASSERTIONS.
* os_dep.c (GC_win32_free_heap): Clear GC_heap_bases[] also for
Cygwin; add FIXME.
* include/private/gcconfig.h: Include <sys/unistd.h> for RTEMS.
* include/private/gcconfig.h: Add "#error" for every "-->" mark.
* include/private/gcconfig.h (CLEAR_DOUBLE): Turn the code into
an expression.
* include/private/pthread_support.h (SUSPENDED_EXT): Add new flag
(which existed previously as SUSPENDED and still exists in GCJ).
* include/private/pthread_support.h (DISABLED_GC): Change the
value (as it is already used by SUSPENDED_EXT).
* tests/test.c (reverse_test): Modify count (BIG) for
* reclaim.c (GC_print_all_errors): Recognize new GC_ABORT_ON_LEAK
macro and environment variable; abort if any error has been
printed provided the environment variable (or macro) is set.
* doc/README.environment (GC_ABORT_ON_LEAK): Document.
* doc/README.macros (GC_ABORT_ON_LEAK): Likewise.
* os_dep.c (GC_unix_sbrk_get_mem, GC_unix_get_mem): Don't define
for RTEMS.
* include/private/gcconfig.h (RTEMS): Add support for.
* include/private/gcconfig.h (GET_MEM): Use calloc() for RTEMS.
* mallocx.c (GC_malloc_uncollectable): Move to malloc.c (since
it is used internally in some places).
* dbg_mlc.c (GC_register_finalizer_no_order): Remove redundant
* dbg_mlc.c (GC_debug_malloc_replacement,
GC_debug_realloc_replacement): Rename RA to GC_DBG_RA.
* malloc.c (GC_debug_malloc_replacement): Likewise.
* mallocx.c (GC_debug_realloc_replacement): Likewise.
* dbg_mlc.c (GC_store_debug_info): Move proto from dbg_mlc.h.
* malloc.c (GC_strdup, GC_strndup, GC_wcsdup): Move to mallocx.c.
* malloc.c: Include errno.h only REDIRECT_MALLOC; remove redundant
includes of string.h.
* mallocx.c: Include string.h (for GC_strdup).
* include/private/dbg_mlc.h (GC_store_debug_info): Move declaration
to dbg_mlc.c.
* include/private/gc_locks.h (UNCOND_LOCK, UNCOND_UNLOCK): Remove
redundant trailing ';'.
* include/private/gc_priv.h (START_WORLD, COND_DUMP): Likewise.
* include/private/gc_locks.h (LOCK, UNLOCK): Place opening '{'
* include/private/gc_priv.h (GC_DBG_RA): Move from dbg_mlc.c,
malloc.c, mallocx.c.
* alloc.c (GC_check_heap, GC_print_all_smashed): Move the
definition from misc.c.
* dbg_mlc.c (GC_debug_malloc_atomic_uncollectable): Define as
* include/gc.h (GC_debug_malloc_atomic_uncollectable): Declare.
* include/gc.h (GC_MALLOC_ATOMIC_UNCOLLECTABLE): Define new public
* dbg_mlc.c (MAX_SMASHED): Don't define if already set.
* reclaim.c (MAX_LEAKED): Likewise.
* dbg_mlc.c (GC_add_smashed): Add FIXME about the concurrent
access to the global array.
* reclaim.c (GC_add_leaked): Likewise.
* misc.c (GC_print_back_height): Set on if GC_PRINT_BACK_HEIGHT
(new macro) is defined.
* doc/README.macros (GC_PRINT_BACK_HEIGHT): Document.
* misc.c (GC_dump_regularly, GC_init): Replace 0/1 for
GC_dump_regularly and GC_print_back_height variables with
* reclaim.c (GC_print_all_errors): Refine the comment.
* tests/test.c (reverse_test_inner): Undo one of the previous
patches which shifts "c" and "d" pointers only if
ALL_INTERIOR_POINTERS (since interior pointers are always
recognized in stacks).
* misc.c (GC_stdout, GC_stderr): Move the definition to the place
where GC_log is defined (Unix only).
* misc.c (GC_init): Recognize "GC_ONLY_LOG_TO_FILE" environment
variable and the similar macro; redirect GC_stdout and GC_stderr
to GC_log if "GC_LOG_FILE" environment variable is set unless
prohibited by GC_ONLY_LOG_TO_FILE (Unix only).
* doc/README.environment (GC_ONLY_LOG_TO_FILE): Document.
* doc/README.macros (GC_ONLY_LOG_TO_FILE): Likewise.
* misc.c (GC_stdout, GC_write): Rename GC_stdout to GC_log (Win32
* misc.c (GC_write): Add for MacOS (and OS/2); change WRITE()
* misc.c (GC_printf): Check GC_quiet before va_start().
* allchblk.c (GC_freehblk): Use GC_log_printf instead of GC_printf
inside "if (GC_print_stats)" branch.
* alloc.c (GC_collect_or_expand): Likewise.
* dyn_load.c (GC_register_dynamic_libraries): Likewise.
* headers.c (GC_scratch_alloc): Likewise.
* os_dep.c (GC_get_maps, GC_remap, PROTECT,
GC_write_fault_handler, GC_dirty_init, GC_mprotect_thread): Likewise.
* alloc.c (min_bytes_allocd): Use GC_log_printf instead of
GC_printf for DEBUG_THREADS output.
* darwin_stop_world.c (GC_stack_range_for, GC_suspend_thread_list,
GC_stop_world, GC_thread_resume, GC_start_world): Likewise.
* pthread_start.c (GC_inner_start_routine): Likewise.
* pthread_stop_world.c (GC_suspend_handler, GC_restart_handler,
GC_push_all_stacks, GC_suspend_all, GC_stop_world,
GC_start_world): Likewise.
* pthread_support.c (GC_mark_thread, GC_get_nprocs,
GC_start_rtn_prepare_thread, pthread_create): Likewise.
* checksums.c (GC_update_check_page): Use GC_printf() instead of
GC_err_printf() for error printing.
* checksums.c (GC_check_blocks, GC_check_dirty): Use GC_log_printf
instead of GC_printf for logging purposes.
* dyn_load.c (sys_errlist, sys_nerr, errno): Move declaration of
external variable outside from GC_register_dynamic_libraries.
* dyn_load.c (GC_register_dynamic_libraries): Don't use
sys_errlist value if errno equals to sys_nerr.
* dyn_load.c (GC_register_dynamic_libraries): Use GC_log_printf
instead of GC_printf for DL_VERBOSE output.
* dyn_load.c (GC_dyld_image_add, GC_dyld_image_remove,
GC_init_dyld): Use GC_log_printf instead of GC_printf for
* os_dep.c (catch_exception_raise): Use GC_log_printf
instead of GC_printf for DEBUG_EXCEPTION_HANDLING output.
* reclaim.c (GC_print_free_list): Move "n" increment out of
GC_printf() call.
* win32_threads.c (GC_register_my_thread_inner,
GC_win32_start_inner): Use GC_log_printf instead of GC_printf
inside "if (GC_print_stats)" branch.
* win32_threads.c (GC_PTHREAD_PTRVAL): New macro (defined only if
* win32_threads.c (GC_delete_gc_thread, NUMERIC_THREAD_ID,
GC_pthread_join, GC_pthread_create): Use GC_PTHREAD_PTRVAL
* win32_threads.c (GC_push_stack_for, GC_mark_thread,
GC_CreateThread, GC_beginthreadex, GC_pthread_join,
GC_pthread_create, GC_pthread_start_inner, GC_thread_exit_proc,
GC_mark_thread_local_free_lists): Use GC_log_printf instead of
GC_printf for DEBUG_THREADS output.
* win32_threads.c (GC_win32_start_inner, GC_CreateThread,
GC_beginthreadex, GC_pthread_join, GC_pthread_create,
GC_pthread_start_inner, GC_thread_exit_proc): Cast
GetCurrentThreadId result to long; don't cast value of pthread_t
type to int; adjust printf format specifiers.
* doc/README.win32 (DEBUG_WIN32_PTHREADS): Remove obsolete
* tests/test.c (cons, small_cons, gcj_cons, check_ints,
check_uncollectable_ints, print_int_list, check_marks_int_list,
fork_a_thread, finalizer, mktree, chktree, alloc8bytes,
alloc_small, tree_test, typed_test, check_heap_stats, WinMain,
test, main): Remove unnecessary casts of GC_printf calls to void.
* allchblk.c (GC_print_hblkfreelist): Adjust (make uniform across
BDWGC) printed message (adjust letters case, terminating dot and
new line symbols).
* alloc.c (GC_check_fl_marks): Likewise.
* backgraph.c (new_back_edges): Likewise.
* checksums.c (GC_check_dirty): Likewise.
* darwin_stop_world.c (GC_push_all_stacks,
GC_suspend_thread_list): Likewise.
* dbg_mlc.c (GC_print_type, GC_debug_free, GC_debug_realloc,
store_old): Likewise.
* dyn_load.c (GC_register_dynamic_libraries): Likewise.
* mark.c (GC_initiate_gc, GC_mark_some, GC_mark_from, GC_push_all,
GC_push_selected, GC_push_next_marked_dirty): Likewise.
* mark_rts.c (GC_exclude_static_roots_inner): Likewise.
* os_dep.c (GC_remap, GC_default_push_other_roots,
GC_push_thread_structures, GC_dirty_init, GC_read_dirty,
catch_exception_raise_state, catch_exception_raise_state_identity,
GC_mprotect_thread_notify, GC_mprotect_thread,
catch_exception_raise): Likewise.
* pthread_stop_world.c (GC_print_sig_mask, GC_push_all_stacks,
GC_stop_world, GC_stop_init): Likewise.
* pthread_support.c (GC_thr_init, GC_register_my_thread_inner,
GC_start_routine): Likewise.
* win32_threads.c (GC_register_my_thread_inner,
GC_push_all_stacks, GC_win32_start_inner, GC_pthread_join,
GC_pthread_start_inner): Likewise.
* alloc.c (GC_expand_hp_inner): Realign the code.
* mark.c (GC_mark_from, GC_mark_local, GC_do_parallel_mark):
* misc.c (GC_init): Likewise.
* os_dep.c (GC_dirty_init, GC_read_dirty): Likewise.
* include/private/gc_pmark.h (PUSH_CONTENTS_HDR): Likewise.
* tests/test.c (run_one_test): Likewise.
* misc.c (GC_err_puts): Document.
* misc.c (GC_err_write): Remove.
* os_dep.c (dump_maps): Likewise.
* include/private/gc_priv.h (GC_err_write): Likewise.
* os_dep.c (GC_print_address_map): Call GC_err_puts() instead of
dump_maps() and GC_err_write().
* os_dep.c (GC_read_dirty): Remove redundant brackets.
* tests/test.c (reverse_test_inner): Test interior pointer
recognition only if ALL_INTERIOR_POINTERS.
* tests/test.c (run_one_test): Replace GC_all_interior_pointers
with GC_get_all_interior_pointers(); simplify the expression.
* tests/test.c (check_heap_stats): Replace GC_bytes_allocd and
GC_bytes_allocd_before_gc with GC_get_total_bytes().
* tests/test.c (main): Replace GC_gc_no with GC_get_gc_no().
* dbg_mlc.c (GC_debug_strdup, GC_debug_free): Output a portability
warning if the argument is NULL and GC is in leaks detection mode.
* dbg_mlc.c (GC_debug_strndup, GC_debug_wcsdup): New public
function definition.
* malloc.c (GC_strndup, GC_wcsdup, strndup): Likewise.
* mallocx.c (GC_posix_memalign): Likewise.
* malloc.c (strdup): Fix string size value; rename "len" to "lb".
* mallocx.c: Include errno.h unless WinCE (otherwise include
windows.h for Win32 error constants).
* win32_threads.c: Define WIN32_LEAN_AND_MEAN and NOSERVICE before
windows.h inclusion.
* misc.c (GC_init): Register at-exit callback if GC_find_leak
(even if GC_FIND_LEAK macro is unset).
* pthread_stop_world.c (NACL_STORE_REGS,
__nacl_suspend_thread_if_needed, GC_nacl_initialize_gc_thread):
Use BCOPY() instead of memcpy().
* pthread_support.c (GC_init_real_syms): Likewise.
Document new macro.
* doc/README.macros (REDIRECT_MALLOC): Update documentation.
* include/gc.h (GC_strndup, GC_posix_memalign, GC_debug_strndup):
New API function prototype.
* include/gc.h (GC_MALLOC, GC_REALLOC): Redirect to
GC_debug_malloc/realloc_replacement() if GC_DEBUG_REPLACEMENT.
* include/gc.h (GC_STRDUP): Remove redundant parentheses.
* include/leak_detector.h (realloc, strdup): Likewise.
* include/gc.h (GC_STRNDUP): New API macro.
GC_NEW_UNCOLLECTABLE): Add missing parentheses.
* include/gc.h (GC_wcsdup, GC_debug_wcsdup): New API function
prototype (only if GC_REQUIRE_WCSDUP).
* include/gc.h (GC_WCSDUP): New API macro (only if
* include/leak_detector.h: Include stdlib.h and string.h after gc.h (unless
* include/leak_detector.h (malloc, calloc, free, realloc):
Undefine symbol before its redefinition.
* include/leak_detector.h (strndup, memalign, posix_memalign):
Redefine to the corresponding GC function.
* include/leak_detector.h (wcsdup): Redefine to GC_WCSDUP (only
* include/leak_detector.h (CHECK_LEAKS): Add comment; don't define
the macro if already defined.
* misc.c (GC_abort): Use _exit() (instead of DebugBreak) on Win32
when doing code static analysis (to inform the tool that the
function is a no-return one).
* os_dep.c (GC_linux_stack_base): Remove a duplicate validation
of the length of "stat" file; use signed int type for "i",
"buf_offset" and "len" local variables (since read() may
return -1).
* blacklst.c (GC_bl_init_no_interiors): New function (the code
moved from GC_bl_init).
* blacklst.c (GC_bl_init): Invoke GC_bl_init_no_interiors unless
GC_all_interior_pointers mode; remove unnecessarily parameter cast
for GC_scratch_alloc call.
* include/private/gc_priv.h (GC_bl_init): Move the function
declaration to misc.c file.
* misc.c (GC_bl_init_no_interiors): Add a prototype.
* misc.c (GC_set_all_interior_pointers): Allow values other than 0
and 1; allow altering GC_set_all_interior_pointers value even
after GC initialization.
* obj_map.c (GC_initialize_offsets): Clear GC_valid_offsets and
GC_modws_valid_offsets if GC_all_interior_pointers is off.
* misc.c (GC_init): Don't call GC_initialize_offsets() unless
GC_all_interior_pointers mode.
* alloc.c (GC_finish_collection): Remove redundant brackets;
adjust code indentation.
* blacklst.c (GC_add_to_black_list_normal): Simplify expression
(to improve code readability).
* blacklst.c (GC_is_black_listed): Join nested "if" (into a single
conditional expression); initialize "nblocks" just before the loop
* misc.c (GC_init): Don't compute initial_heap_sz if GC is already
* include/private/gc_priv.h (GC_initialize_offsets): Move the
function declaration to misc.c file.
* obj_map.c (GC_initialize_offsets): Remove offsets_initialized
static variable since the function is called only once.
* tests/middle.c (main): Use setter for GC_all_interior_pointers;
adjust printf format specifier (and cast the value passed to).
* doc/README.macros (SMALL_CONFIG, LARGE_CONFIG): Refine the
* include/private/gc_hdrs.h (LOG_BOTTOM_SZ): Ignore SMALL_CONFIG
if LARGE_CONFIG is defined.
* include/private/gc_priv.h (CPP_LOG_HBLKSIZE): Likewise.
* alloc.c (GC_finish_collection): Replace "#else #ifdef" with
* include/private/gc_priv.h (CPP_LOG_HBLKSIZE, LOG_PHT_ENTRIES,
* alloc.c (GC_expand_hp_inner): Check for GC_collect_at_heapsize
overflow even if not LARGE_CONFIG.
* dbg_mlc.c (GC_check_heap_proc): Check "oh" size even if
* finalize.c (GC_print_finalization_stats): Fix "#endif" comment.
GC_FULL_FREQUENCY): Refine the documentation.
* extra/msvc_dbg.c: Test _MSC_VER macro; include "gc.h" (for
* extra/msvc_dbg.c (ULONG_PTR): Replace with GC_ULONG_PTR; define
as word.
* dbg_mlc.c (GC_get_back_ptr_info, GC_print_obj,
GC_print_smashed_obj, GC_debug_free_inner): Add a code for a
LINT-like tool to instruct it that the function is invoked only
with valid parameters (otherwise a SEGV is ok); recognize LINT2
new macro.
* misc.c (GC_abort): Instruct a LINT-like tool that the function
never returns in fact.
* os_dep.c (GC_linux_stack_base): Check for read buffer overflow;
close the file immediately after read; use STRTOULL() instead of
decoding the address number manually.
* include/private/gc_priv.h (EXPECT): Don't specify outcome for a
LINT-like tool.
* include/private/gc_priv.h (GC_all_interior_pointers): Instruct a
LINT-like tool that the value is restricted to zero and one only
(required since the variable is global and its value is used as a
part of array index expression is some places).
* dbg_mlc.c (GC_make_closure): Fix SEGV in case GC_malloc returns
* dbg_mlc.c (GC_debug_register_finalizer,
GC_debug_register_finalizer_ignore_self): Handle out of memory
case properly (similar to GC_register_finalizer_inner).
* headers.c (GC_install_header): Handle the case when alloc_hdr()
returns NULL.
* os_dep.c (GC_get_maps_len): Defend against missing "maps" file.
* pthread_support.c (GC_mark_thread): Place a dummy return
statement (which uses "id" argument) before the actual use of "id"
as an array index (to suppress a warning produced by some static
code analysis tools).
* win32_threads.c (GC_mark_thread): Likewise.
* pthread_support.c (GC_thr_init): Abort (with the appropriate
message) if out of memory.
* finalize.c (GC_register_finalizer_inner): Fix a typo in a
*include/private/gcconfig.h (STACKBOTTOM): Likewise.
* gcj_mlc.c (GC_core_gcj_malloc): Replace 0/1 with TRUE/FALSE in
EXPECT (the 2nd argument).
* malloc.c (GC_core_malloc_atomic, GC_core_malloc, GC_free):
* mark.c (GC_mark_and_push, GC_mark_and_push_stack): Likewise.
* thread_local_alloc.c (GC_malloc, GC_malloc_atomic): Likewise.
* include/private/gc_hdrs.h (HC_GET_HDR): Likewise.
* include/private/gc_priv.h (SMALL_OBJ): Likewise.
* include/private/specific.h (getspecific): Likewise.
* pthread_support.c (LOCK_STATS): Add a comment.
* include/gc_pthread_redirects.h (GC_NO_DLOPEN,
definition to gc_config_macros.
* pthread_support.c (pthread_cancel, GC_pthread_cancel_t,
GC_pthread_cancel): Test GC_NO_PTHREAD_CANCEL (instead of NACL and
* include/gc_pthread_redirects.h (GC_pthread_cancel,
pthread_cancel): Likewise.
* pthread_support.c (GC_pthread_create, GC_pthread_sigmask,
GC_pthread_join, GC_pthread_detach, GC_pthread_cancel): Realign
* include/gc_pthread_redirects.h (GC_PTHREAD_EXIT_ATTRIBUTE):
Define as empty for NaCl.
* include/gc_pthread_redirects.h (GC_NO_PTHREAD_CANCEL): New macro
* dyn_load.c (GC_init_dyld): Do not invoke
_dyld_bind_fully_image_containing_address() if GC_no_dls (as it is
not required to register the main data segment in that case).
* include/gc.h (GC_no_dls): Adjust the comment.
* gc_dlopen.c: Likewise.
* include/gc_pthread_redirects.h (GC_dlopen, dlopen): Likewise.
* gc_dlopen.c: Don't include dlfcn.h (as it is included in
* pthread_support.c (pthread_sigmask, GC_pthread_sigmask_t,
GC_pthread_sigmask): Test GC_NO_PTHREAD_SIGMASK (instead of
* include/gc_pthread_redirects.h (GC_pthread_sigmask,
pthread_sigmask): Likewise.
* win32_threads.c (pthread_sigmask, GC_pthread_sigmask): Test
* pthread_support.c (pthread_create, GC_pthread_create_t,
GC_pthread_create): Rename GC_PTHREAD_CONST to
* win32_threads.c (GC_pthread_create): Likewise.
* include/gc_pthread_redirects.h: Likewise.
* include/gc_pthread_redirects.h (GC_NO_DLOPEN,
GC_NO_PTHREAD_SIGMASK): New macro defined.
* include/gc_pthread_redirects.h (GC_PTHREAD_CREATE_CONST): Set to
empty for NaCl.
* include/gc_pthread_redirects.h (GC_PTHREAD_EXIT_ATTRIBUTE): Do
not define for Android (as CANCEL_SAFE is not defined).
* include/gc.h (GC_ADD_CALLER, GC_RETURN_ADDR,
definition to gc_config_macros.h file.
* include/gc_config_macros.h: Check the file is included from gc.h
* include/gc_version.h: Likewise.
* gc_dlopen.c: Empty unit for NaCl.
* os_dep.c: Include fcntl.h for NaCl.
* os_dep.c (GC_get_main_stack_base): Ignore
* os_dep.c (GC_get_stack_base): Return GC_UNIMPLEMENTED for NaCl.
* os_dep.c (GC_remap): Use mmap (instead of mprotect) for NaCl.
* pthread_start.c (GC_inner_start_routine): Don't invoke
pthread_cleanup_push/pop for NaCl.
* pthread_stop_world.c (GC_nacl_num_gc_threads,
GC_nacl_thread_idx, GC_nacl_park_threads_now,
GC_nacl_thread_parker, GC_nacl_gc_thread_self,
GC_nacl_thread_parked, GC_nacl_thread_used,
GC_nacl_thread_parking_inited, GC_nacl_thread_alloc_lock): New
variable (fo NaCl only).
* pthread_stop_world.c (GC_remove_allowed_signals,
suspend_handler_mask, GC_stop_count, GC_world_is_stopped,
GC_retry_signals, SIG_THR_RESTART, GC_suspend_ack_sem,
GC_restart_ack_sem, GC_suspend_handler_inner, GC_suspend_handler,
GC_restart_handler): Don't define for NaCl.
* pthread_support.c (GC_get_nprocs): Likewise.
* include/private/gc_priv.h (SIG_SUSPEND): Likewise.
* include/private/gcconfig.h (LINUX): Likewise.
* pthread_stop_world.c (GC_push_all_stacks): Push register storage
for NaCl.
* pthread_stop_world.c (GC_suspend_all, GC_stop_world,
GC_start_world): Implement for NaCl.
* pthread_stop_world.c (GC_stop_world): Don't define unused "i"
local variable for OpenBSD (and NaCl).
* pthread_stop_world.c (NACL_STORE_REGS): New macro definition for
* pthread_stop_world.c (nacl_pre_syscall_hook,
__nacl_suspend_thread_if_needed, nacl_post_syscall_hook,
GC_nacl_initialize_gc_thread, GC_nacl_shutdown_gc_thread): New
function (for NaCl only).
* pthread_stop_world.c (GC_stop_init): Empty for NaCl.
* pthread_support.c (pthread_cancel, pthread_sigmask): Don't
redirect for NaCl.
* include/gc_pthread_redirects.h (pthread_cancel,
pthread_sigmask): Likewise.
* pthread_support.c (GC_nacl_initialize_gc_thread,
GC_nacl_shutdown_gc_thread): New internal prototype (NaCl only).
* pthread_support.c (GC_new_thread, GC_delete_thread): Initialize
and shutdown thread for NaCl.
* pthread_support.c (GC_thr_init): Call sysconf for NaCl.
* pthread_support.c (GC_pthread_exit): Call GC_thread_exit_proc
for NaCl.
* include/gc.h: Don't include features.h for NaCl.
* include/gc_pthread_redirects.h (GC_PTHREAD_CONST): New macro.
* include/gc_pthread_redirects.h (GC_pthread_create): Use
GC_PTHREAD_CONST instead of const.
* win32_threads.c (GC_pthread_create): Likewise.
* pthread_support.c (GC_pthread_create_t, GC_pthread_create,
pthread_create): Likewise.
* include/private/gcconfig.h (NACL): Recognize NaCl.
* include/private/gcconfig.h (GC_LINUX_THREADS): Valid for NaCl.
* include/private/pthread_stop_world.h (thread_stop_info): Add
reg_storage member; define NACL_GC_REG_STORAGE_SIZE macro (for
NaCl only).
* include/private/pthread_support.h (GC_nacl_gc_thread_self):
Declare internal variable (for NaCl only).
* mach_dep.c (GC_with_callee_saves_pushed): Fix FE_ALL_EXCEPT
* mark.c (GC_mark_some): Prefix and suffix "asm" and "volatile"
keywords with double underscore.
* os_dep.c (catch_exception_raise, catch_exception_raise_state,
catch_exception_raise_state_identity): Add GC_API_OSCALL to
function definition.
* os_dep.c (catch_exception_raise_state,
catch_exception_raise_state_identity): Move definition to be
before GC_ports.
* os_dep.c (catch_exception_raise): Declare to have the symbol
defined before GC_ports.
* os_dep.c (GC_ports): Store references to catch_exception_raise,
catch_exception_raise_state, catch_exception_raise_state_identity
(to prevent stripping these symbols as dead).
* os_dep.c (catch_exception_raise, catch_exception_raise_state,
catch_exception_raise_state_identity): Mark these symbols as
"referenced dynamically" via an assembler directive (unless
* include/private/gc_priv.h (GC_API_OSCALL): New macro (defined
similar to GC_API but as if GC_DLL is always defined).
* os_dep.c: Don't include signal.h for GC_write_fault_handler on
* os_dep.c (SIG_OK): Don't return true unless SIGSEGV or SIGBUS on
* os_dep.c (CODE_OK): Use SEGV_ACCERR on FreeBSD (define
SEGV_ACCERR for older FreeBSD releases).
* dyn_load.c (GC_register_map_entries,
GC_register_dynamic_libraries_dl_iterate_phdr): Calculate
* dyn_load.c (GC_register_dynamic_libraries_dl_iterate_phdr):
Calculate DATAEND only once if DATAEND_IS_FUNC.
* dyn_load.c: Add comment to some endif; realign some code.
* dyn_load.c (GC_init_dyld): Don't use
_dyld_bind_fully_image_containing_address if
* include/private/gcconfig.h (GC_data_start, GC_find_limit):
Declare if used by DATASTART/DATAEND, respectively.
* include/private/gcconfig.h (DATASTART_IS_FUNC, DATAEND_IS_FUNC):
Define if DATASTART/DATAEND is a function, respectively.
* include/private/gcconfig.h (GETPAGESIZE, NO_PTHREAD_TRYLOCK,
NO_DYLD_BIND_FULLY_IMAGE): Define for Darwin/arm as well; include
* os_dep.c (GC_setpagesize, GC_task_self, PROTECT, UNPROTECT):
Reorder to remove redundant ifdef for Win32.
* os_dep.c: Add comment to some endif.
* os_dep.c: Include pthread.h (for Linux even if single-threaded)
if USE_GET_STACKBASE_FOR_MAIN; also include it for Darwin.
* os_dep.c (STACKBOTTOM): Redefine for Darwin (unless prohibited
for some reason).
* os_dep.c (GC_get_main_stack_base): Allow
USE_GET_STACKBASE_FOR_MAIN for Linux even if single-threaded; add
assertion for the returned result.
* os_dep.c (GC_get_stack_base): Define for Darwin if
* os_dep.c (SIG_OK, CODE_OK): Add comment (for FreeBSD).
* os_dep.c (ID_STOP, ID_RESUME): Define only if threads.
* os_dep.c (catch_exception_raise): Remove redundant parentheses;
refine the documentation.
* include/gc.h (GC_INIT): Document.
* include/private/gc_priv.h (GC_MACH_HEADER, GC_MACH_SECTION,
GC_GETSECTBYNAME): Define depending only on the word size (i.e.,
define these macros also for ARM).
* tests/test.c (check_heap_stats): Print main thread stack bottom
as well (only if verbose mode is on).
* mach_dep.c (GC_with_callee_saves_pushed): Fix and improve code
introduced by the previous patch (if GETCONTEXT_FPU_EXCMASK_BUG
and X86_64).
* darwin_stop_world.c (GC_FindTopOfStack): Prefix and suffix
"volatile" keyword with double underscore.
* mach_dep.c (GETCONTEXT_FPU_EXCMASK_BUG): Recognize new macro and
include fenv.h if defined (unless NO_GETCONTEXT or HAVE_PUSH_REGS).
* mach_dep.c (GC_with_callee_saves_pushed): Restore FPU exception
mask corrupted by getcontext if GETCONTEXT_FPU_EXCMASK_BUG.
* include/private/gcconfig.h (GETCONTEXT_FPU_EXCMASK_BUG): Define
for Linux/amd64 (since its GLibc getcontext currently has the bug).
* allchblk.c (GC_use_entire_heap): Change type to int (as declared
in gc.h); set the default value depending on new GC_USE_ENTIRE_HEAP
* misc.c (GC_init): Test GC_USE_ENTIRE_HEAP environment variable to
alter the default value of GC_use_entire_heap.
* doc/README.environment (GC_USE_ENTIRE_HEAP): Document.
* doc/README.macros (GC_USE_ENTIRE_HEAP): Likewise.
* include/private/gcconfig.h (PARALLEL_MARK): Do not make it cause
MPROTECT_VDB undefining.
* include/private/gcconfig.h (DYNAMIC_LOADING): Fix filename in
the comment.
* include/private/gc_priv.h (_GC_arrays): Move the conditional
macro definitions (shortcuts for GC_arrays members) into the
structure body.
* darwin_stop_world.c (GC_mach_handler_thread,
GC_darwin_register_mach_handler_thread): Define only if
* darwin_stop_world.c (GC_suspend_thread_list): Use
GC_mach_handler_thread and GC_use_mach_handler_thread only if
* darwin_stop_world.c (GC_stop_world): Reset GC_mach_threads_count
only if defined (i.e. unless GC_NO_THREADS_DISCOVERY).
* misc.c (GC_init): Fix comment for GWW_VDB.
* os_dep.c (catch_exception_raise): Use DARWIN_EXC_STATE,
* pthread_support.c (GC_thr_init): Define "dummy" local variable
only unless GC_DARWIN_THREADS.
* include/private/gcconfig.h (MPROTECT_VDB): Define for Darwin
even in the single-threaded mode; define for iPhone/iPad.
* include/private/gcconfig.h (IA64): Remove unnecessary "ifdef"
around "undef".
* include/private/gcconfig.h (HEURISTIC1): Remove unused for
* include/private/gcconfig.h (STACKBOTTOM): Use fixed address for
Darwin/arm (instead of HEURISTIC1).
* misc.c (GC_write): Replace multiple "ifdef/endif" with "elif"
(for ECOS and NOSYS).
* os_dep.c (GC_get_main_stack_base): Likewise.
* os_dep.c (GC_get_main_stack_base): Check
remove "dummy" variable (use result one instead).
* doc/README.macros (SN_TARGET_PS3): Document.
* extra/threadlibs.c (main): Don't output "-lpthread" (and "-ldl")
for Android.
* include/private/pthread_support.h: Fix comment for "endif".
* misc.c (GC_allocate_ml): Define global variable if SN_TARGET_PS3.
* misc.c (GC_init): Initialize GC_allocate_ml if SN_TARGET_PS3.
* os_dep.c (SIGSEGV): Define to dummy zero if SN_TARGET_PS3.
* os_dep.c (GC_unix_mmap_get_mem): Don't define if SN_TARGET_PS3.
* os_dep.c (GC_default_push_other_roots,
GC_push_thread_structures): Define for SN_TARGET_PS3.
* include/private/gc_locks.h (GC_allocate_ml, LOCK, UNLOCK): Define
* include/private/gcconfig.h (SN_TARGET_PS3): Recognize new macro
(Sony PS/3 target).
* include/private/gcconfig.h (THREADS): Define unconditionally if
* include/private/gcconfig.h (GET_MEM): Define for SN_TARGET_PS3.
* alloc.c (GC_collect_or_expand): Replace NIL with NULL in message.
* dbg_mlc.c (GC_debug_malloc, GC_debug_malloc_ignore_off_page,
GC_generic_malloc_inner_ignore_off_page, GC_debug_malloc_stubborn,
GC_debug_malloc_atomic, GC_debug_malloc_uncollectable,
GC_debug_malloc_atomic_uncollectable): Likewise.
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
* dbg_mlc.c (GC_check_annotated_obj): Replace NIL with NULL in a
* dyn_load.c (GC_FirstDLOpenedLinkMap): Likewise.
* mark_rts.c (GC_roots_present): Likewise.
* doc/README: Likewise.
* include/private/gc_hdrs.h (IS_FORWARDING_ADDR_OR_NIL): Likewise.
* include/private/gc_priv.h (_GC_arrays): Likewise.
* Use AC_CHECK_LIB() to check for pthread instead of
just blindly linking to -lpthread, as Android includes pthread
support within libc and does not provide a separate libpthread.
* dyn_load.c (GC_register_dynamic_libraries): Skip current link map
entry if l_addr is NULL (Android/bionic only).
* pthread_stop_world.c (android_thread_kill): New internal function
(Android only).
* pthread_stop_world.c (GC_suspend_all, GC_start_world): Call
android_thread_kill (based on tkill) instead of pthread_kill on
Android (since pthread_kill cannot be used safely on the platform).
* pthread_support.c (GC_new_thread): Store thread Id (obtained from
gettid) for use by android_thread_kill (Android only).
* include/private/pthread_support.h (GC_Thread_Rep): Add kernel_id
structure member (Android only).
* include/private/gcconfig.h: Recognize __x86_64 macro as a synonym
of __x86_64__ (Darwin); define __environ macro (Android on M68K).
* allchblk.c (GC_freehblk): Print extended error message (done via
GC_printf() before aborting with a short message) only if
* 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_start_world): Likewise.
* win32_threads.c (GC_register_my_thread_inner): Likewise.
* os_dep.c (GC_get_main_stack_base, GC_register_data_segments,
GC_dirty_init): Remove redundant print of an error message before
aborting with the same message.
* os_dep.c (GC_register_data_segments): Remove format specifier
from the string passed to GC_err_puts(); use ABORT instead of EXIT
(if invalid executable type).
* os_dep.c (GC_remap): Adjust printf format specifier (for long
* os_dep.c (GC_dirty_init): Print a message about SIG_IGN detected
(for SIGSEGV/BUS) only if GC_print_stats.
* os_dep.c (catch_exception_raise): Join 2 adjacent GC_err_printf
* tests/test.c (main): Print the relevant message if GWW_VDB.
* include/private/gcconfig.h: Don't define MPROTECT_VDB for Win32
on x64 if compiled by GCC.
* tests/staticrootstest.c: Include string.h for memset() prototype.
* tests/thread_leak_test.c (main): Fix printf() format specifiers.
* CMakeLists.txt: Check enable_parallel_mark on Darwin.
* Likewise.
* darwin_stop_world.c (DARWIN_SUSPEND_GC_THREADS,
* os_dep.c (DARWIN_SUSPEND_GC_THREADS): Likewise.
* pthread_support.c (DARWIN_SUSPEND_GC_THREADS): Likewise.
* darwin_stop_world.c (DARWIN_QUERY_TASK_THREADS): Don't define
(and remove FIXME).
* darwin_stop_world.c (GC_use_threads_discovery): Add GC_API;
comment; remove FIXME.
* win32_threads.c (GC_NO_DLLMAIN): Rename to
* tests/test.c (GC_NO_DLLMAIN): Likewise.
* doc/README.macros (GC_NO_DLLMAIN): Likewise.
* doc/README.win32 (GC_NO_DLLMAIN): Likewise.
* doc/README.macros (GC_NO_THREADS_DISCOVERY): Update the comment.
* win32_threads.c (GC_win32_dll_threads): Define as macro to true
update the comment.
* win32_threads.c (GC_use_DllMain): Rename to
GC_use_threads_discovery; do not set GC_win32_dll_threads if
* win32_threads.c (GC_started_thread_while_stopped,
GC_lookup_thread_inner, UNPROTECT_THREAD, GC_lookup_pthread,
GC_thr_init, GC_pthread_create, DllMain): Rewrite some expressions
which use GC_win32_dll_threads to minimize the possibility of
an "unreachable code" compiler warning when GC_win32_dll_threads
is defined as a macro.
* win32_threads.c (GC_unregister_my_thread): Don't call
GC_delete_thread() if GC_win32_dll_threads and THREAD_LOCAL_ALLOC
(since can't happen); use "t" local variable only if not
* doc/README.macros (GC_DISCOVER_TASK_THREADS): Document.
* include/gc.h (GC_use_DllMain): Rename to
GC_use_threads_discovery but keep old name as a macro definition.
* include/gc.h (GC_use_threads_discovery): Declare also for
Darwin; update the comment.
* tests/test.c (main): Call GC_use_threads_discovery for Darwin
(to test the mode if possible).
* darwin_stop_world.c (DARWIN_SUSPEND_GC_THREADS,
DARWIN_QUERY_TASK_THREADS): New macro recognized.
* darwin_stop_world.c (GC_query_task_threads): add STATIC;
initialize to false; define as macro if DARWIN_SUSPEND_GC_THREADS
* darwin_stop_world.c (GC_use_threads_discovery): New function
(for setting GC_query_task_threads value).
* darwin_stop_world.c (GC_mach_handler_thread,
GC_use_mach_handler_thread, GC_mach_thread, GC_MAX_MACH_THREADS,
GC_mach_threads, GC_mach_threads_count, GC_suspend_thread_list,
GC_darwin_register_mach_handler_thread): Define only if not
* darwin_stop_world.c (GC_stop_world, GC_start_world): Exclude
the code for GC_query_task_threads case from compilation unless
* os_dep.c (GC_darwin_register_mach_handler_thread): Declared only
if Darwin threads and not DARWIN_SUSPEND_GC_THREADS.
* os_dep.c (GC_mprotect_thread): Call
GC_darwin_register_mach_handler_thread only if THREADS and not
* pthread_support.c (marker_mach_threads): Don't define if
* pthread_support.c (GC_mark_thread): Don't fill in
marker_mach_threads if DARWIN_SUSPEND_GC_THREADS.
* include/private/gc_locks.h (GC_need_to_lock): Always declare for
* darwin_stop_world.c (GC_query_task_threads): Don't define to
false for DARWIN_DONT_PARSE_STACK case; unconditionally initialize
the variable to false (for now).
* darwin_stop_world.c (GC_push_all_stacks): Call task_threads()
* darwin_stop_world.c (GC_stop_world, GC_start_world): Use the
approach based on task_threads() only if GC_query_task_threads
else use GC_threads table.
* darwin_stop_world.c (GC_mach_threads): Remove static qualifier.
* darwin_stop_world.c (GC_stop_init): Remove (as we do not need to
really clear GC_mach_threads[]).
* darwin_stop_world.c (GC_stop_world): Reset GC_mach_threads_count
(instead of calling GC_stop_init).
* include/private/pthread_support.h (GC_stop_init): Remove proto.
* pthread_support.c (GC_stop_init): Add proto (unless Darwin).
* pthread_support.c (GC_thr_init): Don't call GC_stop_init() if
* darwin_stop_world.c (GC_stack_range_for): New static function
(move the code from GC_push_all_stacks).
* darwin_stop_world.c (GC_push_all_stacks): Call
GC_stack_range_for(); rename kern_return local variable to
* darwin_stop_world.c (GC_is_mach_marker): Change argument type
from mach_port_t to thread_act_t.
* pthread_support.c (GC_is_mach_marker): Likewise.
* darwin_stop_world.c (GC_push_all_stacks): Fix "my_task" local
variable initialization (always call current_task()).
* pthread_support.c (GC_thr_init, GC_register_my_thread_inner):
Don't set thread's stop_info.stack_ptr value for Darwin.
* include/private/darwin_stop_world.h (thread_stop_info): Update
the comment for stack_ptr.
* darwin_stop_world.c (GC_push_all_stacks): Rename "r", "me" local
variables to "kern_return" and "my_thread" ones, respectively;
call mach_port_deallocate() unconditionally.
* darwin_stop_world.c (GC_stop_world): Don't call mach_thread_self
* darwin_stop_world.c (GC_mach_thread): Move from
* include/private/darwin_stop_world.h (GC_mach_thread): Remove.
* win32_threads.c (GC_start_world): Define "thread_id" local
variable only if GC_ASSERTIONS; decide whether to resume a thread
based on its "suspended" field value; assert that suspended thread
stack_base is non-zero and the thread is not our one.
* darwin_stop_world.c (GC_thread_resume): New inline function
(move code from GC_thread_resume).
* darwin_stop_world.c (GC_start_world): Check result of
task_threads(); call GC_thread_resume().
* os_dep.c (GC_malloc_heap_l, GC_is_malloc_heap_base): Define
only if not CYGWIN32.
* os_dep.c (GC_is_heap_base): Call GC_is_malloc_heap_base() only
if not CYGWIN32.
* darwin_stop_world.c (FindTopOfStack): Change return type to
ptr_t (from long); make GC_INNER; add GC_ prefix.
* darwin_stop_world.c (GC_push_all_stacks): Add thread_blocked
local variable (initialized from the corresponding GC_thread
field unless GC_query_task_threads); add assertion that our
thread is not blocked; prefix FindTopOfStack with GC_ and remove
no longer needed cast to ptr_t of the result; handle thread
blocked case (and remove FIXME); use GC_push_all_stack_sections
unless GC_query_task_threads (and remove FIXME).
* pthread_support.c (GC_FindTopOfStack): Declare (if needed).
* pthread_support.c (GC_do_blocking_inner): Call
GC_save_regs_in_stack (if needed) before acquiring the lock.
* win32_threads.c (GC_do_blocking_inner): Likewise.
* pthread_support.c (GC_do_blocking_inner): Set/clear topOfStack
field of GC_thread (Darwin only).
* include/private/pthread_support.h (GC_thread): Add topOfStack
field for Darwin (unless DARWIN_DONT_PARSE_STACK).
* finalize.c (GC_check_finalizer_nested): Change return type to
char pointer (instead of int pointer); use explicit cast for
GC_finalizer_nested assignment.
* pthread_support.c (GC_check_finalizer_nested): Likewise.
* win32_threads.c (GC_check_finalizer_nested): Likewise.
* finalize.c (GC_finalizer_nested): Change type to unsigned char.
* finalize.c (GC_notify_or_invoke_finalizers): Change type of
"pnested" local variable to char pointer.
* pthread_support.c (GC_do_blocking_inner,
GC_call_with_gc_active): Use explicit cast for "thread_blocked"
field assignment.
* win32_threads.c (GC_lookup_pthread): Use explicit cast for
"suspended" field assignment.
* win32_threads.c (GC_Thread_Rep): Use short type for
finalizer_skipped; use char type for finalizer_nested and flags
fields and reorder some fields (to minimize GC_Thread_Rep
structure size).
* include/private/pthread_support.h (GC_Thread_Rep): Likewise.
* win32_threads.c (GC_Thread_Rep): Use char type for suspended
field (instead of GC_bool).
* include/private/pthread_support.h (GC_Thread_Rep): Use char type
for thread_blocked field (instead of short).
* darwin_stop_world.c (GC_query_task_threads): New variable (or
* darwin_stop_world.c (GC_push_all_stacks): Use
GC_query_task_threads (to choose between algorithms based on
kernel task_threads and based on GC_threads table); update FIXME;
remove commented out GC_push_one statements.
* pthread_support.c (GC_thr_init, GC_do_blocking_inner,
GC_call_with_gc_active, GC_register_my_thread_inner): Initialize
stack_ptr field for all platforms.
* pthread_support.c (GC_call_with_gc_active): Initialize
saved_stack_ptr field for all platforms.
* include/private/darwin_stop_world.h (thread_stop_info): Add
stack_ptr field; change type of already_suspended from int to
* darwin_stop_world.c (GC_MAX_MACH_THREADS): New macro.
* darwin_stop_world.c (GC_mach_threads, GC_stop_init): Use
* darwin_stop_world.c (GC_mach_threads): Add FIXME.
* darwin_stop_world.c (GC_stop_init, GC_suspend_thread_list,
GC_stop_world): Use FALSE and TRUE for already_suspended field and
"changed", "found" variables.
* darwin_stop_world.c (GC_is_mach_marker): New prototype (only if
* darwin_stop_world.c (GC_suspend_thread_list): Change return type
to GC_bool; change type of "changed", "found" to GC_bool; make
"my_thread" as an argument (instead of acquiring/deallocating it
locally); do not add my_thread, GC_mach_handler_thread and marker
threads to GC_mach_threads table; check for overflow of
GC_mach_threads table; increase GC_mach_threads_count if "found"
is true and info.suspend_count is non-zero.
* darwin_stop_world.c (GC_suspend_thread_list, GC_start_world):
Adjust "thread" format specifiers for GC_printf(); search thread
in "old_list" starting from the previous found one.
* darwin_stop_world.c (GC_stop_world): Rename "changes" to
"changed" local variable; remove "result" variable; adjust
GC_printf debugging message.
* darwin_stop_world.c (GC_start_world): Do not check for
my_thread and GC_use_mach_handler_thread (since they are not added
to GC_mach_threads table); call thread_info() only if
* pthread_support.c (marker_mach_threads): New static variable (if
* pthread_support.c (GC_is_mach_marker): New function (if Darwin).
* pthread_support.c (GC_mark_thread): Fill in marker_mach_threads
table (if Darwin).
* alloc.c (GC_parallel): Define only if THREADS.
* misc.c (GC_get_parallel): Likewise.
* include/gc.h (GC_parallel, GC_get_parallel,
GC_get_suspend_signal, GC_allow_register_threads,
GC_register_my_thread, GC_unregister_my_thread): Define only if
* include/gc.h (GC_get_heap_size): Fix a typo in a comment.
* Use `AC_C_INLINE'.
* include/private/gc_priv.h (GC_INLINE): Use "inline" keyword
(determined by configure AC_C_INLINE) if HAVE_CONFIG_H is defined.
* dyn_load.c (DL_ITERATE_PHDR_STRONG): New macro (define for
* dyn_load.c (GC_register_main_static_data): Move the definition
above GC_register_dynamic_libraries_dl_iterate_phdr one (FreeBSD
case); unconditionally return FALSE if DL_ITERATE_PHDR_STRONG.
* dyn_load.c (GC_register_dynamic_libraries_dl_iterate_phdr): Test
GC_register_main_static_data() result (instead of direct testing
of dl_iterate_phdr (to prevent a compiler warning).
* os_dep.c (CODE_OK): Test si_code also for the value of 2
(FreeBSD case; required for FreeBSD v7+).
* os_dep.c (CODE_OK): Properly use parentheses (HPUX case).
* include/private/gcconfig.h (DATASTART): Cast etext argument in
GC_FreeBSDGetDataStart() call; remove unnecessary "&" (FreeBSD
* include/private/specific.h (quick_thread_id): Define thru
GC_approx_sp(); define as a macro.
* include/private/specific.h (getspecific): Use GC_INLINE instead
of __inline__ (to work around Sun CC which does not recognize
inline keyword surrounded with underscores).
* darwin_stop_world.c (FindTopOfStack): Simplify condition
* darwin_stop_world.c (GC_push_all_stacks): Merge two variants
of this function (DARWIN_DONT_PARSE_STACK).
* darwin_stop_world.c (GC_push_all_stacks): Add a check for our
thread is found (same as in pthread_stop_world.c).
* darwin_stop_world.c (GC_push_all_stacks): Print the number of
scanned threads if verbose (same as in pthread_stop_world.c).
* darwin_stop_world.c (GC_push_all_stacks): Reset
thread_state_count value before every thread_get_state call;
refine the comment for thread_state_count.
* darwin_stop_world.c (GC_push_all_stacks): Ignore rsp, rip/eip,
rflags, cs, fs, gs, ss, ds, es, __pc registers; uncomment ebp
register pushing.
* darwin_stop_world.c (GC_push_all_stacks): Set outCount to
* darwin_stop_world.c (GC_push_all_stacks): Remove FIXME and WARN
for i386.
* doc/README.macros (DARWIN_DONT_PARSE_STACK): Fix a typo.
* darwin_stop_world.c (GC_use_mach_handler_thread): Change type
to GC_bool.
* darwin_stop_world.c (GC_suspend_thread_list, GC_start_world):
Simplify the expressions involving GC_use_mach_handler_thread.
* darwin_stop_world.c (GC_darwin_register_mach_handler_thread):
Initialize GC_use_mach_handler_thread to TRUE (instead of 1).
* include/gc_pthread_redirects.h (GC_pthread_sigmask, GC_dlopen,
pthread_sigmask, dlopen): Don't define for Win32 pthreads (and
don't include signal.h and dlfcn.h).
* dyn_load.c (GC_register_dynlib_callback): Add FIXME.
* include/private/gcconfig.h: Add support for FreeBSD on ppc64.
* os_dep.c (PROTECT, UNPROTECT): Correct VM_PROT_EXEC to
* os_dep.c (os2_alloc): Don't set PAG_EXECUTE unless
pages_executable is on.
* os_dep.c (os2_alloc): Add FIXME (for recursion).
* os_dep.c (UNPROTECT): Abort with a more informative message if
pages_executable is on ("mprotect" case).
pages_executable is on (Darwin case).
* pthread_support.c (GC_init_real_syms): Abort with an informative
message if libgc is linked after libpthread.
* dyn_load.c (GC_register_dynlib_callback): Adjust "start" pointer
for 64-bit targets.
* pthread_support.c (start_mark_threads): Expand PTHREAD_CREATE
* pthread_support.c (start_mark_threads): Call INIT_REAL_SYMS()
since REAL(pthread_create) is used.
* pthread_support.c (PTHREAD_CREATE): Remove unused.
* extra/threadlibs.c (main): Remove --wrap for "read" (since not
wrapped anymore).
* doc/README.linux (GC_USE_LD_WRAP): Likewise.
* os_dep.c (__wrap_read): Likewise.
* include/gc_pthread_redirects.h: Test GC_PTHREADS and GC_H at the
beginning of the file.
* include/gc_pthread_redirects.h (GC_PTHREAD_EXIT_ATTRIBUTE): New
macro (defined only for Linux and Solaris).
* include/gc_pthread_redirects.h (GC_pthread_cancel,
GC_pthread_exit): Declare new API function (only if
* include/gc_pthread_redirects.h (pthread_cancel, pthread_exit):
* include/private/pthread_support.h (DISABLED_GC): New macro.
* pthread_support.c (pthread_cancel, pthread_exit): Restore
original definition or declare "real" function (if needed and
* pthread_support.c (GC_pthread_cancel_t, GC_pthread_exit_t):
Declare new types if needed.
* pthread_support.c (GC_pthread_cancel, GC_pthread_exit): New
function definition (only if GC_PTHREAD_EXIT_ATTRIBUTE).
* pthread_support.c (GC_init_real_syms): Initialize pointers to
the "real" pthread_cancel and pthread_exit (only if
* pthread_support.c (GC_unregister_my_thread): Enable collections
* pthread_support.c (pthread_cancel, pthread_exit): New wrapped
function definition (only if GC_PTHREAD_EXIT_ATTRIBUTE defined).
* pthread_support.c (GC_start_routine): Refine the comment.
* extra/threadlibs.c (main): Adjust --wrap (add "read",
"pthread_exit", "pthread_cancel" but remove "sleep").
* doc/README.linux (GC_USE_LD_WRAP): Likewise.
* include/gc.h (GC_MALLOC_STUBBORN): Remove trailing ';' in the
macro definition.
* include/gc.h (GC_reachable_here): Likewise.
* include/gc.h (GC_reachable_here): Prefix and postfix "volatile"
with double '_'.
* pthread_start.c: New file.
* CMakeLists.txt (SRC): Add pthread_start.c.
* (libgc_la_SOURCES): Likewise.
* (CSRCS): Likewise.
* (OBJS): Add pthread_start.obj.
* extra/gc.c: Add a comment; include pthread_start.c.
* pthread_support.c (start_info): Move the struct definition down
closer to its usage.
* pthread_support.c (GC_thread_exit_proc): Replace STATIC with
* pthread_support.c (GC_inner_start_routine): Move to the
definition to pthread_start.c; leave only the prototype; remove
* pthread_support.c (GC_start_rtn_prepare_thread): New function
(contains parts of the original GC_inner_start_routine).
* doc/README.macros (NO_EXECUTE_PERMISSION): Update the
* include/gc.h (GC_set_pages_executable, GC_get_pages_executable):
New API function declaration.
* os_dep.c (OPT_PROT_EXEC): Remove (superseded by
* os_dep.c (pages_executable): New static variable.
* os_dep.c (IGNORE_PAGES_EXECUTABLE): New macro (used by
GC_get_pages_executable only).
* os_dep.c (GC_unix_mmap_get_mem, GC_remap, PROTECT, UNPROTECT):
Replace OPT_PROT_EXEC with pages_executable.
* os_dep.c (GC_unix_mmap_get_mem, GC_remap, GC_win32_get_mem,
* os_dep.c (GC_win32_get_mem, GC_wince_get_mem, GC_remap, PROTECT,
UNPROTECT): Use PAGE_EXECUTE_... only if pages_executable is on.
* os_dep.c (GC_set_pages_executable, GC_get_pages_executable): New
API function definition.
* tests/test.c (check_heap_stats): Increase max_heap_sz by 20% for
64-bit CPUs (to prevent "Unexpected heap growth" failure on Win64,
at least).
* tests/test.c (check_heap_stats): Increase max_heap_sz by 25% for
32-bit CPUs (to prevent "Unexpected heap growth" failure).
* gc_dlopen.c (dlopen): Prototype REAL_DLFUNC if GC_USE_LD_WRAP.
* pthread_support.c (pthread_create, pthread_join, pthread_detach,
pthread_sigmask): Likewise.
* gc_dlopen.c (dlopen): Remove cast (redundant since the prototype
is added).
* gc_dlopen.c (GC_dlopen): Fix return type.
* pthread_support.c (GC_init_real_syms): Don't define
libpthread_name if RTLD_NEXT.
* gc_dlopen.c (disable_gc_for_dlopen): Update the comment.
* gc_dlopen.c (dlopen): Likewise.
* include/gc.h (GC_enable_incremental): Refine the comment.
* include/gc.h (DECLSPEC_NORETURN): Define macro as empty if
missing (only for Win32).
* include/gc.h (GC_ExitThread): Use DECLSPEC_NORETURN.
* win32_threads.c (GC_ExitThread): Likewise.
* include/gc.h (GC_endthreadex): Add a comment.
* include/cord.h: Fix typos.
* (EXTRA_DIST): Add "CMakeLists.txt" and
* doc/ (dist_pkgdata_DATA): Add "doc/README.cmake".
* mach_dep.c (NO_GETCONTEXT): Also define if AVR32.
* include/private/gcconfig.h (AVR32): New macro (also define the
supplementary macros for the target).
* include/private/thread_local_alloc (USE_COMPILER_TLS): Don't
define for AVR32.
* tests/leak_test.c (main): Explicitly define as returning int
(to prevent a spurious test failure on some Linux/alpha targets).
* tests/thread_leak_test.c (main): Likewise.
* tests/thread_leak_test.c: Initialize GC_find_leak in the main
thread (before GC_INIT) only.
* tests/leak_test.c (main): Use GC_set_find_leak() instead of
accessing GC_find_leak directly.
* tests/thread_leak_test.c (main): Likewise.
* include/gc.h (GC_find_leak, GC_finalize_on_demand,
GC_java_finalization, GC_dont_expand, GC_no_dls,
GC_dont_precollect): Simplify the comment (remove the information
about data races since the value is boolean).
* os_dep.c (GC_get_stack_base, GC_get_main_stack_base): New
Solaris-specific implementation (based on thr_stksegment).
* os_dep.c (stackbase_main_self, stackbase_main_ss_sp): New static
variable used by the Solaris-specific GC_get_stack_base().
* pthread_support.c (GC_mark_thread_local_free_lists,
GC_check_tls): Mark (and check) only for live threads (in case of
GC_destroy_thread_local() is called already but GC_delete_thread()
is not yet).
* win32_threads.c (GC_mark_thread_local_free_lists, GC_check_tls):
* NT_MAKEFILE: Remove the comment about DLL and Win32S.
* NT_MAKEFILE: Add ".SUFFIXES" directive (to handle
properly on VS 2005+).
* NT_MAKEFILE: Update GC log file name in comments.
* doc/README.win32: Likewise.
* NT_MAKEFILE: Remove ":full" for "-debug" option (since no
longer supported by VS).
* NT_MAKEFILE: Commented out copying of to gc_cpp.cpp.
* NT_STATIC_THREADS_MAKEFILE: Increase stack size for gctest.exe.
* NT_X64_STATIC_THREADS_MAKEFILE: Remove "-stack" option (use the
default stack size limit).
* NT_X64_THREADS_MAKEFILE: Rename "gc64_dll.dll" to "gc64.dll".
* win32_threads.c (GC_get_next_stack): Always define (since it is
also used for Cygwin now).
* alloc.c (GC_maybe_gc): Move GC_notify_full_gc() call upper to
be just before GC_clear_marks() call.
* include/gc_mark.h (GC_start_callback_proc): Refine the comment.
* (check_LTLIBRARIES): Initialize to empty.
* tests/ (TESTS, check_PROGRAMS): Add staticrootstest.
* tests/ (staticrootstest_SOURCES, staticrootstest_LDADD,
libstaticrootslib_la_SOURCES, libstaticrootslib_la_LIBADD,
libstaticrootslib_la_LDFLAGS, libstaticrootslib_la_DEPENDENCIES):
* tests/ (check_LTLIBRARIES): Add
* tests/staticrootstest.c: New file.
* tests/staticrootslib.c: Likewise.
* dyn_load.c (GC_get_next_stack, GC_cond_add_roots): Define for
Cygwin as well as other win32 targets.
* dyn_load.c (GC_wnt): Define to constant true.
* dyn_load.c (GC_register_dynamic_libraries): Define for Cygwin as
well as other win32 targets.
* mark_rts.c (rt_hash, GC_roots_present, add_roots_to_index):
Don't define for Cygwin, as on other win32.
* mark_rts.c (GC_add_roots_inner, GC_clear_roots): Handle on
Cygwin as for other win32 targets.
* mark_rts.c (GC_rebuild_root_index): Don't declare on Cygwin, as
other win32.
* mark_rts.c (GC_remove_tmp_roots): Do declare on Cygwin as on
other win32.
* mark_rts.c (GC_remove_roots, GC_remove_roots_inner): Don't
declare on Cygwin as on other win32.
* mark_rts.c (GC_is_tmp_root): Do declare on Cygwin when
!NO_DEBUGGING, as on other win32 targets.
* mark_rts.c (GC_cond_register_dynamic_libraries): Handle on
Cygwin as for other win32 targets.
* os_dep.c (GC_setpagesize): Handle on Cygwin as on other win32.
* os_dep.c (GC_get_main_stack_base): Don't declare on Cygwin, as
other win32.
* os_dep.c (GC_sysinfo): Declare on Cygwin, as other win32.
* os_dep.c (GC_win32_get_mem): Declare on Cygwin, as on other
Win32, but call GC_unix_get_mem instead of GlobalAlloc.
* os_dep.c (GC_win32_free_heap): Declare on Cygwin (as empty).
* ptr_chck.c (GC_is_visible): Register dynamic libraries on Cygwin
as on other win32 platforms.
* win32_threads.c (GC_get_next_stack): Define on Cygwin as well as
for dynamic loading targets.
* include/private/gc_priv.h (GC_INNER): Don't try to use
visibility on Cygwin which does not support it.
* include/private/gc_priv.h (struct roots): Don't declare r_next
member on Cygwin as on other windows hosts.
* include/private/gc_priv.h (LOG_RT_SIZE, RT_SIZE): Don't define
* include/private/gc_priv.h (struct _GC_arrays): Do declare
_heap_bases[] member and don't declare _root_index likewise.
* include/private/gc_priv.h (GC_heap_bases): Do define likewise.
* include/private/gc_priv.h (_SYSTEM_INFO): Do forward-declare
* include/private/gc_priv.h (GC_sysinfo): Do declare extern
* include/private/gcconfig.h (GC_win32_get_mem, GET_MEM): Do
prototype on Cygwin as other win32 platforms.
* os_dep.c (GC_get_main_stack_base): Use pthread_getattr_np() and
pthread_attr_getstack() instead of GC_get_stack_base() (and check
returned stackaddr for NULL); output a warning on failure.
* alloc.c (GC_start_call_back): Replace the definition type to
* alloc.c (GC_set_start_callback, GC_get_start_callback): New
setter/getter function.
* alloc.c (GC_try_to_collect_inner): Call GC_notify_full_gc()
unconditionally (because GC_try_to_collect_inner always does full
* include/gc_mark.h (GC_start_callback_proc): New type.
* include/gc_mark.h (GC_set_start_callback,
GC_get_start_callback): New API function declaration.
* doc/README.macros (USE_GET_STACKBASE_FOR_MAIN): Document.
* os_dep.c (GC_get_main_stack_base): Recognize
and use GC_get_stack_base() in this case.
* os_dep.c (GC_get_stack_base): Add LOCK/UNLOCK() (since
GC_find_limit_with_bound() should be called with the lock held).
* backgraph.c (FOR_EACH_PRED): Fix a typo.
* alloc.c (GC_set_stop_func, GC_get_stop_func): Add
* finalize.c (GC_notify_or_invoke_finalizers): Likewise.
* gc_dlopen.c (disable_gc_for_dlopen): Likewise.
* gcj_mlc.c (maybe_finalize, GC_debug_gcj_malloc): Likewise.
* mark.c (GC_print_trace): Likewise.
* misc.c (GC_set_warn_proc, GC_get_warn_proc, GC_enable,
GC_disable, GC_new_free_list, GC_new_kind, GC_new_proc,
GC_set_oom_fn, GC_get_oom_fn, GC_set_finalizer_notifier,
GC_get_finalizer_notifier): Likewise.
* os_dep.c (GC_get_stack_base, GC_print_callers): Likewise.
* pthread_support.c (GC_is_thread_tsd_valid,
GC_wait_for_gc_completion, GC_init_parallel, GC_do_blocking_inner,
GC_call_with_gc_active, GC_unregister_my_thread, pthread_join,
pthread_detach, GC_register_my_thread, GC_inner_start_routine,
pthread_create): Likewise.
* reclaim.c (GC_print_all_errors): Likewise.
* win32_threads.c (GC_is_thread_tsd_valid, GC_register_my_thread,
GC_unregister_my_thread, GC_do_blocking_inner,
GC_call_with_gc_active, GC_lookup_pthread, GC_pthread_join,
GC_pthread_start_inner, GC_thread_exit_proc, GC_pthread_detach,
GC_init_parallel): Likewise.
* doc/README.darwin: Update.
* CMakeLists.txt: Adjust INCLUDE_DIRECTORIES and SRC (to make it
usable on Mac OS X).
* doc/README.cmake: Update.
* CMakeLists.txt: New file (adding CMake support).
* tests/CMakeLists.txt: Likewise.
* doc/README.cmake: Likewise.
* (darwin): Don't define HAS_PPC_THREAD_STATE...
* include/private/gc_priv.h (THREAD_FLD): Recognize
__DARWIN_UNIX03 instead of HAS_PPC_THREAD_STATE... macros.
* pthread_support.c: Include <sys/param.h> and <sys/sysctl.h> for
* pthread_support.c (get_ncpu): Define also for Darwin, NetBSD and
* pthread_support.c (GC_thr_init): Use get_ncpu() for Darwin,
NetBSD and OpenBSD.
* mallocx.c (GC_generic_malloc_many, GC_malloc_many): Define even
if THREADS is undefined.
* include/gc.h (GC_malloc_many): Update the comment.
* include/gc_cpp.h (GC_PLACEMENT_DELETE): Define for Embarcadero
(formerly known as Borland) C++ compiler v6.21+.
* include/gc_cpp.h (GC_NO_OPERATOR_NEW_ARRAY): Define for ancient
VC++ compilers.
* win32_threads.c (GC_register_my_thread_inner,
GC_pthread_start_inner): Undo the previous commit changes for
the thread flags and DETACHED state (since the state is only
tested in GC_thread_exit_proc).
* include/gc.h (GC_unregister_my_thread): Fix a typo; update the
* pthread_support.c (GC_delete_thread): Allow to delete the main
thread (don't call GC_INTERNAL_FREE for it); update the comment.
* win32_threads.c (GC_delete_thread): Likewise.
* pthread_support.c (GC_unregister_my_thread): Add an assertion
for FINISHED flag is unset.
* tests/test.c (check_heap_stats): Test the main thread
unregistering (only if THREADS).
* win32_threads.c (GC_register_my_thread_inner): Set flags to
* win32_threads.c (GC_unregister_my_thread): Add FIXME (for
* win32_threads.c (GC_pthread_start_inner): Clear flags detached
state if needed; set pthread_id and flags while holding the lock.
* include/private/gc_priv.h (SIG_SUSPEND): Don't define for
OpenBSD and Darwin.
* include/gc.h: Recognize _M_X64 (as an alias for _AMD64_).
* test.c (main, WinMain): Consistently don't invoke
GC_enable_incremental() if MAKE_BACKGRAPH is defined, but
do invoke it even if parallel marking is enabled.
* tests/test.c (reverse_test): Comment out a check for MSWIN32
(when determing BIG value) assuming outdated win32S.
* tests/test.c (reverse_test): Rename to reverse_test_inner;
change the declaration (to be of GC_fn_type); call itself thru
GC_call_with_gc_active() if the argument is zero.
* tests/test.c (reverse_test): New function added calling
reverse_test_inner thru GC_do_blocking (to test GC_do_blocking and
* dyn_load.c: Don't include <elf.h> if PLATFORM_ANDROID.
* dyn_load.c: Include bionic <linker.h> (instead of <link.h>) if
* include/private/gcconfig.h (LINUX): Define also if
PLATFORM_ANDROID (for the windows-based toolkit).
* include/private/gcconfig.h (SEARCH_FOR_DATA_START): Explicitly
define for Android/x86 platform.
* include/private/gcconfig.h (IGNORE_DYNAMIC_LOADING): Recognize
new macro (undefine DYNAMIC_LOADING in this case).
* include/private/gcconfig.h (CANCEL_SAFE): Don't define if
* include/private/gcconfig.h (IF_CANCEL): Fix definition for the
explicitly defined CANCEL_SAFE.
* allchblk.c (GC_allochblk_nth): Don't call GC_remove_protection()
* reclaim.c (GC_reclaim_generic): Likewise.
* checksums.c (GC_page_was_ever_dirty): Add prototype.
* include/private/gc_locks.h (GC_mark_lock_holder): Don't declare
* include/private/gc_priv.h (GC_dirty_maintained,
GC_page_was_dirty, GC_remove_protection, GC_dirty_init): Don't
* include/private/gc_priv.h (GC_print_finalization_stats): Don't
declare if SMALL_CONFIG.
* include/private/gcconfig.h (CHECKSUMS): Explicitly undefine if
GC_DISABLE_INCREMENTAL (since nothing to check).
* include/private/gcconfig.h (DEFAULT_VDB): Don't define if
* os_dep.c (GC_dirty_maintained): Likewise.
* mark.c (GC_initiate_gc): Don't call GC_read_dirty() if
* os_dep.c (GC_gww_page_was_ever_dirty, GC_page_was_ever_dirty):
Uncomment; define only if CHECKSUMS.
* darwin_stop_world.c (GC_push_all_stacks): Fix a bug (call
GC_push_all_stack() instead of GC_push_all_stack_frames()).
* include/private/gc_priv.h (GC_push_all_stack_frames,
GC_push_all_register_frames): Rename to
GC_push_all_stack_sections and GC_push_all_register_sections,
* mark_rts.c (GC_push_all_stack_frames,
GC_push_all_register_frames, GC_push_all_stack_part_eager_frames,
GC_push_current_stack): Likewise.
* pthread_stop_world.c (GC_push_all_stacks): Likewise.
* win32_threads.c (GC_push_stack_for): Likewise.
* misc.c (GC_call_with_gc_active): Rename "frame" local variable
to "stacksect".
* pthread_support.c (GC_call_with_gc_active): Likewise.
* win32_threads.c (GC_call_with_gc_active): Likewise.
* pthread_support.c (GC_call_with_gc_active): Update FIXME for
* win32_threads.c (GC_Thread_Rep): Update the comment for
* darwin_stop_world.c (GC_push_all_stacks): Rename
activation_frame to traced_stack_sect.
* include/private/gc_priv.h (GC_push_all_stack_frames,
GC_push_all_register_frames): Likewise.
* include/private/pthread_support.h (GC_Thread_Rep): Likewise.
* mark_rts.c (GC_push_all_register_frames,
GC_push_all_stack_frames, GC_push_all_stack_part_eager_frames,
GC_push_current_stack): Likewise.
* pthread_stop_world.c (GC_push_all_stacks): Likewise.
* pthread_support.c (GC_call_with_gc_active): Likewise.
* win32_threads.c (GC_Thread_Rep, GC_call_with_gc_active,
GC_push_stack_for): Likewise.
* include/private/gc_priv.h (GC_activation_frame_s): Rename to
* include/private/gc_priv.h (GC_activation_frame): Rename to
* misc.c (GC_activation_frame, GC_call_with_gc_active): Likewise.
* doc/README.macros (UNICODE): Document.
* doc/README.macros (GC_READ_ENV_FILE): Document (new macro).
* include/private/gc_priv.h (GETENV): Recognize GC_READ_ENV_FILE;
declare and use GC_envfile_getenv().
* misc.c (GC_envfile_content, GC_envfile_length): New static
variable (only if GC_READ_ENV_FILE).
* misc.c (GC_ENVFILE_MAXLEN): New macro (used in GC_envfile_init).
* misc.c (GC_envfile_init, GC_envfile_getenv): New function (only
* misc.c (GC_init): Call GC_envfile_init() (before using GETENV)
* misc.c (GC_init): Move GC_setpagesize() and GC_init_win32()
calls to be just before GC_envfile_init() one (since the latter
uses GET_MEM).
* misc.c (GC_abort): use ExitProcess() (instead of DebugBreak) for
WinCE if NO_DEBUGGING; add a comment for DebugBreak() (for WinCE).
* mark_rts.c (GC_add_roots_inner): Remove redundant trailing '\n'
from the ABORT message.
* misc.c (GC_init): Likewise.
* os_dep.c (GC_get_main_stack_base, GC_register_data_segments):
* pthread_stop_world.c (GC_push_all_stacks): Likewise.
* pthread_support.c (GC_init_real_syms, start_mark_threads):
* win32_threads.c (GC_get_next_stack): Don't define for Cygwin
(since unused for now).
* dyn_load.c (HAVE_REGISTER_MAIN_STATIC_DATA): Don't define unless
GC_register_main_static_data() is defined.
* dyn_load.c (GC_register_dynamic_libraries): Define only if used
(if DYNAMIC_LOADING or PCR or Win32/CE).
* dyn_load.c (GC_register_main_static_data): Define the default
one only if DYNAMIC_LOADING.
* include/private/gc_priv.h (GC_register_dynamic_libraries):
Declare only if used (to prevent compiler warning).
* mark_rts.c (GC_approx_sp): Add a comment (for GCC).
== [7.2alpha4] 2009-12-01 ==
* (AC_CONFIG_COMMANDS): Quote srcdir value.
* include/gc.h (GC_get_suspend_signal): New function declaration.
* misc.c (GC_get_suspend_signal): New API function (only if
* alloc.c (min_bytes_allocd): Multiply GC_free_space_divisor by
two if GC_incremental (instead of TRUE_INCREMENTAL).
* sparc_mach_dep.S (GC_push_regs): Remove the reference.
* os_dep.c (SIZE_T, PULONG_PTR): Remove.
* os_dep.c (ULONG_PTR): Replace with GC_ULONG_PTR (defined as GC
"word"); add the comment.
* os_dep.c (GetWriteWatch_type, detect_GetWriteWatch,
GC_gww_read_dirty): Prefix ULONG_PTR with "GC_".
* win32_threads.c (THREAD_TABLE_SZ): Change back to a power-of-two
const value (for speed).
* win32_threads.c (THREAD_TABLE_INDEX): New macro.
* win32_threads.c (GC_new_thread, GC_lookup_thread_inner,
GC_delete_gc_thread, GC_delete_thread, GC_lookup_pthread): Use
* win32_threads.c (PTHREAD_MAP_HASH): Rename to PTHREAD_MAP_INDEX.
* win32_threads.c (THREAD_TABLE_SZ): Make the const value prime.
* backgraph.c: Remove apostrophe char from "#error".
* doc/README.macros (GC_DISABLE_INCREMENTAL): Document.
* include/private/gcconfig.h (GC_DISABLE_INCREMENTAL): Recognize
new macro; implicitly define it if SMALL_CONFIG.
* alloc.c (GC_incremental, GC_timeout_stop_func): Check for
* include/private/gc_priv.h (GC_incremental, TRUE_INCREMENTAL,
GC_push_conditional): Likewise.
* mark.c (GC_push_next_marked_dirty, GC_push_selected,
GC_push_conditional, GC_block_was_dirty): Likewise.
* misc.c (GC_enable_incremental): Likewise.
* misc.c (GC_init): Likewise.
* dyn_load.c (WIN32_LEAN_AND_MEAN): Guard with ifndef.
* misc.c (WIN32_LEAN_AND_MEAN): Likewise.
* os_dep.c (WIN32_LEAN_AND_MEAN): Likewise.
* allchblk.c (GC_allochblk_nth): Fix a minor typo (don't/doesn't)
in a comment.
* backgraph.c: Likewise.
* dyn_load.c (GC_register_dynamic_libraries): Likewise.
* extra/threadlibs.c (main): Likewise.
* pthread_support.c (pthread_join): Likewise.
* tests/test.c (main): Likewise.
* mach_dep.c (GC_push_regs): Remove STATIC (just to catch
a duplicate symbol definition linker error).
* misc.c (GC_clear_stack_inner): Likewise.
* sparc_mach_dep.S (GC_push_regs): Comment out the reference.
* include/private/gc_priv.h (GC_write_disabled): New variable
declaration (only if GC_ASSERTIONS and Win32 threads).
* misc.c (GC_write): Add assertion for GC_write_disabled value is
not on (only if THREADS).
* win32_threads.c (GC_write_disabled): New variable (only if
GC_ASSERTIONS and not Cygwin).
* win32_threads.c (GC_stop_world): Set and clear GC_write_disabled
(while holding GC_write_cs).
* win32_threads.c (GC_please_stop): If DllMain-based thread
registration is not compiled in then define GC_please_stop as
a non-volatile variable for assertion only.
* win32_threads.c (GC_stop_world): Set and clear only if defined.
* win32_threads.c (GC_stop_world): Add the comment for GC_printf()
usage (while holding GC_write_cs).
* win32_threads.c (GC_delete_gc_thread): Likewise.
* os_dep.c (GC_remove_protection): Likewise.
* pthread_support.c (GC_inner_start_routine): Join 3 sequential
GC_printf() calls into a single one (for DEBUG_THREADS).
* include/private/gc_priv.h (GC_total_stacksize): New variable
declaration (only if THREADS).
* alloc.c (GC_total_stacksize): New variable (only if THREADS).
* alloc.c (min_bytes_allocd): Calculate stack_size using
GC_stackbottom only in the single-threaded case; otherwise use
GC_total_stacksize; print GC_total_stacksize value if
* darwin_stop_world.c (GC_push_all_stacks): Use "%p" printf type
specifier for lo/hi values (instead of "%lx").
* darwin_stop_world.c (GC_push_all_stacks): Use
GC_push_all_stack_frames() instead of GC_push_all_stack().
* darwin_stop_world.c (GC_push_all_stacks): Recalculate
GC_total_stacksize value.
* pthread_stop_world.c (GC_push_all_stacks): Likewise.
* win32_threads.c (GC_push_all_stacks): Likewise.
* win32_threads.c (GC_push_stack_for): Pass "me" argument; return
stack size; don't check for non-zero value of thread->stack_base.
* win32_threads.c (GC_push_all_stacks): Don't call
GC_push_stack_for() and don't check for "t->id == me" if
thread->stack_base is zero.
* dyn_load.c (GC_dump_meminfo): Prefix "%lx" printf type specifier
with "0x".
* os_dep.c (PROTECT): Likewise.
* win32_threads.c (GC_mark_thread_local_free_lists): Cast p->id to
int (to match printf type specifier).
* tests/test.c (check_heap_stats): Take into account the unmapped
memory size when checking for "Unexpected heap growth"; remove
* alloc.c: Revert last change.
* include/private/gcconfig.h (STACKBOTTOM): Add a presence check
for eCos/NOSYS.
* misc.c (GC_write): Comment out _Jv_diag_write() call (since no
longer defined in GCJ).
* os_dep.c (brk): Rename to ecos_gc_brk.
* alloc.c (min_bytes_allocd): Use GC_stackbottom value to compute
stack_size even if THREADS.
* doc/README.macros (DEBUG_THREADS): Document.
* pthread_support.c (DEBUG_THREADS): Remove the commented out
* win32_threads.c (DEBUG_WIN32_THREADS): Remove duplicate
* win32_threads.c: Include errno.h (except for WinCE).
* win32_threads.c (GC_win32_start_inner): Copy "start" and "param"
to local variables, and free "arg" parameter before "start"
* win32_threads.c (GC_beginthreadex): Set errno to EAGAIN on error
(instead of calling SetLastError(ERROR_NOT_ENOUGH_MEMORY)).
* win32_threads.c (GC_beginthreadex): Return 0 on error (instead
of -1).
* darwin_stop_world.c (GC_darwin_register_mach_handler_thread):
Use GC_INNER for the function definition.
* include/private/darwin_stop_world.h
(GC_darwin_register_mach_handler_thread): Remove the prototype.
* os_dep.c (GC_darwin_register_mach_handler_thread): Use GC_INNER
for the function prototype.
* include/private/gc_priv.h (NDEBUG): Explicitly define if
NO_DEBUGGING and not GC_ASSERTIONS (before the standard headers
* include/private/gcconfig.h: Move DebugBreak() workaround (for
x86mingw32ce toolchain) to gc_priv.h (after windows.h inclusion).
* allchblk.c (GC_unmap_old, GC_merge_unmapped, GC_allochblk,
GC_freehblk): Use GC_INNER for the function definition.
* alloc.c (GC_never_stop_func, GC_should_collect,
GC_try_to_collect_inner, GC_collect_a_little_inner,
GC_set_fl_marks, GC_add_to_our_memory, GC_add_to_heap,
GC_expand_hp_inner, GC_collect_or_expand, GC_allocobj): Likewise.
* backgraph.c (GC_build_back_graph, GC_traverse_back_graph):
* blacklst.c (GC_default_print_heap_obj_proc, GC_bl_init,
GC_promote_black_lists, GC_unpromote_black_lists,
GC_add_to_black_list_normal, GC_add_to_black_list_stack,
GC_is_black_listed): Likewise.
* darwin_stop_world.c (GC_push_all_stacks, GC_push_all_stacks,
GC_stop_init, GC_stop_world, GC_start_world): Likewise.
* dbg_mlc.c (GC_has_other_debug_info, GC_store_back_pointer,
GC_marked_for_finalization, GC_generate_random_backtrace_no_gc,
GC_store_debug_info, GC_start_debugging,
GC_debug_malloc_uncollectable, GC_debug_free_inner): Likewise.
* dyn_load.c (GC_register_dynamic_libraries,
GC_register_main_static_data, GC_init_dyld): Likewise.
* finalize.c (GC_push_finalizer_structures, GC_finalize,
GC_notify_or_invoke_finalizers, GC_print_finalization_stats):
* gcj_mlc.c (GC_core_gcj_malloc): Likewise.
* headers.c (GC_find_header, GC_header_cache_miss,
GC_scratch_alloc, GC_init_headers, GC_install_header,
GC_install_counts, GC_remove_header, GC_remove_counts,
GC_next_used_block, GC_prev_block): Likewise.
* mach_dep.c (GC_with_callee_saves_pushed): Likewise.
* malloc.c (GC_collect_or_expand, GC_alloc_large,
GC_generic_malloc_inner, GC_generic_malloc_inner_ignore_off_page,
GC_core_malloc_atomic, GC_core_malloc, GC_free_inner): Likewise.
* mallocx.c (GC_generic_malloc_ignore_off_page): Likewise.
* mark.c (GC_collection_in_progress, GC_clear_hdr_marks,
GC_set_hdr_marks, GC_set_mark_bit, GC_clear_mark_bit,
GC_clear_marks, GC_initiate_gc, GC_mark_some,
GC_mark_stack_empty, GC_invalidate_mark_state,
GC_signal_mark_stack_overflow, GC_mark_from, GC_help_marker,
GC_mark_init, GC_push_all, GC_push_conditional,
GC_mark_and_push_stack, GC_push_all_eager, GC_push_all_stack):
* mark_rts.c (GC_is_static_root, GC_roots_present, GC_approx_sp,
GC_exclude_static_roots_inner, GC_push_all_register_frames,
GC_push_all_stack_frames, GC_cond_register_dynamic_libraries,
GC_push_roots): Likewise.
* misc.c (GC_extend_size_map, GC_clear_stack, GC_err_write):
* new_hblk.c (GC_build_fl, GC_new_hblk): Likewise.
* obj_map.c (GC_register_displacement_inner, GC_add_map_entry,
GC_initialize_offsets): Likewise.
* os_dep.c (GC_get_maps, GC_parse_map_entry, GC_text_mapping,
GC_init_linux_data_start, GC_init_netbsd_elf, GC_setpagesize,
GC_set_and_save_fault_handler, GC_setup_temporary_fault_handler,
GC_reset_fault_handler, GC_get_register_stack_base, GC_init_win32,
GC_add_current_malloc_heap, GC_is_heap_base, GC_unmap, GC_remap,
GC_unmap_gap, GC_push_all_stacks, GC_gww_dirty_init,
GC_dirty_init, GC_read_dirty, GC_page_was_dirty,
GC_page_was_ever_dirty, GC_remove_protection,
GC_write_fault_handler, GC_mprotect_stop, GC_mprotect_resume,
GC_save_callers, GC_print_callers): Likewise.
* pthread_stop_world.c (GC_push_all_stacks, GC_stop_world,
GC_start_world, GC_stop_init): Likewise.
* pthread_support.c (GC_mark_thread_local_free_lists,
GC_lookup_thread, GC_reset_finalizer_nested,
GC_check_finalizer_nested, GC_segment_is_thread_stack,
GC_greatest_stack_base_below, GC_thr_init, GC_init_parallel,
GC_do_blocking_inner, GC_lock, GC_acquire_mark_lock,
GC_release_mark_lock, GC_wait_for_reclaim, GC_notify_all_builder,
GC_wait_marker, GC_notify_all_marker): Likewise.
* reclaim.c (GC_print_all_errors, GC_block_empty,
GC_reclaim_generic, GC_start_reclaim, GC_continue_reclaim,
GC_reclaim_all): Likewise.
* thread_local_alloc.c (GC_init_thread_local,
GC_destroy_thread_local, GC_mark_thread_local_fls_for): Likewise.
* win32_threads.c (GC_reset_finalizer_nested,
GC_check_finalizer_nested, GC_do_blocking_inner, GC_stop_world,
GC_start_world, GC_push_all_stacks, GC_get_next_stack,
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, GC_init_parallel, GC_lock,
GC_mark_thread_local_free_lists): Likewise.
* alloc.c (GC_add_current_malloc_heap, GC_build_back_graph,
GC_traverse_back_graph): Use GC_INNER for the function prototype.
* darwin_stop_world.c (GC_mprotect_stop, GC_mprotect_resume):
* dbg_mlc.c (GC_default_print_heap_obj_proc): Likewise.
* dyn_load.c (GC_parse_map_entry, GC_get_maps,
GC_segment_is_thread_stack, GC_roots_present, GC_is_heap_base,
GC_get_next_stack): Likewise.
* finalize.c (GC_reset_finalizer_nested,
GC_check_finalizer_nested): Likewise.
* gcj_mlc.c (GC_start_debugging): Likewise.
* include/private/dbg_mlc.h (GC_save_callers, GC_print_callers,
GC_has_other_debug_info, GC_store_debug_info): Likewise.
* include/private/gc_hdrs.h (GC_header_cache_miss): Likewise.
* include/private/gc_locks.h (GC_lock): Likewise.
* include/private/gc_pmark.h (GC_signal_mark_stack_overflow,
GC_mark_from): Likewise.
* include/private/pthread_support.h (GC_lookup_thread,
GC_stop_init): Likewise.
* include/private/thread_local_alloc.h (GC_init_thread_local,
GC_destroy_thread_local, GC_mark_thread_local_fls_for): Likewise.
* malloc.c (GC_extend_size_map, GC_text_mapping): Likewise.
* mark.c (GC_page_was_ever_dirty): Likewise.
* mark_rts.c (GC_mark_thread_local_free_lists): Likewise.
* misc.c (GC_register_main_static_data, GC_init_win32,
GC_setpagesize, GC_init_linux_data_start,
GC_set_and_save_fault_handler, GC_init_dyld, GC_init_netbsd_elf,
GC_do_blocking_inner): Likewise.
* os_dep.c (GC_greatest_stack_base_below): Likewise.
* win32_threads.c (GC_write_fault_handler, GC_gww_dirty_init):
* include/private/gc_priv.h: Likewise.
* include/private/gc_priv.h (GC_INNER): Update the comment.
* doc/README.macros (GC_DLL): Update.
* alloc.c (GC_collection_in_progress): Move the prototype to
* gc_dlopen.c (GC_collection_in_progress): Likewise.
* pthread_support.c (GC_collection_in_progress): Likewise.
* misc.c (GC_init_parallel): Likewise.
* pthread_support.c (GC_init_parallel): Likewise.
* win32_threads.c (GC_init_parallel): Likewise.
* darwin_stop_world.c (GC_thr_init): Likewise.
* misc.c (GC_thr_init): Likewise.
* pthread_stop_world.c (GC_thr_init): Likewise.
* pthread_support.c (GC_thr_init): Likewise.
* blacklst.c (GC_clear_bl, GC_copy_bl,
GC_number_stack_black_listed): Make STATIC.
* dbg_mlc.c (GC_print_obj, GC_make_closure,
GC_debug_invoke_finalizer): Likewise.
* malloc.c (GC_alloc_large_and_clear): Likewise.
* mark.c (GC_push_selected, GC_push_marked1, GC_push_marked2,
GC_push_marked4, GC_push_marked, GC_push_next_marked,
GC_push_next_marked_dirty, GC_push_next_marked_uncollectable):
* misc.c (GC_clear_stack_inner): Likewise.
* os_dep.c (GC_repeat_read, GC_default_push_other_roots): Likewise.
* darwin_stop_world.c (FindTopOfStack): Make static; define only
* dbg_mlc.c (GC_debug_free_inner): Define only if DBG_HDRS_ALL.
* dyn_load.c (GC_repeat_read): Remove unused prototype.
* include/private/gc_pmark.h (GC_find_start): Likewise.
* misc.c (GC_read, GC_register_finalizer_no_order): Likewise.
* dyn_load.c (GC_segment_is_thread_stack): Add prototype (only if
* dyn_load.c (GC_register_main_static_data): Define only if
* finalize.c (GC_enqueue_all_finalizers): Remove unnecessary tail
"return" statement.
* gc_dlopen.c (GC_SOLARIS_THREADS): Don't recognize (since implies
* include/gc.h: Fix a typo.
* include/gc_inline.h (GC_ASSERT): Define (if not defined) since
the header is public.
* include/gc_inline.h (GC_generic_malloc_many): New public
function declaration.
* mallocx.c (GC_generic_malloc_many): Make public.
* include/private/gc_priv.h (GC_INNER): Use visibility attribute
(if available).
* include/private/gc_priv.h (GC_EXTERN): Define using GC_INNER.
* include/private/gc_priv.h: Include atomic_ops.h if THREADS and
* os_dep.c: Don't include atomic_ops.h
* win32_threads.c: Likewise.
* include/private/gc_priv.h (GC_push_selected, GC_push_regs,
GC_push_marked, GC_number_stack_black_listed,
GC_alloc_large_and_clear, GC_reclaim_or_delete_all,
GC_generic_malloc_many, GC_make_closure,
GC_debug_invoke_finalizer, GC_print_obj, GC_page_was_ever_dirty):
Remove the prototype.
* mark.c (GC_page_was_ever_dirty): Add prototype (only if
* include/private/gc_priv.h (GC_push_next_marked_dirty,
GC_push_next_marked, GC_push_next_marked_uncollectable): Move
the prototype to mark.c.
* include/private/gc_priv.h (GC_is_static_root): Declare only if
* include/private/gc_priv.h (GC_free_inner): Declare only if
* include/private/gc_priv.h (GC_debug_free_inner): Declare only if
* include/private/gc_priv.h (GC_markers): Declare GC_markers only
* include/private/gc_priv.h (GC_register_main_static_data): Move
the prototype to misc.c.
* mach_dep.c (GC_push_regs): Make STATIC; define only along with
HAVE_PUSH_REGS definition.
* mach_dep.c (GC_clear_stack_inner): Replace K&R-style function
definition with the ANSI C one.
* mark.c (GC_started_thread_while_stopped): Declared only if not
* win32_threads.c (GC_started_thread_while_stopped): Don't define
if GNU C.
* mark.c (GC_mark_from): Avoid unbalanced brackets in
#if-#else-#endif blocks.
* mark_rts.c (GC_is_static_root): Define only if not THREADS.
* os_dep.c (GC_get_stack_base): Make public (for OpenBSD).
* os_dep.c (GC_page_was_ever_dirty): Comment out the function
except for PROC_VDB.
* tests/test.c (main): Don't reference GC_print_obj,
GC_make_closure, GC_debug_invoke_finalizer,
GC_page_was_ever_dirty, GC_is_fresh (in GC_noop).
* thread_local_alloc.c: Don't include "gc_inline.h".
* win32_threads.c (GC_write_fault_handler): Declare only if
* allchblk.c (DEBUG): Remove macro (since unused).
* allchblk.c: Include private/gc_priv.h before other includes and
* alloc.c: Likewise.
* gc_dlopen.c: Likewise.
* headers.c: Likewise.
* mallocx.c: Likewise.
* mark_rts.c: Likewise.
* new_hblk.c: Likewise.
* reclaim.c: Likewise.
* mark.c: Include private/gc_pmark.h before other includes.
* misc.c: Likewise.
* dyn_load.c (_GNU_SOURCE): Move the definition to gc_priv.h.
* pthread_support.c (_USING_POSIX4A_DRAFT10): Likewise.
* pthread_support.c (_POSIX4A_DRAFT10_SOURCE): Remove (since
already defined in gc_config_macros.h).
* dyn_load.c (GC_init_dyld): Remove parameter cast for
_dyld_register_func_for_add_image() and
_dyld_register_func_for_remove_image(); add the comment about
possible warnings; add FIXME for the deprecated
* include/private/gc_priv.h: Include gc.h before the standard
headers inclusion.
* tests/test.c: Likewise.
* include/private/gcconfig.h (DebugBreak): Update the comment.
* typd_mlc.c (ED_INITIAL_SIZE): Remove ';'.
* (openbsd): Define GC_OPENBSD_THREADS.
* Add sparc-openbsd case.
* tests/test.c (main): Handle OpenBSD case.
* include/private/pthread_stop_world.h: Likewise.
* extra/threadlibs.c (main): Replace K&R-style function definition
with the ANSI C one.
* extra/threadlibs.c (main): Handle GC_OPENBSD_THREADS case.
* dyn_load.c (OPENBSD): Recognize (similar to NETBSD).
* include/gc_config_macros.h (GC_SOLARIS_THREADS): Recognize;
define it for OpenBSD.
* include/gc_pthread_redirects.h (GC_pthread_sigmask,
pthread_sigmask): Don't declare and redefine for OpenBSD.
* include/private/gcconfig.h: Handle OpenBSD (on arm, sh, i386,
amd64, powerpc).
* mach_dep.c (NO_GETCONTEXT): Likewise.
* include/private/pthread_stop_world.h (thread_stop_info): Don't
define last_stop_count field if OpenBSD.
* misc.c (GC_init_dyld): Add declaration (if NetBSD).
* misc.c (GC_init): Don't call GC_init_netbsd_elf() for OpenBSD.
* os_dep.c (GC_init_netbsd_elf): Don't define for OpenBSD.
* os_dep.c (old_segv_act, GC_jmp_buf_openbsd): New static variable
(only if OpenBSD).
* os_dep.c (GC_fault_handler_openbsd, GC_find_limit_openbsd,
GC_skip_hole_openbsd): New static function (only if OpenBSD).
* os_dep.c (GC_get_stack_base, GC_get_main_stack_base,
GC_register_data_segments): Define specially for OpenBSD case.
* os_dep.c (GC_fault_handler_lock): Initialize to
AO_TS_INITIALIZER (instead of 0).
* pthread_support.c (GC_allocate_lock): Likewise.
* pthread_stop_world.c (NSIG, GC_print_sig_mask,
GC_remove_allowed_signals, suspend_handler_mask, GC_stop_count,
GC_world_is_stopped, GC_retry_signals, SIG_THR_RESTART,
GC_suspend_ack_sem, GC_suspend_handler_inner, GC_suspend_handler,
GC_restart_handler): Don't define and use if OpenBSD.
* pthread_stop_world.c (GC_suspend_all, GC_stop_world,
GC_start_world): Handle OpenBSD case.
* pthread_stop_world.c (GC_stop_init): Define as empty if OpenBSD.
* pthread_support.c (pthread_sigmask): Don't undefine the macro and
don't define the wrapper function if OpenBSD.
* pthread_support.c (GC_thr_init): Handle OpenBSD case.
* dyn_load.c: Move the inclusion of private/gc_priv.h below
definition of a feature macro (_GNU_SOURCE).
* include/gc.h (REVEAL_POINTER): Remove redundant parentheses.
* include/gc.h (GC_HIDE_POINTER, GC_REVEAL_POINTER): New macros
* backgraph.c (GET_OH_BG_PTR): Prefix REVEAL_POINTER() with "GC_".
* dbg_mlc.c (GC_get_back_ptr_info): Likewise.
* finalize.c (GC_grow_table, GC_dump_finalization, GC_finalize,
GC_enqueue_all_finalizers): Likewise.
* backgraph.c (SET_OH_BG_PTR): Prefix HIDE_POINTER() with "GC_".
* finalize.c (GC_general_register_disappearing_link,
GC_unregister_disappearing_link, GC_register_finalizer_inner,
GC_finalize): Likewise.
* include/private/dbg_mlc.h (HIDE_BACK_PTR): Likewise.
* include/private/dbg_mlc.h (GC_I_HIDE_POINTERS): Define instead
* include/private/gc_priv.h (GC_I_HIDE_POINTERS): Likewise.
* include/gc.h (_GC_H): Strip leading underscore.
* include/gc_backptr.h (_GC_H): Likewise.
* include/gc_gcj.h (_GC_H): Likewise.
* include/gc_mark.h (_GC_H): Likewise.
* include/gc_typed.h (_GC_TYPED_H, _GC_H): Likewise.
* include/javaxfc.h (_GC_H): Likewise.
* include/new_gc_alloc.h (__GC_SPECIALIZE): Likewise.
* include/private/dbg_mlc.h (_GC_H): Likewise.
* include/private/gc_priv.h (_GC_H): Likewise.
* Include "gc_cpp.h" instead of <gc_cpp.h>.
* include/private/gc_priv.h (GC_INNER): New macro (for GC-scope
variable definitions).
* include/private/gc_priv.h (GC_EXTERN): Update the comment.
* allchblk.c (GC_unmap_threshold): Define as GC_INNER.
* alloc.c (GC_incremental, GC_world_stopped, GC_n_heap_sects,
GC_n_memory, GC_fail_count): Likewise.
* blacklst.c (GC_black_list_spacing, GC_print_heap_obj): Likewise.
* gcj_mlc.c (GC_gcj_malloc_initialized, GC_gcjobjfreelist): Likewise.
* mach_dep.c (GC_save_regs_ret_val): Likewise.
* mark.c (GC_n_mark_procs, GC_obj_kinds, GC_n_kinds,
GC_mark_stack, GC_mark_stack_limit, GC_mark_stack_size,
GC_mark_stack_top, GC_mark_state, GC_mark_stack_too_small,
GC_mark_no, GC_markers): Likewise.
* mark_rts.c (GC_root_size, GC_push_typed_structures): Likewise.
* misc.c (GC_allocate_ml, GC_debugging_started, GC_check_heap,
GC_print_all_smashed, GC_print_back_height, GC_dump_regularly,
GC_backtraces, GC_force_unmap_on_gcollect,
GC_large_alloc_warn_interval, GC_is_initialized, GC_write_cs,
GC_current_warn_proc, GC_blocked_sp, GC_activation_frame): Likewise.
* os_dep.c (GC_page_size, GC_dont_query_stack_min,
GC_no_win32_dlls, GC_wnt, GC_sysinfo, GC_push_other_roots,
GC_dirty_maintained, GC_fault_handler_lock): Likewise.
* pthread_support.c (GC_allocate_ml, GC_lock_holder,
GC_need_to_lock, GC_thr_initialized, GC_threads,
GC_in_thread_creation, GC_collecting, GC_allocate_lock,
GC_mark_lock_holder): Likewise.
* reclaim.c (GC_bytes_found, GC_fl_builder_count, GC_have_errors):
* win32_threads.c (GC_allocate_ml, GC_lock_holder,
GC_need_to_lock, GC_mark_lock_holder, GC_collecting): Likewise.
* extra/gc.c (GC_INNER, GC_EXTERN): Define as STATIC.
* mach_dep.c (GC_with_callee_saves_pushed): Remove redundant {}.
* include/private/gc_priv.h (GC_bytes_allocd, GC_objfreelist,
GC_aobjfreelist): Replace GC_EXTERN to extern for SEPARATE_GLOBALS
case (since they are not defined inside GC at present).
* include/private/gc_priv.h (GC_objects_are_marked): Remove the
declaration (since made static).
* mark.c (GC_objects_are_marked): Define as STATIC.
* win32_threads.c (GC_thr_initialized, GC_in_thread_creation):
* mark.c (GC_N_KINDS_INITIAL_VALUE): New macro (defined and used
to initialize GC_n_kinds).
* win32_threads.c (start_mark_threads): Adjust the comment.
* alloc.c (GC_notify_full_gc): Use GC_INLINE for a tiny static
* backgraph.c (pop_in_progress, GC_apply_to_each_object): Likewise.
* mark_rts.c (add_roots_to_index): Likewise.
* extra/gc.c: New file.
* (EXTRA_DIST): Add "extra/gc.c".
* misc.c (GC_log): Remove the declaration; move the definition (to
the place where it is used); make STATIC.
* misc.c (GC_init): Use GC_err_printf() instead of GC_log_printf()
to print open log failure.
* misc.c (GC_write): Don't abort on open log failure if the GC is
compiled with GC_PRINT_VERBOSE_STATS (useful for WinCE).
* include/private/gcconfig.h (USE_MMAP): Guard with ifndef.
* allchblk.c (GC_fail_count, GC_large_alloc_warn_interval): Move
the variable declaration to gc_priv.h.
* alloc.c (GC_bytes_found, GC_unmap_threshold,
GC_force_unmap_on_gcollect): Likewise.
* dyn_load.c (GC_no_win32_dlls, GC_wnt): Likewise.
* finalize.c (GC_fail_count): Likewise.
* include/private/gc_locks.h (GC_allocate_ml, GC_lock_holder,
GC_collecting, GC_mark_lock_holder, GC_need_to_lock): Likewise.
* include/private/gc_pmark.h (GC_n_mark_procs, GC_mark_stack_size,
GC_mark_stack_limit, GC_mark_stack_top, GC_mark_stack,
GC_mark_stack_too_small, GC_mark_state): Likewise.
* include/private/pthread_support.h (GC_threads,
GC_thr_initialized, GC_in_thread_creation): Likewise.
* mallocx.c (GC_bytes_found): Likewise.
* mark_rts.c (GC_save_regs_ret_val, GC_world_stopped): Likewise.
* misc.c (GC_unmap_threshold): Likewise.
* os_dep.c (GC_unmap_threshold): Likewise.
* pthread_support.c (GC_markers): Likewise.
* thread_local_alloc.c (GC_gcjobjfreelist,
GC_gcj_malloc_initialized, GC_gcj_kind): Likewise.
* win32_threads.c (GC_fault_handler_lock, GC_write_cs,
GC_dont_query_stack_min, GC_markers, GC_wnt): Likewise.
* include/private/gc_priv.h (GC_EXTERN): New macro (used mostly as
a tag for now); defined after "gcconfig.h" inclusion.
* include/private/gc_priv.h: Use GC_EXTERN instead of "extern"
keyword for most global variables.
* alloc.c (GC_copyright): Add the comment about the symbol
* finalize.c (GC_fo_entries): Likewise.
* include/private/gc_priv.h (GC_print_stats): Likewise.
* misc.c (GC_quiet): Likewise.
* mallocx.c (GC_bytes_allocd_tmp): Make the volatile variable
* pthread_support.c (GC_threads): Add explicit zero initializer
(to make the variable definition differ from the declaration).
* backgraph.c (GC_quiet): Remove the declaration (not needed
anymore since gc_priv.h is always included).
* checksums.c (GC_quiet): Likewise.
* gcj_mlc.c (GC_quiet): Likewise.
* headers.c (GC_hdr_cache_hits, GC_hdr_cache_misses): Add the
* include/private/gc_hdrs.h (GC_hdr_cache_hits,
GC_hdr_cache_misses): Likewise.
* mark.c (GC_first_nonempty): Make the volatile variable STATIC.
* pthread_stop_world.c (GC_stop_count, GC_world_is_stopped):
* win32_threads.c (GC_please_stop, GC_max_thread_index,
GC_mark_mutex_waitcnt): Likewise.
* pthread_support.c (GC_USE_LD_WRAP): Fix a typo (swapped 'L' and
'D') in the name.
* gc_dlopen.c (GC_MUST_RESTORE_REDEFINED_DLOPEN): Define if dlopen
redirection is turned off; turn it on later when dlopen real
symbol is no longer needed (according to the comment and the same
as in dyn_load.c).
* gc_dlopen.c (WRAP_FUNC, REAL_FUNC): Rename to WRAP_DLFUNC and
REAL_DLFUNC, respectively (to have unique names since the
definitions may differ from that of the similar ones in
* mark.c (source): Undefine the macro when no longer needed.
* os_dep.c (handler): Rename the type to GC_fault_handler_t (to
have the unique name across the project).
* os_dep.c (STAT_BUF_SIZE, STAT_READ); Guard with ifndef; add the
* pthread_support.c (STAT_BUF_SIZE, STAT_READ): Likewise.
* os_dep.c (sbrk): Undo sbrk() redirection (for ECOS) when no
longer needed.
* pthread_stop_world.c (pthread_sigmask): Undefine before using
in GC_print_sig_mask() (only if DEBUG_THREADS); add the comment.
* win32_threads.c (dlopen, _beginthread): Don't undefine (since
neither redirected nor used here).
* win32_threads.c (GC_Thread_Rep): Rename "table_management" to
"tm" for short; remove "tm_" prefix.
* win32_threads.c (in_use, next): Don't define the macros; use
tm.in_use and fields, respectively (to ease debugging).
* win32_threads.c (HASH): Rename to PTHREAD_MAP_HASH (to have
unique name across the project).
* include/private/gc_priv.h (I_HIDE_POINTERS): Define before gc.h
* include/private/gc_pmark.h (I_HIDE_POINTERS): Define if gc.h is
not included yet.
* finalize.c (I_HIDE_POINTERS): Don't define.
* include/private/dbg_mlc.h (I_HIDE_POINTERS): Likewise.
* misc.c (I_HIDE_POINTERS): Likewise.
* include/private/dbg_mlc.h (HIDE_POINTER, REVEAL_POINTER,
GC_hidden_pointer): Don't define if HIDE_POINTER is undefined.
* include/private/gc_pmark.h: Remove the comment about gc_priv.h
inclusion order.
* dyn_load.c: Include gc_priv.h before using configuration
information (MACOS).
* dyn_load.c (GC_must_restore_redefined_dlopen): Rename to
* backgraph.c (SET_OH_BG_PTR): Place outermost parenthesis
* darwin_stop_world.c: Replace "if DEBUG_THREADS" with
* pthread_stop_world.c: Likewise.
* pthread_support.c: Likewise.
* include/gc_inline.h: Guard with GC_INLINE_H.
* alloc.c (GC_copyright): Define as const.
* alloc.c (GC_collect_at_heapsize): Replace "static" with "STATIC"
(since the name starts with "GC_" prefix).
* dbg_mlc.c (GC_describe_type_fns): Likewise.
* dyn_load.c (GC_FirstDLOpenedLinkMap,
GC_register_dynlib_callback, GC_dyld_sections,
GC_dyld_name_for_hdr, GC_dyld_image_add, GC_dyld_image_remove):
* malloc.c (GC_libpthread_start, GC_libpthread_end,
GC_libld_start, GC_libld_end): Likewise.
* mark_rts.c (GC_remove_root_at_pos, GC_rebuild_root_index):
* os_dep.c (GC_gww_read_dirty, GC_gww_page_was_dirty,
GC_gww_page_was_ever_dirty, GC_mprotect_thread_notify,
GC_mprotect_thread_reply, GC_mprotect_thread, GC_darwin_sigbus,
GC_forward_exception): Likewise.
* pthread_support.c (GC_syms_initialized): Likewise.
* typd_mlc.c (GC_push_typed_structures_proc): Likewise.
* win32_threads.c (GC_win32_dll_threads,
GC_register_my_thread_inner, GC_lookup_pthread, GC_get_stack_min,
GC_waitForSingleObjectInfinite): Likewise.
* darwin_stop_world.c (GC_use_mach_handler_thread,
GC_use_mach_handler_thread, GC_mach_threads_count): Replace
"static" with "STATIC" and add zero initializer.
* os_dep.c (GC_task_self, GC_ports, GC_mprotect_state,
GC_sigbus_count): Likewise.
* headers.c (free_hdr): Replace "static" with GC_INLINE.
* misc.c (GC_tmp): Rename static variable to fwrite_gc_res.
* os_dep.c (memory): Rename static variable to ecos_gc_memory.
* os_dep.c (async_set_pht_entry_from_index): Make static (for
* pthread_support.c (GC_real_pthread_create,
GC_real_pthread_sigmask, GC_real_pthread_join,
GC_real_pthread_detach, GC_init_real_syms): Use REAL_FUNC() macro
for static GC_real_XXX symbols.
* win32_threads.c (GC_may_be_in_stack): Remove "GC_" prefix.
* alloc.c (GC_finish_collection): Replace getenv() with GETENV().
* dyn_load.c (GC_init_dyld): Likewise.
* os_dep.c (GC_print_callers): Likewise.
* dyn_load.c (GC_dyld_name_for_hdr): Cast _dyld_get_image_name()
result (since it's always of "struct mach_header" type).
* dyn_load.c (GC_init_dyld): Cast GC_dyld_image_add and
GC_dyld_image_remove (to always have the first argument of
"struct mach_header" pointer type).
* Add threads support for OpenBSD case (threads may
not work correctly for it).
* acinclude.m4: Rename to m4/gc_set_version.m4.
* m4/libtool.m4: Delete the file.
* m4/lt~obsolete.m4: Likewise.
* m4/ltoptions.m4: Likewise.
* m4/ltsugar.m4: Likewise.
* m4/ltversion.m4: Likewise.
* include/private/gcconfig.h: Define DebugBreak() as _exit(-1) for
x86mingw32ce toolchain to workaround the incorrect DebugBreak()
declaration in winbase.h (the workaround would turn into a no-op
when DebugBreak() will be defined as a macro in the toolchain).
* include/private/gcconfig.h: Recognize __i386__ if WinCE (for
x86mingw32ce toolchain).
* include/private/gcconfig.h (NO_GETENV): Don't define for CeGCC
toolchain (or if already defined).
* include/private/gcconfig.h (NO_GETENV_WIN32): New macro (always
defined for WinCE or if NO_GETENV is defined).
* misc.c (GC_CreateLogFile): Use NO_GETENV_WIN32 macro instead of
* Add "ACLOCAL_AMFLAGS = -I m4".
* libtool.m4: Remove.
* m4/libtool.m4: New file (generated).
* m4/lt~obsolete.m4: Likewise.
* m4/ltoptions.m4: Likewise.
* m4/ltsugar.m4: Likewise.
* m4/ltversion.m4: Likewise.
* include/gc.h (GC_UNDERSCORE_STDCALL): Recognize new macro;
prefix GC_CreateThread and GC_ExitThread with '_' if defined.
* doc/README.macros (GC_UNDERSCORE_STDCALL): Document.
* alloc.c (GC_collect_or_expand): Add "retry" argument; add the
comments; don't use "default" stop_func on a retry if
* alloc.c (GC_allocobj): Pass "retry" argument to
* malloc.c (GC_alloc_large): Likewise.
* include/private/gc_priv.h (GC_collect_or_expand): Move the
declaration to malloc.c; add "retry" argument.
* alloc.c (GC_start_call_back): Move the variable definition from
* include/private/gc_priv.h (GC_start_call_back): Remove the
* alloc.c (GC_notify_full_gc): Remove unnecessary cast of 0.
* alloc.c (GC_try_to_collect_inner): Also call stop_func at the
beginning of the function.
* include/gc.h (GC_try_to_collect): Refine the comment about
* alloc.c (GC_default_stop_func, GC_try_to_collect_general,
GC_gcollect): Add the comment.
* alloc.c (GC_try_to_collect_general): Move the assertion on
stop_func != 0 to GC_try_to_collect().
* alloc.c (GC_try_to_collect_general): If stop_func == 0 then use
GC_default_stop_func instead (holding the lock).
* alloc.c (GC_gcollect): Pass 0 as stop_func instead of
GC_default_stop_func (to prevent data races).
* Move "define arguments" documentation to
doc/README.macros; add reference to doc/README.macros.
* Change the documentation reference to
* README.QUICK: Likewise.
* Likewise.
* allchblk.c: Remove unnecessary "-D" from the comment.
* doc/README.macros: Likewise.
* README.environment: Likewise.
* include/gc.h: Likewise.
* include/gc_inline.h: Likewise.
* include/private/gcconfig.h: Likewise.
* README.QUICK: Fix a typo.
* misc.c (GC_CreateLogFile): Use FILE_ATTRIBUTE_NORMAL for
CreateFile(); don't immediately flush every write if very verbose.
* doc/README.win32: Replace ".exe.log" to ".gc.log".
* doc/README.win64: Likewise.
* doc/README.win64: Fix a typo.
* misc.c (GC_CreateLogFile): Strip executable file extension for
the log file; use ".gc.log" extension (instead of ".log").
* include/gc_config_macros.h: Avoid the redefinition of
GC_xxx_THREADS macros.
* alloc.c (GC_try_to_collect_general): Change the type of "result"
local variable to GC_bool.
* include/gc_config_macros.h: Use old behavior for FreeBSD and
NetBSD platform detection code (check that other GC_xxx_THREADS
are undefined); add FIXME.
* include/gc_config_macros.h: Rearrange the platform detection
code (GC_WIN32_PTHREADS implies GC_WIN32_THREADS; define
GC_THREADS first if GC_XXX_THREADS already set; define proper
place; define _REENTRANT if posix threads except for Win32).
* alloc.c (GC_try_to_collect_general): New function (move the code
from GC_try_to_collect, pass force_unmap argument).
* alloc.c (GC_try_to_collect, GC_gcollect): Call
* alloc.c (GC_gcollect_and_unmap): New public function.
* include/gc.h (GC_gcollect_and_unmap): New function declaration.
* tests/test.c (window_proc): Call GC_gcollect_and_unmap() on
WM_HIBERNATE event (instead of GC_set_force_unmap_on_gcollect()
and GC_gcollect()).
* include/gc.h (GC_allow_register_threads, GC_register_my_thread,
GC_unregister_my_thread, GC_malloc_many): Refine the comment.
* include/gc.h (GC_malloc_many, GC_NEXT): Declare unconditionally
(that is, don't depend on GC_THREADS macro).
* include/gc.h: Don't check for __CYGWIN32__ and __CYGWIN__ along
with a check for GC_PTHREADS (since the former implies the
* include/gc.h (GC_SOLARIS_THREADS): Don't check for.
* include/gc.h (GC_MIN, GC_MAX): Don't define.
* mallocx.c (GC_malloc_many): Add comment to #endif.
* Drop the subdir-objects Automake option, since
it's incompatible with picking source files from libatomic_ops.
* allchblk.c (GC_fail_count, GC_large_alloc_warn_interval): Add
"extern" keyword to a global variable declaration (some compilers
require it).
* alloc.c (GC_bytes_found, GC_unmap_threshold,
GC_force_unmap_on_gcollect): Likewise.
* dyn_load.c (GC_no_win32_dlls, GC_wnt): Likewise.
* finalize.c (GC_fail_count): Likewise.
* include/private/gc_hdrs.h (GC_hdr_cache_hits,
GC_hdr_cache_misses): Likewise.
* mallocx.c (GC_bytes_found): Likewise.
* mark_rts.c (GC_save_regs_ret_val, GC_world_stopped): Likewise.
* misc.c (GC_unmap_threshold): Likewise.
* os_dep.c (GC_unmap_threshold, GC_old_allocator): Likewise.
* pthread_support.c (GC_markers): Likewise.
* thread_local_alloc.c (GC_gcjobjfreelist,
GC_gcj_malloc_initialized, GC_gcj_kind): Likewise.
* win32_threads.c (GC_fault_handler_lock, GC_write_cs,
GC_dont_query_stack_min, GC_markers, GC_wnt): Likewise.
* tests/huge_test.c: Define GC_IGNORE_WARN (if not defined) to
suppress misleading GC "Out of Memory!" warning printed on every
* tests/huge_test.c: Include "gc.h" instead of <gc.h>.
* tests/huge_test.c (main): Replace K&R-style function definition
with the ANSI C one.
* dyn_load.c (GC_register_dynamic_libraries): Always use
lpMaximumApplicationAddress value for WinCE (even for old
* os_dep.c (VER_PLATFORM_WIN32_CE): Define if not in winbase.h.
* os_dep.c (GC_dont_query_stack_min): New global variable (only if
* os_dep.c (GC_setpagesize): Adjust lpMaximumApplicationAddress
for WinCE (prior to version 6) if not _WIN32_WCE_EMULATION; set
GC_dont_query_stack_min for older WinCE (prior to version 5).
* win32_threads.c (GC_dont_query_stack_min): Declare.
* win32_threads.c (GC_get_stack_min): Rename the macro to
GC_wince_evaluate_stack_min for WinCE; update the comment.
* win32_threads.c (GC_push_stack_for, GC_get_next_stack): Use
GC_wince_evaluate_stack_min() instead of GC_get_stack_min() for
WinCE and don't update thread's last_stack_min value (only if
* win32_threads.c (GC_push_stack_for): Skip assertion for WinCE if
GC_dont_query_stack_min (since the evaluated stack_min value may
be incorrect if the stack is bigger than 64 KiB).
* gc_dlopen.c (GC_dlopen): Add function redirector (only if
* include/gc.h: Include "gc_pthread_redirects.h" even if
* include/gc_pthread_redirects.h (GC_PTHREAD_REDIRECTS_H): Don't
define and check for (since included only from gc.h).
* include/gc_pthread_redirects.h: Declare "GC_" symbols even if
* include/gc_pthread_redirects.h: Include signal.h only to get
sigset_t definition.
* mark_rts.c (GC_is_tmp_root): Define also for WinCE unless
NO_DEBUGGING (that is, replace _WIN32_WCE_EMULATION with MSWINCE).
* os_dep.c (GC_sysinfo): Remove explicit global variable
initialization to "{0}" (revert back the previous change) since it
might produce a warning.
* allchblk.c (GC_large_alloc_warn_interval): Move declaration from
* allchblk.c (GC_large_alloc_warn_suppressed): Move definition
from misc.c; define as STATIC.
* include/private/gc_priv.h (GC_large_alloc_warn_interval,
GC_large_alloc_warn_suppressed): Remove declaration.
* alloc.c (GC_bytes_found): Add "defined in" comment.
* mallocx.c (GC_bytes_found): Likewise.
* misc.c (GC_unmap_threshold): Likewise.
* os_dep.c (GC_old_allocator): Likewise.
* pthread_support.c (GC_markers): Likewise.
* thread_local_alloc.c (GC_gcjobjfreelist,
GC_gcj_malloc_initialized, GC_gcj_kind): Likewise.
* win32_threads.c (GC_markers): Likewise.
* alloc.c (GC_start_time): Explicitly initialize to 0 or NULL (to
be distinctive from a variable declaration).
* backgraph.c (GC_max_height, GC_deepest_obj): Likewise.
* blacklst.c (GC_old_normal_bl, GC_incomplete_normal_bl,
GC_old_stack_bl, GC_incomplete_stack_bl): Likewise.
* checksums.c (GC_faulted, GC_n_dirty_errors,
GC_n_faulted_dirty_errors, GC_n_changed_errors, GC_n_clean,
GC_n_dirty, GC_bytes_in_used_blocks): Likewise.
* dbg_mlc.c (GC_smashed): Likewise.
* finalize.c (GC_old_dl_entries): Likewise.
* gcj_mlc.c (GC_gcj_kind, GC_gcj_debug_kind, GC_gcjobjfreelist,
GC_gcjdebugobjfreelist): Likewise.
* mach_dep.c (GC_save_regs_ret_val): Likewise.
* mark.c (GC_n_rescuing_pages, GC_mark_stack, GC_mark_stack_limit,
GC_mark_stack_top): Likewise.
* misc.c (GC_min_sp, GC_high_water, GC_bytes_allocd_at_reset):
* os_dep.c (GC_data_start, GC_page_size, GC_sysinfo,
GC_old_segv_handler, GC_old_bus_handler,
GC_old_bus_handler_used_si, GC_old_segv_handler_used_si,
GC_proc_buf, GC_proc_fd, GC_vd_base): Likewise.
* pthread_stop_world.c (GC_stop_count, GC_stopping_pid): Likewise.
* reclaim.c (GC_leaked): Likewise.
* typd_mlc.c (GC_explicit_kind, GC_array_kind, GC_ext_descriptors,
GC_typed_mark_proc_index, GC_array_mark_proc_index,
GC_eobjfreelist, GC_arobjfreelist): Likewise.
* win32_threads.c (GC_pthread_map_cache, GC_marker_cv,
GC_marker_Id): Likewise.
* dbg_mlc.c (GC_smashed, GC_n_smashed): Define as STATIC.
* gcj_mlc.c (GC_gcjdebugobjfreelist): Likewise.
* os_dep.c (GC_vd_base): Likewise.
* pthread_support.c (GC_mark_threads): Likewise.
* reclaim.c (GC_leaked): Likewise.
* typd_mlc.c (GC_bm_table): Likewise.
* mark_rts.c (GC_save_regs_ret_val): Change declaration type to
that of definition; add "defined in" comment.
* mark_rts.c (GC_push_current_stack): Remove unnecessary cast for
* misc.c (GC_check_heap, GC_print_all_smashed,
GC_start_call_back): Remove unnecessary cast (of 0).
* misc.c (GC_LARGE_ALLOC_WARN_INTERVAL): New tuning macro.
* misc.c (GC_large_alloc_warn_interval): Initialize to
* misc.c (GC_tmp): Change to "static".
* os_dep.c (GC_mprotect_state): Define as static.
* pthread_support.c (dummy_thread_local): Prefix with "GC_".
* win32_threads.c (WinMain): Remove FIXME for WinCE.
* os_dep.c (PROTECT, UNPROTECT): Use distinct ABORT messages.
* Rewrite the tests for external or internal
* In particular, drop the symbolic links. Add option
--with-libatomic-ops for forced selection.
* Adjust the path of source files from libatomic_ops
to not use the links.
* (libgc_la_LIBADD): Add $(ATOMIC_OPS_LIBS). This will
be empty if we use the bundled AO sources.
* Strip version suffix for libatomic_ops directory.
* Likewise.
* Likewise.
* Likewise.
* Remove AO_VERSION definition; strip version
suffix for libatomic_ops directory.
* gc.mak: Likewise.
* libatomic_ops: Rename from "libatomic_ops-1.2".
* alloc.c (GC_version): Add "const" keyword.
* alloc.c (GC_get_version): New public function.
* include/gc.h (GC_get_version): New function declaration; update
the comment for the GC version.
* include/private/gc_locks.h (GC_allocate_ml, GC_lock_holder,
GC_collecting, GC_mark_lock_holder, GC_need_to_lock): Use "extern"
(for the global variable declaration) again.
* include/private/gc_pmark.h (GC_n_mark_procs, GC_mark_stack_size,
GC_mark_stack_limit, GC_mark_stack_top, GC_mark_stack,
GC_mark_stack_too_small, GC_mark_state): Likewise.
* include/private/gcconfig.h (GC_register_stackbottom): Likewise.
* include/private/pthread_support.h (GC_threads,
GC_thr_initialized, GC_in_thread_creation): Likewise.
* include/private/gc_priv.h: Likewise.
* real_malloc.c: Include private/config.h if HAVE_CONFIG_H.
* allchblk.c (GC_hblkfreelist): Define as STATIC.
* blacklst.c (GC_total_stack_black_listed): Likewise.
* include/private/gc_priv.h (GC_hblkfreelist, GC_stopped_mark,
GC_total_stack_black_listed, GC_push_stubborn_structures): Remove
* mark_rts.c (GC_stopped_mark): Add declaration (only if
* allchblk.c (GC_fail_count): Move the declaration out of
GC_allochblk_nth(); remove "extern".
* alloc.c (IF_THREADS): Remove unused macro.
* alloc.c (GC_world_stopped): Define only if THREAD_LOCAL_ALLOC.
* alloc.c (GC_stopped_mark): Set GC_world_stopped value only if
* alloc.c (GC_bytes_found, GC_collection_in_progress,
GC_check_tls, GC_unmap_threshold, GC_force_unmap_on_gcollect):
Remove K&R-style "extern" for the declaration.
* dbg_mlc.c (GC_free_inner): Likewise.
* dyn_load.c (GC_repeat_read, GC_roots_present, GC_is_heap_base,
GC_get_next_stack, GC_no_win32_dlls, GC_wnt): Likewise.
* finalize.c (GC_fail_count): Likewise.
* include/private/gc_hdrs.h (GC_hdr_cache_hits,
GC_hdr_cache_misses): Likewise.
* include/private/gc_locks.h (GC_allocate_ml, GC_lock_holder,
GC_lock, GC_collecting, GC_mark_lock_holder, GC_need_to_lock):
* include/private/gc_pmark.h (GC_mark_procs, GC_n_mark_procs,
GC_mark_stack_size, GC_mark_stack_limit, GC_mark_stack_top,
GC_mark_stack, GC_mark_stack_too_small, GC_mark_state): Likewise.
* include/private/gc_priv.h (GC_current_warn_proc, GC_obj_kinds,
GC_n_kinds, GC_fo_entries, GC_n_heap_sects, GC_n_memory,
GC_page_size, GC_sysinfo, GC_black_list_spacing,
GC_objects_are_marked, GC_incremental, GC_dirty_maintained,
GC_root_size, GC_debugging_started, GC_large_alloc_warn_interval,
GC_large_alloc_warn_suppressed, GC_blocked_sp,
GC_activation_frame, GC_push_other_roots,
GC_push_finalizer_structures, GC_push_thread_structures,
GC_push_typed_structures, GC_start_call_back, GC_is_initialized,
GC_check_heap, GC_print_all_smashed, GC_print_all_errors,
GC_print_heap_obj, GC_have_errors, GC_print_stats,
GC_dump_regularly, GC_backtraces, GC_print_back_height,
GC_fl_builder_count, GC_mark_no, GC_help_marker,
GC_setup_temporary_fault_handler, GC_reset_fault_handler): Likewise.
* include/private/gcconfig.h (GC_SysVGetDataStart,
GC_FreeBSDGetDataStart, GC_register_stackbottom,
GC_MacTemporaryNewPtr, GC_amiga_get_mem): Likewise.
* include/private/pthread_support.h (GC_threads,
GC_thr_initialized, GC_in_thread_creation): Likewise.
* malloc.c (GC_text_mapping): Likewise.
* mallocx.c (GC_bytes_found): Likewise.
* mark.c (GC_check_dirty, GC_started_thread_while_stopped): Likewise.
* mark_rts.c (GC_save_regs_ret_val): Likewise.
* misc.c (GC_clear_stack_inner, GC_init_parallel, GC_init_win32,
GC_setpagesize, GC_init_linux_data_start,
GC_set_and_save_fault_handler, GC_unmap_threshold): Likewise.
* os_dep.c (GC_unmap_threshold, GC_push_all_stacks,
GC_darwin_register_mach_handler_thread): Likewise.
* pthread_support.c (GC_markers, GC_collection_in_progress):
* tests/test.c (GC_amiga_free_all_mem): Likewise.
* thread_local_alloc.c (GC_gcjobjfreelist,
GC_gcj_malloc_initialized, GC_gcj_kind): Likewise.
* win32_threads.c (GC_write_fault_handler, GC_gww_dirty_init,
GC_fault_handler_lock, GC_write_cs, GC_markers): Likewise.
* misc.c (GC_read, GC_register_finalizer_no_order, GC_init_dyld):
Move the declaration out of GC_init(); remove "extern".
* os_dep.c (GC_abort): Add the comment; add workaround to suppress
compiler "unreachable code" warnings for ABORT callers (where
ABORT is followed by a dummy return statement).
* os_dep.c (GC_old_allocator): Move the declaration out of
GC_default_push_other_roots(); remove "extern".
* darwin_stop_world.c (GC_mprotect_stop, GC_mprotect_resume):
Move the declaration out of GC_stop_world() and GC_start_world()
(only if MPROTECT_VDB); remove "extern".
* win32_threads.c (GC_get_stack_min, GC_push_stack_for,
GC_get_next_stack): Recognize _WIN32_WCE_EMULATION macro (used for
WinCE emulation and for custom WinCE 6 devices); add the comment.
* win32_threads.c (GC_get_stack_min): Cast pointer to word instead
* win32_threads.c (GC_get_next_stack): Don't use and maintain the
latest known stack_min value for WinCE (if GC_get_stack_min is
defined as a macro); update the comments.
* win32_threads.c (GC_wnt): Don't declare for WinCE.
* gcj_mlc.c (GC_clear_stack): Remove declaration.
* malloc.c (GC_clear_stack): Likewise.
* mallocx.c (GC_clear_stack): Likewise.
* typd_mlc.c (GC_clear_stack): Likewise.
remove "lb" unnecessary cast to word.
* include/private/gc_priv.h (GC_clear_stack): Add declaration.
* include/private/gc_priv.h (GENERAL_MALLOC, GENERAL_MALLOC_IOP):
Move common declaration from typd_mlc.c and malloc.c; remove
unnecessary result and "lb" parameter casts.
* include/private/thread_local_alloc.h: Guard against duplicate
header file inclusion.
* os_dep.c (USE_MUNMAP): Replace "-->" with an error directive for
the case when USE_MMAP is not defined.
* pthread_support.c (GC_is_thread_tsd_valid): New internal
function (only if GC_ASSERTIONS and THREAD_LOCAL_ALLOC); move the
code from thread-local GC_malloc(); add FIXME for the condition.
* win32_threads.c (GC_is_thread_tsd_valid): Likewise.
* thread_local_alloc.c (GC_gcjobjfreelist): Change the type (to
match that of its definition).
* thread_local_alloc.c (GC_destroy_thread_local): Add a cast for
* thread_local_alloc.c (GC_lookup_thread, GC_lookup_thread_inner):
Remove unused declaration; don't include pthread.h.
* thread_local_alloc.c (GC_is_thread_tsd_valid): New declaration
(only if GC_ASSERTIONS).
* thread_local_alloc.c (GC_malloc): Use GC_is_thread_tsd_valid()
instead of GC_lookup_thread().
* win32_threads.c (GC_lookup_thread_inner): Define as STATIC.
* win32_threads.c (UNPROTECT): Rename to UNPROTECT_THREAD (to have
id different from that in os_dep.c).
* allchblk.c (GC_enough_large_bytes_left): Replace "inline static"
* include/private/gc_priv.h (fixed_getenv): Likewise.
* alloc.c (GC_max, GC_min): Replace "static INLINE" with
* mark_rts.c (rt_hash): Likewise.
* win32_threads.c (GC_get_max_thread_index): Likewise.
* include/private/gc_priv.h (INLINE): Prefix with "GC_"; include
"static"; define for Sun CC; define for VC++ (and other
* pthread_support.c: Don't define __inline__ for non-GNU compilers
(not needed anymore).
* NT_THREADS_MAKEFILE: Remove file (since it duplicates gc.mak).
* Remove reference to NT_THREADS_MAKEFILE.
* Likewise.
* Likewise.
* Likewise.
* doc/README.win32: Add reference to gc.mak.
* Remove references to acinclude.m4, libtool.m4.
* Update.
* Don't add libtool.m4 to EXTRA_DIST.
* acinclude.m4: Fix underquoting of GC_SET_VERSION.
* README.QUICK: Update information for Makefile.
* Do not distribute the substituted bdw-gc.pc.
* Add AM conditional analog to KEEP_BACK_PTRS.
* tests/ Use it here to conditionally enable tracetest
when possible.
* dyn_load.c (GC_wnt): Update the comment.
* dyn_load.c (GC_register_dynamic_libraries): Add the comment for
macro); call GC_is_heap_base() only if check for Type succeeded.
* mark_rts.c (GC_is_tmp_root): Don't define unless NO_DEBUGGING;
update the comment.
* include/private/gc_priv.h (GC_is_tmp_root): Remove declaration.
* include/private/gcconfig.h (CANCEL_SAFE, IF_CANCEL): new macros.
* include/private/gc_priv.h (DISABLE_CANCEL, RESTORE_CANCEL,
* alloc.c (GC_maybe_gc): Assert cancellation disabled.
(GC_collect_a_little_inner,GC_try_to_collect, GC_collect_or_expand):
Disable cancellation.
(GC_add_to_our_memory): Check for overflow.
* misc.c (GC_cancel_disable_count): declare.
(GC_init, GC_write): Disable cancellation.
(GC_init): Remove redundant GC_is_initialized test.
* os_dep.c (GC_repeat_read): Assert cancellation disabled.
(GC_get_stack_base): Disable cancellation.
* pthread_stop_world.c (GC_suspend_handler_inner): Disable
* pthread_support.c (GC_mark_thread): Permanently disable
(GC_wait_for_gc_completion, GC_wait_builder, GC_wait_marker):
Assert cancellation disabled.
(fork handling): Disable cancellation, fix comment.
(GC_pthread_create): Disable cancellation.
(GC_unregister_my_thread): Disable cancellation.
* Document NO_CANCEL_SAFE.
* Makefile: Remove outdated file ( should be used
* include/gc.h (GC_use_DllMain): Refine the comment.
* Add documentation to AC_DEFINE for GC_THREADS and
* Fix a typo.
* Likewise.
* checksums.c (GC_checksum, GC_update_check_page): Remove
"register" keyword in local variable declarations (for the code
used only for debugging or which is not time-critical).
* dbg_mlc.c (GC_has_other_debug_info, GC_store_debug_info,
GC_store_debug_info_inner, GC_check_annotated_obj, GC_print_obj,
GC_print_smashed_obj, GC_debug_end_stubborn_change,
GC_debug_invoke_finalizer): Likewise.
* dyn_load.c (GC_register_dynamic_libraries): Likewise.
* mallocx.c (GC_realloc): Likewise.
* mark_rts.c (GC_print_static_roots, GC_is_static_root,
GC_clear_roots): Likewise.
* misc.c (GC_write): Likewise.
* os_dep.c (GC_print_callers): Likewise.
* dyn_load.c (GC_register_dynamic_libraries): Rename "i" local
variable to "j" for the nested loop (just not to hide the similar
variable in the outer one).
* mark_rts.c (GC_print_static_roots): Output an error message
using GC_err_printf() (instead of GC_printf()).
* Move include flag from ${INCLUDE} ...
* ... to AM_CPPFLAGS and also add the build directory.
* Call AM_CONFIG_HEADER([include/private/config.h]).
* Add documentation to all AC_DEFINE either directly
or using AH_TEMPLATE.
* win32_threads.c (GC_waitForSingleObjectInfinite): New static
function (only if GC_WINMAIN_REDIRECT).
* win32_threads.c (WinMain): Call GC_waitForSingleObjectInfinite()
thru GC_do_blocking() instead of calling WaitForSingleObject()
* pthread_support.c (start_mark_threads): Refine printed message.
* win32_threads.c (GC_thr_init): Likewise.
* (GC_WINMAIN_REDIRECT): Add the comment for.
* (NO_GETENV): Update the comment.
* include/gc.h (GC_WINMAIN_WINCE_LPTSTR): Remove macro.
* include/gc.h (GC_WinMain): Remove declaration.
* include/gc.h (WinMain): Define (as GC_WinMain) if and only if
* tests/test.c (GC_COND_INIT): Define as GC_INIT() also in case of
WinCE target unless GC_WINMAIN_REDIRECT is defined.
* tests/test.c (WINMAIN_LPTSTR): New macro.
* tests/test.c (WinMain): Use WINMAIN_LPTSTR instead of LP[W]STR
* win32_threads.c (start_mark_threads): Add the comment for
* win32_threads.c: Recognize new GC_WINMAIN_REDIRECT macro.
macro (only if GC_WINMAIN_REDIRECT).
* win32_threads.c: Undefine WinMain macro if GC_WINMAIN_REDIRECT.
* win32_threads.c (GC_WinMain): Add prototype (only if
* win32_threads.c (main_thread_args, WinMain): Rename
* win32_threads.c (WinMain): Call GC_INIT() instead of GC_init();
* win32_threads.c (WinMain): Call GC_deinit() and
DeleteCriticalSection() only if WinCE; add FIXME.
* os_dep.c (GC_get_main_stack_base): add assertion for mem_base
value returned by GC_get_stack_base().
Add the comment for.
* alloc.c (GC_unmap_threshold, GC_force_unmap_on_gcollect):
Declare external variable (only if USE_MUNMAP).
* alloc.c (GC_try_to_collect): Temporarily set GC_unmap_threshold
value to 1 if GC_force_unmap_on_gcollect and restore it before
unlocking (only if USE_MUNMAP).
* doc/README.environment (GC_FORCE_UNMAP_ON_GCOLLECT): Add
information for.
* include/gc.h (GC_set_force_unmap_on_gcollect,
GC_get_force_unmap_on_gcollect): New public function prototype.
* include/gc.h (GC_FORCE_UNMAP_ON_GCOLLECT): New macro is
* misc.c (GC_FORCE_UNMAP_ON_GCOLLECT): Likewise.
internal macro (used by GC_INIT only).
* misc.c (GC_force_unmap_on_gcollect): New global variable.
* misc.c (GC_init): Recognize new "GC_FORCE_UNMAP_ON_GCOLLECT"
environment variable (and set GC_force_unmap_on_gcollect).
* misc.c (GC_set_force_unmap_on_gcollect,
GC_get_force_unmap_on_gcollect): New public function.
* tests/test.c (window_proc): Call GC_set_force_unmap_on_gcollect
to force the mode on if WM_HIBERNATE; restore the mode after
* (LARGE_CONFIG): Update information.
* include/gc.h (GC_stop_func): Refine the comment.
Win32 (workaround for Wine bug).
* allchblk.c (GC_freehblk): Adjust local variables indentation.
* mallocx.c (GC_generic_malloc_many): Likewise.
* typd_mlc.c (GC_malloc_explicitly_typed_ignore_off_page,
GC_calloc_explicitly_typed): Likewise.
* typd_mlc.c (GC_make_array_descriptor): Remove unnecessary
* Process enable_parallel_mark option for Cygwin and
Win32; define THREAD_LOCAL_ALLOC for Win32.
* include/private/gc_priv.h: Define AO_ASSUME_WINDOWS98 if
PARALLEL_MARK (required for VC++ x86).
* dbg_mlc.c (GC_generate_random_backtrace): Call
GC_try_to_collect(GC_never_stop_func) instead of GC_gcollect();
if GC is disabled then print error message and return.
* include/gc.h (GC_try_to_collect): Refine the comment.
* include/private/gc_priv.h (GC_never_stop_func): Fix return type;
refine the comment.
* add_gc_prefix.c: Move the file to the new "extra" directory.
* AmigaOS.c: Likewise.
* gcname.c: Likewise.
* if_mach.c: Likewise.
* if_not_there.c: Likewise.
* MacOS.c: Likewise.
* msvc_dbg.c: Likewise.
* setjmp_t.c: Likewise.
* threadlibs.c: Likewise.
* EMX_MAKEFILE: Prepend setjmp_t.c with "extra" directory.
* Makefile: Prepend AmigaOS.c, MacOS.c, add_gc_prefix.c, gcname.c,
if_mach.c, if_not_there.c, msvc_dbg.c, setjmp_t.c, threadlibs.c
with "extra" directory.
* Likewise.
* Likewise.
* Likewise.
* Likewise.
* NT_MAKEFILE: Prepend msvc_dbg.obj with "extra" directory.
* NT_THREADS_MAKEFILE: Prepend msvc_dbg.c with "extra" directory.
* gc.mak: Likewise.
* PCR-Makefile: Prepend if_mach.c, if_not_there.c with "extra"
* SMakefile.amiga: Prepend AmigaOS.c, setjmp_t.c with "extra"
* doc/simple_example.html: Update for threadlibs.c.
* os_dep.c: Prepend included AmigaOS.c with "extra" directory.
* include/gc.h (GC_do_blocking, GC_call_with_gc_active): New
function prototype.
* include/private/gc_priv.h (STOP_WORLD): Replace a no-op (for the
single-threaded case) with an assertion check for the state to be
not a "do-blocking" one.
* include/private/gc_priv.h (blocking_data): Move the structure
definition from pthread_support.c; change "fn" return type to void
* include/private/gc_priv.h (GC_activation_frame_s): New structure
* include/private/gc_priv.h (GC_push_all_stack_frames): New
function declaration (only if THREADS).
* include/private/gc_priv.h (GC_world_stopped): Don't declare
unless THREADS.
* include/private/gc_priv.h (GC_blocked_sp,
GC_activation_frame_s): New declaration (only if not THREADS).
* include/private/gc_priv.h (GC_push_all_register_frames): New
function declaration (only for IA-64).
* include/private/gc_priv.h (NURSERY, GC_push_proc): Remove
obsolete (unused) symbols.
* include/private/gc_priv.h (GC_push_all_stack_partially_eager):
Remove declaration (since it is static now).
* mark_rts.c (GC_push_all_stack_partially_eager): Move from mark.c
(for code locality) and make STATIC.
* mark_rts.c (GC_push_all_register_frames): New function (only for
* mark_rts.c (GC_push_all_stack_frames): New function (only if
* mark_rts.c (GC_add_trace_entry): New function prototype (used by
GC_push_all_stack_partially_eager(), only if TRACE_BUF).
* mark_rts.c (GC_push_all_stack_part_eager_frames): New function.
* mar_rts.c (GC_save_regs_ret_val): Move the declaration out of a
function body (only for IA-64).
* mark_rts.c (GC_push_current_stack): Call
GC_push_all_stack_part_eager_frames() instead of
* mark_rts.c (GC_push_current_stack): Call
GC_push_all_register_frames() instead of GC_push_all_eager() for
IA-64 backing store.
* misc.c (GC_do_blocking_inner): Declare function (if THREADS
* misc.c (GC_blocked_sp, GC_blocked_register_sp,
GC_activation_frame): New global variables (only if not THREADS).
* misc.c (GC_call_with_gc_active, GC_do_blocking_inner): New API
function (only if not THREADS).
* misc.c (GC_do_blocking): Move the function from
* include/private/pthread_support.h (GC_Thread_Rep): Add
"activation_frame" field.
* pthread_stop_world.c (GC_push_all_stacks): Call
GC_push_all_stack_frames() and GC_push_all_register_frames instead
of GC_push_all_stack() and/or GC_push_all_eager(); don't check for
* pthread_support.c (GC_do_blocking_inner): Remove "static"; store
"fn" result back to "client_data" field.
* pthread_support.c (GC_call_with_gc_active): New API function.
* win32_threads.c (GC_call_with_gc_active): Likewise.
* win32_threads.c (GC_Thread_Rep): Add "thread_blocked_sp" and
"activation_frame" fields.
* win32_threads.c (GC_new_thread): Add assertion checking for
thread_blocked_sp is NULL.
* win32_threads.c (GC_do_blocking_inner): New function.
* win32_threads.c (GC_stop_world): Don't suspend a thread if its
thread_blocked_sp is non-NULL.
* win32_threads.c (GC_push_stack_for): Use thread
"activation_frame" (if non-NULL); use "thread_blocked_sp" if
non-NULL (instead of calling GetThreadContext()); "UNPROTECT" the
thread before modifying its last_stack_min; call
GC_push_all_stack_frames() instead of GC_push_all_stack(); update
the comments.
* alloc.c (GC_default_stop_func): New static variable (initialized
to GC_never_stop_func).
* alloc.c (GC_set_stop_func, GC_get_stop_func): New function.
* alloc.c (GC_timeout_stop_func): Define as GC_default_stop_func
(instead of GC_never_stop_func) if SMALL_CONFIG (or NO_CLOCK),
else call GC_default_stop_func() before getting "current_time".
* alloc.c (GC_maybe_gc): Expand GC_gcollect_inner() macro (for
FIXME comment).
* alloc.c (GC_maybe_gc, GC_collect_a_little_inner): add FIXME for
replacing GC_never_stop_func with GC_default_stop_func (if
* alloc.c (GC_gcollect): Use GC_default_stop_func.
* alloc.c (GC_collect_or_expand): Use GC_default_stop_func
(instead of GC_never_stop_func) unless it is trigged due to out of
memory; don't increment GC_fail_count and don't output warning
(before trying to collect again) in case the collection has been
interrupted (by GC_default_stop_func) and the heap expansion has
failed too.
* include/gc.h (GC_set_stop_func, GC_get_stop_func): New function
* os_dep.c (GC_get_stack_base): Add FIXME; add assertion for
GC_get_writable_length() result.
* Don't use -lpthread -ldl for Cygwin.
* NT_THREADS_MAKEFILE: Make it back equal to gc.mak.
* include/private/gcconfig.h (GWW_VDB): Undefine if
USE_GLOBAL_ALLOC (since incompatible).
* os_dep.c (GetWriteWatch_alloc_flag): Define as 0 unless GWW_VDB
is defined.
* os_dep.c (GC_unmap_threshold): Declare (for use in
GC_init_win32) if USE_MUNMAP.
* os_dep.c (GC_init_win32): Turn off memory unmapping if
GlobalAlloc() is used.
* os_dep.c (GC_win32_get_mem): Define and use new
VIRTUAL_ALLOC_PAD macro; don't waste a extra memory page unless
MPROTECT_VDB is in use.
* Makefile: Replace "version.h" with "include/gc_version.h".
* include/gc_version.h: Likewise.
* alloc.c (GC_collect_or_expand): Output heap size in WARN()
(before returning FALSE) for convenience.
* allchblk.c (GC_allochblk_nth): Use GC_PRIdPTR in WARN() format
* pthread_support.c (start_mark_threads, GC_thr_init): Likewise.
* win32_threads.c (GC_delete_thread): Likewise.
* include/private/gc_priv.h (GC_PRIdPTR): New macro.
* pthread_stop_world.c (GC_suspend_handler_inner): Remove
unnecessary cast for WARN argument.
* pthread_support.c (start_mark_threads): if pthread_create()
failed then don't try to create other marker threads and (after
printing a warning) adjust GC_markers and GC_parallel values; log
GC_markers value (possibly adjusted) after that.
* win32_threads.c (start_mark_threads): if pthread_create() is
failed then don't try to create other marker threads and (after
printing a warning) adjust GC_markers and GC_parallel values.
* win32_threads.c (mark_mutex_event, builder_cv, mark_cv): Move
the definition upper (to be visible in start_mark_threads()).
* win32_threads.c (start_mark_threads): if CreateThread() or
_beginthreadex() is failed then don't try to create other marker
threads and (after printing a warning) adjust GC_markers,
GC_parallel values, and destroy the event objects (either only
some for the uncreated threads if DONT_USE_SIGNALANDWAIT or all if
not a single thread is created).
* win32_threads.c (GC_thr_init): Log GC_markers value (possibly
adjusted) after start_mark_threads() call.
* Back remove "GC_" prefix for PTHREADS,
* include/private/gc_priv.h: Change include of config.h to
* include/private/gc_pmark.h: Likewise.
* Likewise.
* tests/test.c: Likewise.
* tests/ Include private/config.h (if HAVE_CONFIG_H);
undefine GC_BUILD.
* finalize.c (GC_general_register_disappearing_link): Return
GC_SUCCESS, GC_DUPLICATE, GC_NO_MEMORY (instead of 0, 1 and 2,
* include/gc.h (GC_NO_MEMORY): New macro (defined as 2).
* include/gc.h (GC_register_disappearing_link,
GC_general_register_disappearing_link): Update the comment.
* typd_mlc.c (GC_calloc_explicitly_typed): Use GC_NO_MEMORY macro.
* finalize.c (GC_general_register_disappearing_link,
GC_register_finalizer_inner): Recalculate the hash table index
after GC_oom_fn succeeded (since the table may grow while not
holding the lock) and check again that the entry is still not in
the table (free the unused entry otherwise unless DBG_HDRS_ALL).
* finalize.c (GC_register_finalizer_inner): Initialize "hhdr"
local variable (to prevent a compiler warning).
* finalize.c (GC_register_finalizer_inner): Don't modify the data
pointed by "ocd" and "ofn" in GC_register_finalizer_inner() failed
(due to out of memory).
* alloc.c (GC_set_fl_marks, GC_clear_fl_marks): Transform loop to
suppress compiler "variable might be uninitialized" warnings.
* (DONT_USE_SIGNALANDWAIT): Add the comment for.
* win32_threads.c (DONT_USE_SIGNALANDWAIT): Always define for
* win32_threads.c (THREAD_HANDLE): Cast Id (of DWORD type) to
HANDLE thru word type (to avoid a compiler warning) for WinCE.
* win32_threads.c (GC_marker_cv, GC_marker_Id): New static array
* win32_threads.c (start_mark_threads): Initialize GC_marker_Id
and GC_marker_cv for each helper thread (only if
* win32_threads.c (GC_mark_mutex_state): New static variable (only
* win32_threads.c (GC_mark_mutex_waitcnt,
signalObjectAndWait_func): Don't define if DONT_USE_SIGNALANDWAIT.
* win32_threads.c (GC_acquire_mark_lock, GC_release_mark_lock):
Use InterlockedExchange() over GC_mark_mutex_state (instead of
AO_fetch_and_add()) if DONT_USE_SIGNALANDWAIT.
* win32_threads.c (GC_wait_marker, GC_notify_all_marker):
Implement wait/broadcast primitives using Win32 multiple events
(one for each marker thread) if DONT_USE_SIGNALANDWAIT (instead of
using Win32 SignalObjectAndWait).
* win32_threads.c (GC_thr_init): Don't declare hK32 local
variable, don't check for GC_wnt, and don't initialize
signalObjectAndWait_func if DONT_USE_SIGNALANDWAIT.
* alloc.c (GC_finish_collection): Call GC_print_finalization_stats
if GC_print_stats (after getting "done_time").
* finalize.c (GC_old_dl_entries): New static variable (only if not
* finalize.c (GC_finalize): Save current GC_dl_entries value (only
* finalize.c (GC_print_finalization_stats): Define if and only if
not SMALL_CONFIG; use GC_old_dl_entries value; use GC_log_printf()
instead of GC_printf(); use "%lu" (instead of "%u") print format
specifier; use unsigned long type for "ready" counter (for LP64
* misc.c (GC_dump): No longer call GC_print_finalization_stats()
here (since it is called from GC_finish_collection()).
* misc.c (STACKBASE): Remove unused macro undef (for NOSYS and
* alloc.c (GC_expand_hp): Replace GC_init_inner() call with
GC_init() one.
* malloc.c (GC_alloc_large, GC_generic_malloc_inner): Likewise.
* mallocx.c (GC_generic_malloc_many): Likewise.
* misc.c (GC_enable_incremental): Likewise.
* alloc.c (GC_expand_hp): Update the comment.
* mark.c (GC_obj_kinds): Likewise.
* win32_threads.c (GC_allow_register_threads): Likewise.
* private/gc_priv.h (GC_init_inner): Remove function declaration.
* misc.c (GC_init_inner): Replace with public GC_init().
* gcj_mlc.c (GC_gcj_fake_mark_proc): New static function.
* gcj_mlc.c (GC_init_gcj_malloc): If mp is 0 then supply
GC_gcj_fake_mark_proc (aborting with the appropriate message)
* os_dep.c (GC_wince_get_mem): If VirtualAlloc() returns NULL (due
to out of memory) then don't increment GC_n_heap_bases and don't
call VirtualAlloc() again (with MEM_COMMIT).
* os_dep.c (GC_remap): Abort with a more informatory message if
VirtualAlloc() fails due to out of memory; update FIXME.
* Makefile: Fix typo for msvc_dbg.c.
* Likewise.
* Don't reference remove files (nursery.c,
gc_nursery.h, gc_copy_descr.h).
* NT_MAKEFILE: Don't define __STDC__ macro (no longer used).
* gc.mak: Likewise.
* NT_MAKEFILE: Remove unnecessary -DGC_BUILD (since it is always
defined in the source files).
* gc.mak: Likewise.
* gc.mak: Likewise.
* NT_MAKEFILE: Define _CRT_SECURE_NO_DEPRECATE to suppress the
compiler warnings.
before "$*.C" (and "$*.CPP").
* doc/README.solaris2: Replace GC_SOLARIS_THREADS with GC_THREADS.
* doc/README.win32: Replace GC_WIN32_THREADS with GC_THREADS.
* doc/README.win64: Add info about mingw-w64; add note for VC++
warnings suppression.
* os_dep.c (GC_forward_exception): Fix logic in several places.
* include/private/gc_priv.h (MAX_HEAP_SECTS): Guard with ifndef.
* Copy missing information for -DSHORT_DBG_HDRS
from Makefile.
* Makefile: Remove the information about "define arguments" (which
is incomplete and outdated compared to that in;
add help reference to
* Likewise.
* alloc.c (world_stopped_total_time, world_stopped_total_divisor):
Replace "STATIC" with "static" in the definition (since the
symbols aren't prefixed with "GC_").
* win32_threads.c (marker_sp, marker_bsp, marker_last_stack_min,
start_mark_threads, mark_mutex, builder_cv, mark_cv,
mark_mutex_event, signalObjectAndWait_func, main_thread_start):
* pthread_support.c (GC_wait_builder): Define as STATIC.
* win32_threads.c (GC_wait_builder): Likewise.
* misc.c (GC_get_heap_size_inner, GC_get_free_bytes_inner): New
API function.
* include/gc_pmark.h (GC_get_heap_size_inner,
GC_get_free_bytes_inner): New function declaration.
* include/gc.h: Recognize __CEGCC__ (as a synonym for _WIN32_WCE).
* include/gc_config_macros.h: Likewise.
* include/gc.h (GC_MAXIMUM_HEAP_SIZE): Recognize new macro.
* include/gc.h (GC_INIT_CONF_MAXIMUM_HEAP_SIZE): New macro (for
internal use).
* include/gc_config_macros.h: Always include stddef.h if GCC.
* include/gc_config_macros.h (GC_API): Define for CeGCC in the
same way as for MinGW.
* include/gc_config_macros.h (GC_API): Group the definition for
all cases together (check for GC_DLL only once).
* include/gc_pthread_redirects.h: Group non-Darwin code together.
* tests/test.c: Recognize GC_PRINT_VERBOSE_STATS (only if GC_DLL).
comment for.
* misc.c (GC_init_inner): Recognize GC_PRINT_VERBOSE_STATS (new
* dyn_load.c (GC_wnt): Change definition to TRUE for WinCE; add
FIXME and the comment for WinCE.
* gcj_mlc.c (GC_init_gcj_malloc): Recognize GC_IGNORE_GCJ_INFO
(new macro).
* include/gc.h (GC_HAVE_BUILTIN_BACKTRACE): Don't define for VC++
WinCE (since backtrace() is unimplemented).
* include/private/gc_priv.h (GC_n_heap_bases): Remove declaration
(since static).
* os_dep.c (GC_n_heap_bases): Define as STATIC; move the
definition to be above GC_is_heap_base().
* include/private/gcconfig.h: Don't define NOSYS for WinCE on ARM
(both for MinGW and CeGCC toolchains).
* include/private/gcconfig.h: Recognize __CEGCC__ and
__MINGW32CE__ (as synonyms for __WIN32_WCE).
* include/private/gcconfig.h: If SH4 then don't set config
parameters for SH.
* include/private/thread_local_alloc.h (GC_key_create): Don't
abort on failures, just return -1 in these cases (this also
prevents compilation error for targets where ABORT is defined
indirectly as an inline assembler sequence).
* mark.c (WRAP_MARK_SOME): Also define for WinCE; add FIXME for
the GCC-based cross-compiler.
* mark.c (ext_ex_regn, mark_ex_handler): Don't define unless
WRAP_MARK_SOME is defined; define also for WinCE case; don't
check for _WIN64 (since WRAP_MARK_SOME is undefined for it).
* mark.c (GC_mark_some): Use __try/__except also for WinCE; update
the comment.
* misc.c: Include signal.h after gc_pmark.h included; check for
MSWINCE instead of _WIN32_WCE.
* misc.c (GC_init_inner): Remove duplicate GC_setpagesize() call.
* misc.c: Don't include <crtdbg.h> for WinCE targets.
* misc.c (GC_write): Define _MAX_PATH if undefined (workaround for
CeGCC toolchain).
* misc.c (GC_write): Use OutputDebugStringW() instead of
_CrtDbgReport() for WinCE targets.
* os_dep.c (GC_least_described_address): Define as STATIC.
* os_dep.c (GC_register_data_segments): Fix code indentation.
* os_dep.c (GC_wince_get_mem): Initialize "result" local variable
(to prevent a compiler warning).
* os_dep.c (GC_dirty_init): Add comment for WinCE target.
* tests/test.c: Don't include winbase.h directly if GCC for WinCE,
include assert.h instead.
* tests/test.c (tiny_reverse_test): Define and use
useful for WinCE.
* win32_threads.c (GC_Thread_Rep): Don't declare "handle" field
for WinCE (since thread Id is used as a "real" thread handle).
* win32_threads.c (THREAD_HANDLE): New macro.
* win32_threads.c (GC_register_my_thread_inner): Don't recognize
DONT_IMPORT_GETCURTHREAD anymore; don't record thread handle on
* (DONT_IMPORT_GETCURTHREAD): Remove comment for.
* win32_threads.c (UNPROTECT, GC_fault_handler_lock): Don't check
* win32_threads.c (GC_delete_gc_thread, GC_delete_thread): Don't
close thread handle on WinCE (since it's a thread Id).
* win32_threads.c (GC_suspend): Don't check for MSWINCE in the
MPROTECT-related code (for the case if MPROTECT_VDB would be
implemented for WinCE).
* win32_threads.c (GC_suspend, GC_start_world, GC_push_stack_for):
Use THREAD_HANDLE(t) to obtain thread handle.
* win32_threads.c (GC_PTHREADS_PARAMARK): New macro recognized;
implicitly define GC_PTHREADS_PARAMARK if GC_PTHREADS; include
pthread.h; define NUMERIC_THREAD_ID(id) if undefined yet; replace
GC_PTHREADS with GC_PTHREADS_PARAMARK where appropriate (for the
parallel mark support).
* win32_threads.c (start_mark_threads): Use int type for "i" local
variable (instead of "unsigned") to prevent a compiler warning.
* win32_threads.c (start_mark_threads): Don't check CreateThread()
result for -1; call CloseHandle() for the handle created by
CreateThread() (on WinCE); don't use errno (since errno.h is
missing on some targets like WinCE) when printing warning on a
marker thread creation failure.
* win32_threads.c (signalObjectAndWait_func): Define for WinCE.
* win32_threads.c (GC_wait_marker): Remove unnecessary assertion
for non-zero signalObjectAndWait_func (to make the code compilable
for WinCE).
* win32_threads.c (GC_thr_init): Allow PARALLEL_MARK for WinCE;
use GC_sysinfo to get processors count if WinCE; don't check for
SignalObjectAndWait() if WinCE; replace GC_PTHREADS with
* win32_threads.c (GC_thr_init): Recognize GC_MIN_MARKERS new
macro (useful for testing parallel marking on WinCE).
* win32_threads.c (GC_win32_start, main_thread_start): Define as
* win32_threads.c: Don't define main_thread_args,
main_thread_start(), WinMain() for WinCE if GC_DLL.
* win32_threads.c (WINCE_MAIN_STACK_SIZE): Remove useless macro
(since the stack size parameter is ignored on WinCE).
* win32_threads.c (main_thread_start): Remove forward declaration;
place its definition before WinMain() one.
* win32_threads.c (WinMain): Abort if GC_CreateThread() or
WaitForSingleObject() failed (for the main thread).
* allchblk.c (MUNMAP_THRESHOLD): Move macro definition out of
a function.
* allchblk.c (GC_unmap_threshold): New global variable definition
(initialized to MUNMAP_THRESHOLD).
* allchblk.c (GC_unmap_old): Use GC_unmap_threshold instead of
MUNMAP_THRESHOLD; skip unmapping if GC_unmap_threshold is 0.
* doc/README.environment (GC_UNMAP_THRESHOLD): Add information.
* misc.c (GC_unmap_threshold): New variable declaration.
* misc.c (GC_init_inner): Recognize "GC_UNMAP_THRESHOLD"
environment variable to set GC_unmap_threshold value (only if
* dbg_mlc.c (OFN_UNSET): New macro (to detect
GC_register_finalizer() failures).
* dbg_mlc.c (store_old): Add a check for register_finalizer()
failure caused by an out-of-memory event (leave *ofn and *ocd
unmodified in that case).
* dbg_mlc.c (GC_debug_register_finalizer,
GC_debug_register_finalizer_ignore_self): Initialize my_old_fn
to OFN_UNSET; clear *ocd and *ofn for non-heap objects (the same
as in GC_register_finalizer_inner()).
* (GC_DLL): Add the comment for.
* doc/README.macros: Fix a typo.
* doc/README.macros (_DLL, GC_DLL, GC_NOT_DLL): Update info.
* doc/README.macros (__STDC__): Remove info.
* dbg_mlc.c (GC_get_back_ptr_info, GC_generate_random_heap_address,
GC_generate_random_valid_address, GC_print_backtrace,
GC_generate_random_backtrace, GC_register_describe_type_fn): Add
GC_API and GC_CALL to function definition.
* malloc.c (GC_generic_malloc): Likewise.
* mallocx.c (GC_incr_bytes_allocd, GC_incr_bytes_freed): Likewise.
* mark.c (GC_mark_and_push): Likewise.
* misc.c (GC_new_free_list_inner, GC_new_free_list,
GC_new_kind_inner, GC_new_kind, GC_new_proc_inner, GC_new_proc):
* include/gc_backptr.h (GC_get_back_ptr_info,
GC_generate_random_heap_address, GC_generate_random_valid_address,
GC_generate_random_backtrace, GC_print_backtrace): Add GC_API and
GC_CALL to function prototype.
* include/gc_mark.h (GC_mark_and_push, GC_new_free_list,
GC_new_free_list_inner, GC_new_kind, GC_new_kind_inner,
GC_new_proc, GC_new_proc_inner, GC_generic_malloc,
GC_register_describe_type_fn): Likewise.
* include/new_gc_alloc.h (GC_incr_bytes_allocd, GC_incr_mem_freed,
GC_generic_malloc_words_small): Likewise.
* Include "config.h" (if HAVE_CONFIG_H defined).
* include/private/gc_pmark.h: Likewise.
* include/private/gc_priv.h: Likewise.
* tests/test.c: Likewise.
* Define GC_BUILD.
* include/private/gc_pmark.h: Likewise.
* include/private/gc_priv.h: Likewise.
* gc_dlopen.c (WRAP_FUNC, REAL_FUNC): New macro.
* gc_dlopen.c (dlopen): Add GC_API to the wrapper function
* pthread_support.c (GC_pthread_create, GC_pthread_sigmask,
GC_pthread_join, GC_pthread_detach, pthread_sigmask, pthread_join,
pthread_detach, pthread_create): Likewise.
* win32_threads.c (GC_pthread_join, GC_pthread_create,
GC_pthread_sigmask, GC_pthread_detach): Likewise.
* gc_dlopen.c (dlopen): Use WRAP_FUNC and REAL_FUNC macros.
* include/gc_backptr.h: Include "gc.h".
* include/gc_backptr.h: Use extern "C" for the exported functions.
* include/gc_mark.h: Likewise.
* include/gc_config_macros.h (GC_THREADS): Define the macro if any
GC_XXX_THREADS is defined.
* include/gc_config_macros.h (_PTHREADS, _POSIX4A_DRAFT10_SOURCE):
Move the definitions below the place where GC_NETBSD_THREADS and
GC_DGUX386_THREADS are defined.
* include/gc_config_macros.h (GC_DLL): Don't define (even if _DLL
is defined) for GCC.
* include/gc_config_macros.h (GC_API): Define for Cygwin (in the
same way as for VC++); define for GCC v4+ (other than already
recognized MinGW/Cygwin) as a "default" visibility attribute if
GC_DLL is defined.
* include/gc_config_macros.h (GC_ATTR_MALLOC, GC_ATTR_ALLOC_SIZE):
New macro.
* include/gc.h (GC_malloc, GC_malloc_atomic, GC_strdup,
GC_malloc_uncollectable, GC_malloc_stubborn, GC_memalign,
GC_malloc_atomic_uncollectable, GC_malloc_ignore_off_page,
GC_malloc_atomic_ignore_off_page, GC_debug_malloc,
GC_debug_malloc_atomic, GC_debug_strdup,
GC_debug_malloc_uncollectable, GC_debug_malloc_stubborn,
GC_debug_malloc_replacement): Add GC_ATTR_MALLOC attribute.
* include/gc_gcj.h (GC_gcj_malloc, GC_debug_gcj_malloc,
GC_gcj_malloc_ignore_off_page): Likewise.
* include/gc.h (GC_malloc, GC_malloc_atomic,
GC_malloc_uncollectable, GC_malloc_stubborn,
GC_malloc_atomic_uncollectable, GC_malloc_ignore_off_page,
GC_malloc_atomic_ignore_off_page, GC_debug_malloc,
GC_debug_malloc_atomic, GC_debug_malloc_uncollectable,
GC_debug_malloc_stubborn, GC_debug_malloc_ignore_off_page,
GC_debug_malloc_replacement: Add GC_ATTR_ALLOC_SIZE attribute
(for the first argument).
* include/gc_gcj.h (GC_gcj_malloc, GC_debug_gcj_malloc,
GC_gcj_malloc_ignore_off_page): Likewise.
* include/gc.h (GC_memalign, GC_realloc, GC_debug_realloc,
GC_debug_realloc_replacement): Add GC_ATTR_ALLOC_SIZE attribute
(for the second argument).
* include/gc.h (GC_malloc, GC_malloc_atomic, GC_strdup,
GC_malloc_uncollectable, GC_malloc_stubborn, GC_memalign,
GC_malloc_atomic_uncollectable, GC_free, GC_base, GC_size,
GC_realloc, GC_expand_hp, GC_set_max_heap_size,
GC_exclude_static_roots, GC_add_roots, GC_remove_roots,
GC_register_displacement, GC_debug_register_displacement,
GC_try_to_collect, GC_malloc_ignore_off_page,
GC_malloc_atomic_ignore_off_page, GC_debug_malloc,
GC_debug_malloc_atomic, GC_debug_strdup,
GC_debug_malloc_uncollectable, GC_debug_malloc_stubborn,
GC_debug_malloc_atomic_ignore_off_page, GC_debug_free,
GC_debug_realloc, GC_debug_malloc_replacement,
GC_debug_realloc_replacement, GC_finalization_proc,
GC_register_finalizer, GC_debug_register_finalizer,
GC_unregister_disappearing_link, GC_noop1, GC_warn_proc,
GC_set_warn_proc, GC_ignore_warn_proc, GC_fn_type,
GC_call_with_alloc_lock, GC_stack_base_func,
GC_call_with_stack_base, GC_same_obj, GC_pre_incr, GC_post_incr,
GC_is_visible, GC_is_valid_displacement, GC_same_obj_print_proc,
GC_is_valid_displacement_print_proc, GC_is_visible_print_proc,
GC_malloc_many, GC_CreateThread, GC_beginthreadex,
GC_endthreadex): Comment out (or remove if single and meaningless)
function argument names (to avoid identifiers out of the name
* include/gc_gcj.h (GC_init_gcj_malloc, GC_gcj_malloc,
GC_debug_gcj_malloc, GC_gcj_malloc_ignore_off_page): Likewise.
* include/gc.h (GC_try_to_collect): Update the comment.
* include/gc.h (GC_size, GC_register_my_thread): Add const
qualifier for the argument referent.
* misc.c (GC_size): Likewise.
* pthread_support.c (GC_register_my_thread_inner,
GC_register_my_thread): Likewise.
* win32_threads.c (GC_register_my_thread_inner,
GC_register_my_thread): Likewise.
* include/gc.h (GC_INIT_CONF_ROOTS): New macro for internal use
(define instead of GC_INIT() for Cygwin and AIX).
GC_INITIAL_HEAP_SIZE): Recognize new macro.
GC_INIT_CONF_INITIAL_HEAP_SIZE): New macro for internal use.
* include/gc.h (GC_INIT): Use GC_INIT_CONF_XXX macros.
* include/gc_mark.h: Prefix GC_H with '_'.
* include/gc_mark.h (GC_least_plausible_heap_addr,
GC_greatest_plausible_heap_addr, GC_debug_header_size): Use GC_API
for the public variable declaration.
* include/new_gc_alloc.h (GC_objfreelist_ptr, GC_aobjfreelist_ptr,
GC_uobjfreelist_ptr, GC_auobjfreelist_ptr): Likewise.
* include/gc_pthread_redirects.h (GC_pthread_create,
GC_pthread_sigmask, GC_dlopen, GC_pthread_join, GC_pthread_detach):
Use GC_API for the wrapper prototype.
* include/gc_pthread_redirects.h (pthread_create, pthread_join,
pthread_detach, pthread_sigmask, dlopen): Undefine unconditionally
before redirecting.
* include/new_gc_alloc.h: Replace GC_incr_mem_freed() with
GC_incr_bytes_freed(); remove FIXME.
* include/private/gc_priv.h (GC_make_closure,
GC_debug_invoke_finalizer, GC_noop): Remove GC_API for the private
* tests/test.c (GC_print_stats): Handle GC_DLL case regardless of
the target.
* finalize.c (GC_general_register_disappearing_link,
GC_register_finalizer_inner): Remove unnecessary "ifdef THREADS"
guard for LOCK/UNLOCK().
* finalize.c (GC_general_register_disappearing_link,
GC_register_finalizer_inner): Get GC_oom_fn value before releasing
the lock (to prevent data races).
* gcj_mlc.c (GC_gcj_malloc, GC_debug_gcj_malloc,
GC_gcj_malloc_ignore_off_page): Likewise.
* mallocx.c (GC_generic_malloc_ignore_off_page): Likewise.
* include/gc_inline.h (GC_FAST_MALLOC_GRANS): Use GC_get_oom_fn()
instead of GC_oom_fn (to prevent data races).
* malloc.c (GC_generic_malloc): Likewise.
* mallocx.c (GC_memalign): Likewise.
* pthread_support.c (pthread_create): Likewise.
* gcj_mlc.c (maybe_finalize): Acquire the lock before setting
last_finalized_no value to prevent data races.
* include/gc.h (GC_gc_no, GC_get_gc_no, GC_oom_fn, GC_set_oom_fn,
GC_set_find_leak, GC_set_finalize_on_demand,
GC_set_java_finalization, GC_set_finalizer_notifier,
GC_set_dont_expand, GC_set_full_freq, GC_set_non_gc_bytes,
GC_set_no_dls, GC_set_free_space_divisor, GC_set_max_retries,
GC_set_dont_precollect, GC_set_time_limit, GC_warn_proc): Refine
the comment.
* misc.c (GC_set_oom_fn): Likewise.
* include/gc.h (GC_general_register_disappearing_link): Refine the
comment (replace "soft" word with "weak").
* misc.c (GC_oom_fn, GC_get_gc_no, GC_get_parallel,
GC_set_finalizer_notifier, GC_set_find_leak): Add the comment.
* misc.c (GC_set_oom_fn, GC_get_oom_fn, GC_set_finalizer_notifier,
GC_get_finalizer_notifier): Use LOCK/UNLOCK to prevent data races.
* dbg_mlc.c: Guard include <errno.h> with ifndef MSWINCE; include
"private/dbg_mlc.h" before it.
* malloc.c: Likewise.
* dbg_mlc.c (GC_debug_strdup): Use memcpy() instead of strcpy()
for WinCE (since deprecated); evaluate strlen() only once; don't
set errno for WinCE.
* malloc.c (GC_strdup): Likewise.
* dyn_load.c (GC_wnt): Define as macro (FALSE) for WinCE.
* include/gc.h (GC_unregister_my_thread): Refine the comment.
* include/gc.h (GC_uintptr_t, GC_beginthreadex, GC_endthreadex):
Don't declare for WinCE.
* include/gc.h (GC_WINMAIN_WINCE_LPTSTR): New macro (WinCE only).
* include/gc.h (GC_WinMain): Remove GC_API.
* include/gc.h (GC_WinMain): Use GC_WINMAIN_WINCE_LPTSTR for
* tests/test.c (GC_WinMain): Likewise.
* win32_threads.c (main_thread_args, GC_WinMain): Likewise.
* include/gc_config_macros.h (ptrdiff_t): Guard with
* include/private/gc_locks.h: Guard include "atomic_ops.h" with
ifdef GC_PTHREADS (and not GC_WIN32_THREADS).
* mark.c: Include "atomic_ops.h" if PARALLEL_MARK.
* thread_local_alloc.c: Include "atomic_ops.h" if GC_GCJ_SUPPORT.
* win32_threads.c: Include "atomic_ops.h" if MPROTECT_VDB.
* include/private/gc_locks.h: Use include "atomic_ops.h" instead
of include <atomic_ops.h>.
* include/private/gc_priv.h: Likewise.
* include/private/gc_locks.h (GC_allocate_ml, GC_need_to_lock):
Don't export (replace GC_API to "extern").
* win32_threads.c (GC_allocate_ml): Don't export.
* include/private/gc_priv.h (DebugBreak): Define as macro for
WinCE (if not UNDER_CE and DebugBreak is not defined yet).
* include/private/gc_priv.h (UNALIGNED): Rename to UNALIGNED_PTRS
(since "UNALIGNED" is defined in winnt.h of WinCE).
* mark.c (UNALIGNED): Likewise.
* include/private/gcconfig.h (ARM32): Recognize _M_ARM and _ARM_.
* include/private/gcconfig.h (ALIGNMENT): Check always defined.
* include/private/gcconfig.h: Allow GC_WIN32_THREADS for WinCE.
* include/private/thread_local_alloc.h: Define USE_WIN32_SPECIFIC
for WinCE (since __declspec(thread) is unsupported).
* include/private/thread_local_alloc.h (TLS_OUT_OF_INDEXES):
Define for WinCE (if undefined).
* malloc.c (GC_malloc): Remove outdated comment about disabling
* misc.c: Don't include <tchar.h> (since not used anymore and may
break TEXT() macro defined in winnt.h).
* misc.c (GC_init_inner): Don't use GetModuleHandle() and
InitializeCriticalSectionAndSpinCount() for WinCE.
* misc.c (GC_init_inner): Replace GetModuleHandleA() with
GetModuleHandle() (and use TEXT() macro controlled by UNICODE).
* misc.c (LOG_FILE): Remove unused macro; don't use _T() macro.
* misc.c (GC_CreateLogFile): New static function (Win32/WinCE
only); move the code from GC_write(); replace GETENV() with
GetEnvironmentVariable(); replace CreateFileA() with
CreateFile(); use TEXT() macro (for Unicode support); replace
strcat() with memcpy() (since deprecated in WinCE).
* misc.c (GC_write): Define as STATIC.
* win32_threads.c (GC_attached_thread): Likewise.
* misc.c (GC_write): Use GC_CreateLogFile().
* misc.c: Define vsnprintf macro as StringCchVPrintfA for WinCE.
* misc.c (GC_abort): Try to invoke MessageBoxA() dynamically
(Win32 only) if DONT_USE_USER32_DLL is defined.
* misc.c (GC_abort): Duplicate msg to GC log file (for Win32 and
* misc.c (GC_abort): Use a more user-friendly abort if
NO_DEBUGGING (Win32 only).
* os_dep.c: Include "atomic_ops.h" only if MPROTECT_VDB (and
* os_dep.c (detect_GetWriteWatch): Use TEXT() for GetModuleHandle
(for Unicode support); check GetModuleHandle() result.
* tests/test.c: Don't define assert for WinCE (since may be
redefined by "assert.h" included from libatomic_ops).
* tests/test.c (FAIL): Define as ABORT for all targets (except
for PCR).
* tests/test.c (n_tests): Don't use AO_t.
* tests/test.c (check_heap_stats): Don't cast n_tests.
* tests/test.c (inc_int_counter): New function (for n_tests atomic
* tests/test.c (run_one_test): Test GC_memalign() for all targets.
* tests/test.c (run_one_test): Avoid unbalanced brackets in
#if-#else-#endif blocks.
* tests/test.c (run_one_test): Replace AO_fetch_and_add1() and
private LOCK/UNLOCK with GC_call_with_alloc_lock(inc_int_counter).
* tests/test.c (check_heap_stats): Replace
"if (sizeof(char *) > 4)" with "#if CPP_WORDSZ == 64" to suppress
"unreachable code" compiler warning.
* tests/test.c (WinMain): Set cmd type to LPWSTR (for WinCE
"UNDER_CE" mode); else use LPSTR type (for Win32 and WinCE).
* tests/test.c (thr_window): Replace "L" string prefix with
* thread_local_alloc.c: Check THREADS is defined (to prevent other
compiler errors and warnings otherwise).
* tests/test.c (WinMain): Recognize GC_NO_DLLMAIN macro (for
the comments for.
* win32_threads.c (GC_register_my_thread_inner): Recognize