ivmai [Sat, 12 Feb 2011 15:06:57 +0000 (15:06 +0000)]
2011-02-10 Ivan Maidanski <ivmai@mail.ru>
* dyn_load.c (GC_register_map_entries,
GC_register_dynamic_libraries_dl_iterate_phdr): Calculate
DATASTART only once if DATASTART_IS_FUNC.
* 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
NO_DYLD_BIND_FULLY_IMAGE defined; add FIXME.
* 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
unistd.h.
ivmai [Sat, 12 Feb 2011 15:04:24 +0000 (15:04 +0000)]
2011-02-10 Ivan Maidanski <ivmai@mail.ru>
* 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
multi-threaded.
* os_dep.c (GC_page_was_dirty): Reformat the code.
* os_dep.c: Reformat some comments.
* 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.
ivmai [Sat, 12 Feb 2011 15:02:35 +0000 (15:02 +0000)]
2011-02-10 Ivan Maidanski <ivmai@mail.ru>
* NT_MAKEFILE: Define _CRT_SECURE_NO_DEPRECATE for C++ files as
well.
* NT_STATIC_THREADS_MAKEFILE: Ditto.
* doc/README.macros (USE_GET_STACKBASE_FOR_MAIN): Refine.
* 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).
ivmai [Mon, 24 Jan 2011 21:43:30 +0000 (21:43 +0000)]
2011-01-22 Ivan Maidanski <ivmai@mail.ru> (mostly Jean-Claude Beaudoin)
* 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).
ivmai [Mon, 17 Jan 2011 20:34:11 +0000 (20:34 +0000)]
2011-01-17 Ivan Maidanski <ivmai@mail.ru>
* 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
macro.
* 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): Ditto.
ivmai [Fri, 7 Jan 2011 09:51:40 +0000 (09:51 +0000)]
2011-01-07 Ivan Maidanski <ivmai@mail.ru>
* .cvsignore: Add more auto-generated files.
* include/private/.cvsignore: Ditto.
* darwin_stop_world.c (GC_mach_handler_thread,
GC_use_mach_handler_thread,
GC_darwin_register_mach_handler_thread): Define only if
MPROTECT_VDB.
* darwin_stop_world.c (GC_suspend_thread_list): Use
GC_mach_handler_thread and GC_use_mach_handler_thread only if
MPROTECT_VDB.
* 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 (GC_mprotect_state_t): Reformat the code.
* os_dep.c (DARWIN_EXC_STATE, DARWIN_EXC_STATE_COUNT,
DARWIN_EXC_STATE_T, DARWIN_EXC_STATE_DAR): New macros.
* os_dep.c (catch_exception_raise): Use DARWIN_EXC_STATE,
DARWIN_EXC_STATE_COUNT, DARWIN_EXC_STATE_T, DARWIN_EXC_STATE_DAR;
reformat the comment.
* pthread_support.c (GC_thr_init): Define "dummy" local variable
only unless GC_DARWIN_THREADS; reformat the code.
* 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
Cygwin.
* include/private/gcconfig.h (STACKBOTTOM): Use fixed address for
Darwin/arm (instead of HEURISTIC1).
* include/private/gcconfig.h (GET_MEM): Reformat the code.
ivmai [Sun, 26 Dec 2010 14:20:38 +0000 (14:20 +0000)]
2010-12-26 Ivan Maidanski <ivmai@mail.ru> (mostly really Geoff Norton
and Jonathan Pryor)
* configure.ac: 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).
* configure: Regenerate.
ivmai [Thu, 2 Dec 2010 07:44:04 +0000 (07:44 +0000)]
2010-12-02 Ivan Maidanski <ivmai@mail.ru>
* allchblk.c (GC_freehblk): Print extended error message (done via
GC_printf() before aborting with a short message) only if
GC_print_stats.
* dyn_load.c (GC_register_dynamic_libraries): Ditto.
* os_dep.c (GC_get_maps, GC_register_data_segments, GC_remap,
PROTECT, GC_write_fault_handler, GC_mprotect_thread): Ditto.
* pthread_stop_world.c (GC_start_world): Ditto.
* win32_threads.c (GC_register_my_thread_inner): Ditto.
* 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
type).
* 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 adjucent GC_err_printf
calls.
ivmai [Thu, 25 Nov 2010 21:38:04 +0000 (21:38 +0000)]
2010-11-25 Ivan Maidanski <ivmai@mail.ru>
* 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.
ivmai [Fri, 22 Oct 2010 05:47:47 +0000 (05:47 +0000)]
2010-10-22 Ivan Maidanski <ivmai@mail.ru>
* CMakeLists.txt: Check enable_parallel_mark on Darwin.
* configure.ac: Ditto.
* darwin_stop_world.c (DARWIN_SUSPEND_GC_THREADS,
DARWIN_QUERY_TASK_THREADS): Rename to GC_NO_THREADS_DISCOVERY and
GC_DISCOVER_TASK_THREADS, respectively.
* os_dep.c (DARWIN_SUSPEND_GC_THREADS): Ditto.
* pthread_support.c (DARWIN_SUSPEND_GC_THREADS): Ditto.
* 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
GC_NO_THREADS_DISCOVERY.
* tests/test.c (GC_NO_DLLMAIN): Ditto.
* doc/README.macros (GC_NO_DLLMAIN): Ditto.
* doc/README.win32 (GC_NO_DLLMAIN): Ditto.
* doc/README.macros (GC_NO_THREADS_DISCOVERY): Update the comment.
* win32_threads.c (GC_win32_dll_threads): Define as macro to true
if GC_DISCOVER_TASK_THREADS (and not GC_NO_THREADS_DISCOVERY);
update the comment.
* win32_threads.c (GC_use_DllMain): Rename to
GC_use_threads_discovery; do not set GC_win32_dll_threads if
GC_DISCOVER_TASK_THREADS.
* 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
GC_win32_dll_threads.
* win32_threads.c (GC_register_my_thread_inner): Reformat the
comment.
* 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).
* configure: Regenerate.
ivmai [Sat, 16 Oct 2010 08:44:59 +0000 (08:44 +0000)]
2010-10-16 Ivan Maidanski <ivmai@mail.ru>
* 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
or DARWIN_QUERY_TASK_THREADS; remove FIXME.
* 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_SUSPEND_GC_THREADS.
* darwin_stop_world.c (GC_stop_world, GC_start_world): Exclude
the code for GC_query_task_threads case from compilation unless
DARWIN_SUSPEND_GC_THREADS.
* 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
DARWIN_SUSPEND_GC_THREADS.
* pthread_support.c (marker_mach_threads): Don't define if
DARWIN_SUSPEND_GC_THREADS.
* 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
THREADS case.
ivmai [Fri, 15 Oct 2010 20:14:15 +0000 (20:14 +0000)]
2010-10-15 Ivan Maidanski <ivmai@mail.ru>
* 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()
only if not DARWIN_DONT_PARSE_STACK.
* 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.
ivmai [Fri, 15 Oct 2010 04:12:42 +0000 (04:12 +0000)]
2010-10-14 Ivan Maidanski <ivmai@mail.ru>
* 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
kern_result.
* 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): Ditto.
ivmai [Sat, 9 Oct 2010 06:05:29 +0000 (06:05 +0000)]
2010-10-09 Ivan Maidanski <ivmai@mail.ru>
* darwin_stop_world.c (GC_mach_thread): Move from
darwin_stop_world.h.
* 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.
ivmai [Fri, 8 Oct 2010 19:56:26 +0000 (19:56 +0000)]
2010-10-08 Ivan Maidanski <ivmai@mail.ru>
* 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.
ivmai [Wed, 6 Oct 2010 20:09:27 +0000 (20:09 +0000)]
2010-10-06 Ivan Maidanski <ivmai@mail.ru>
* 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): Ditto.
* 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).
ivmai [Tue, 5 Oct 2010 07:07:06 +0000 (07:07 +0000)]
2010-10-05 Ivan Maidanski <ivmai@mail.ru>
* 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): Ditto.
* win32_threads.c (GC_check_finalizer_nested): Ditto.
* 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): Ditto.
* 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
macro).
* 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
GC_bool.
* darwin_stop_world.c (GC_MAX_MACH_THREADS): New macro.
* darwin_stop_world.c (GC_mach_threads, GC_stop_init): Use
GC_MAX_MACH_THREADS instead of THREAD_TABLE_SZ.
* 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
PARALLEL_MARK).
* 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
DEBUG_THREADS or GC_ASSERTIONS.
* pthread_support.c (marker_mach_threads): New static variable (if
Darwin).
* 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): Ditto.
* 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
GC_THREADS.
* include/gc.h (GC_get_heap_size): Fix a typo in a comment.
2010-09-11 Ivan Maidanski <ivmai@mail.ru> (really Ludovic Courtes)
* configure.ac: 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.
* configure.ac: Expand all tabs to spaces.
* configure: Regenerate.
* include/private/config.h.in: Ditto.
* dyn_load.c (DL_ITERATE_PHDR_STRONG): New macro (define for
FreeBSD).
* 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
case).
2010-09-09 Ivan Maidanski <ivmai@mail.ru> (with input from Ludovic Courtes)
* 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).
* include/private/specific.h: Expand all tabs to spaces; remove
trailing spaces at EOLn.
* darwin_stop_world.c (FindTopOfStack): Simplify condition
expressions.
* 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).
ivmai [Sat, 14 Aug 2010 13:59:21 +0000 (13:59 +0000)]
2010-08-14 Ivan Maidanski <ivmai@mail.ru>
* 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).
* os_dep.c (PROTECT, UNPROTECT): Set VM_PROT_EXEC if
pages_executable is on (Darwin case).
* pthread_support.c (GC_init_real_syms): Abort with an informative
message if libgc is linked after libpthread.
ivmai [Sat, 14 Aug 2010 08:06:17 +0000 (08:06 +0000)]
2010-08-14 Ivan Maidanski <ivmai@mail.ru> (with help from Hans Boehm)
* 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
GC_PTHREAD_EXIT_ATTRIBUTE).
* include/gc_pthread_redirects.h (pthread_cancel, pthread_exit):
Redirect (if GC_PTHREAD_EXIT_ATTRIBUTE).
* 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
GC_PTHREAD_EXIT_ATTRIBUTE).
* 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): Initialise pointers to
the "real" pthread_cancel and pthread_exit (only if
GC_PTHREAD_EXIT_ATTRIBUTE).
* pthread_support.c (GC_unregister_my_thread): Enable collections
if DISABLED_GC was set (only if GC_PTHREAD_EXIT_ATTRIBUTE).
* 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): Ditto.
* doc/README.linux: Expand all tabs to spaces; remove trailing
spaces at EOLn.
2010-07-29 Ivan Maidanski <ivmai@mail.ru> (with input from NIIBE Yutaka)
* pthread_start.c: New file.
* CMakeLists.txt (SRC): Add pthread_start.c.
* Makefile.am (libgc_la_SOURCES): Ditto.
* Makefile.direct (CSRCS): Ditto.
* Makefile.direct (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
GC_INNER.
* pthread_support.c (GC_inner_start_routine): Move to the
definition to pthread_start.c; leave only the prototype; remove
STATIC.
* pthread_support.c (GC_start_rtn_prepare_thread): New function
(contains parts of the original GC_inner_start_routine).
* Makefile.in: Regenerate.
* configure: Ditto.
2010-07-28 Ivan Maidanski <ivmai@mail.ru> (mostly really Noah Lavine)
* configure.ac (NO_EXECUTE_PERMISSION): Add comment.
* doc/README.macros (NO_EXECUTE_PERMISSION): Update the
documentation.
* include/gc.h (GC_set_pages_executable, GC_get_pages_executable):
New API function declaration.
* include/gc.h (GC_ignore_warn_proc): Reformat the comment.
* os_dep.c (OPT_PROT_EXEC): Remove (superseded by
pages_executable).
* 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,
GC_wince_get_mem, UNPROTECT): Undefine IGNORE_PAGES_EXECUTABLE.
* 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.
ivmai [Fri, 21 May 2010 20:08:57 +0000 (20:08 +0000)]
2010-05-21 Ivan Maidanski <ivmai@mail.ru> (really Bradley Smith and
Stefano Rivera)
* 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.
ivmai [Thu, 13 May 2010 05:10:43 +0000 (05:10 +0000)]
2010-05-13 Ivan Maidanski <ivmai@mail.ru> (mostly really Uros Bizjak)
* 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): Ditto.
* 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): Ditto.
ivmai [Wed, 5 May 2010 06:32:21 +0000 (06:32 +0000)]
2010-05-05 Ivan Maidanski <ivmai@mail.ru>
* 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).
2010-04-16 Ivan Maidanski <ivmai@mail.ru> (mostly really Louis Zhuang)
* 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().
2010-04-16 Ivan Maidanski <ivmai@mail.ru> (mostly really NIIBE Yutaka)
* 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):
Ditto (matters only if GC_PTHREADS defined).
ivmai [Fri, 26 Mar 2010 07:22:57 +0000 (07:22 +0000)]
2010-03-26 Ivan Maidanski <ivmai@mail.ru> (really Hans Boehm)
* 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.
ivmai [Fri, 19 Mar 2010 19:21:02 +0000 (19:21 +0000)]
2010-03-19 Ivan Maidanski <ivmai@mail.ru> (really Dave Korn)
* 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
likewise.
* 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
likewise.
* include/private/gc_priv.h (GC_sysinfo): Do declare extern
likewise.
* include/private/gcconfig.h (GC_win32_get_mem, GET_MEM): Do
prototype on Cygwin as other win32 platforms.
ivmai [Sat, 13 Mar 2010 07:57:52 +0000 (07:57 +0000)]
2010-03-13 Ivan Maidanski <ivmai@mail.ru>
* 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.
ivmai [Fri, 12 Mar 2010 20:43:11 +0000 (20:43 +0000)]
2010-03-12 Ivan Maidanski <ivmai@mail.ru>
* alloc.c (GC_start_call_back): Replace the definition type to
GC_start_callback_proc.
* 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
GC).
* 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.
ivmai [Fri, 12 Mar 2010 13:20:22 +0000 (13:20 +0000)]
2010-03-12 Ivan Maidanski <ivmai@mail.ru>
* doc/README.macros (USE_GET_STACKBASE_FOR_MAIN): Document.
* os_dep.c (GC_get_main_stack_base): Recognize
USE_GET_STACKBASE_FOR_MAIN (only if THREADS and LINUX_STACKBOTTOM)
and use GC_get_stack_base() in this case.
ivmai [Fri, 5 Mar 2010 14:46:08 +0000 (14:46 +0000)]
2010-03-05 Ivan Maidanski <ivmai@mail.ru> (really Burkhard Linke)
* 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.
ivmai [Mon, 15 Feb 2010 09:10:29 +0000 (09:10 +0000)]
2010-02-15 Ivan Maidanski <ivmai@mail.ru> (really Alexandr Shadchin)
* pthread_support.c: Include <sys/param.h> and <sys/sysctl.h> for
OpenBSD.
* pthread_support.c (get_ncpu): Define also for Darwin, NetBSD and
OpenBSD.
* pthread_support.c (GC_thr_init): Use get_ncpu() for Darwin,
NetBSD and OpenBSD.
ivmai [Fri, 15 Jan 2010 07:23:05 +0000 (07:23 +0000)]
2010-01-15 Ivan Maidanski <ivmai@mail.ru>
* 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.
ivmai [Fri, 18 Dec 2009 13:15:52 +0000 (13:15 +0000)]
2009-12-18 Ivan Maidanski <ivmai@mail.ru>
* 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).
ivmai [Fri, 18 Dec 2009 12:09:55 +0000 (12:09 +0000)]
2009-12-18 Ivan Maidanski <ivmai@mail.ru> (with input from
Jean-Claude Beaudoin)
* include/gc.h (GC_unregister_my_thread): Fix a typo; update the
comment.
* 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): Ditto.
* 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
DETACHED (only if GC_PTHREADS).
* win32_threads.c (GC_unregister_my_thread): Add FIXME (for
GC_wait_for_gc_completion).
* win32_threads.c (GC_pthread_start_inner): Clear flags detached
state if needed; set pthread_id and flags while holding the lock.
hboehm [Fri, 11 Dec 2009 00:02:43 +0000 (00:02 +0000)]
2009-12-10 Hans-J. Boehm <Hans.Boehm@hp.com>
* 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.
ivmai [Tue, 8 Dec 2009 19:45:29 +0000 (19:45 +0000)]
2009-12-08 Ivan Maidanski <ivmai@mail.ru>
* 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
GC_call_with_gc_active).
ivmai [Tue, 8 Dec 2009 17:08:14 +0000 (17:08 +0000)]
2009-12-08 Ivan Maidanski <ivmai@mail.ru> (with input from Marcos Dione)
* doc/README.macros (IGNORE_DYNAMIC_LOADING, PLATFORM_ANDROID):
Document.
* dyn_load.c: Don't include <elf.h> if PLATFORM_ANDROID.
* dyn_load.c: Include bionic <linker.h> (instead of <link.h>) if
PLATFORM_ANDROID.
* 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
PLATFORM_ANDROID.
* include/private/gcconfig.h (IF_CANCEL): Fix definition for the
explicitly defined CANCEL_SAFE.
ivmai [Mon, 7 Dec 2009 17:12:40 +0000 (17:12 +0000)]
2009-12-07 Ivan Maidanski <ivmai@mail.ru>
* 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
if GC_READ_ENV_FILE).
* misc.c (GC_init): Call GC_envfile_init() (before using GETENV)
if GC_READ_ENV_FILE.
* 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): Ditto.
* os_dep.c (GC_get_main_stack_base, GC_register_data_segments):
Ditto.
* pthread_stop_world.c (GC_push_all_stacks): Ditto.
* pthread_support.c (GC_init_real_syms, start_mark_threads):
Ditto.
ivmai [Sun, 6 Dec 2009 09:08:11 +0000 (09:08 +0000)]
2009-12-06 Ivan Maidanski <ivmai@mail.ru>
* 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).