Ivan Maidanski [Sun, 11 Sep 2011 14:53:50 +0000 (18:53 +0400)]
Do not define internal GC_parse_map_entry() unless used.
* include/private/gc_priv.h (GC_parse_map_entry): Declare only if
DYNAMIC_LOADING.
* os_dep.c (GC_parse_map_entry): Define only if DYNAMIC_LOADING or
REDIRECT_MALLOC, or IA64, or INCLUDE_LINUX_THREAD_DESCR.
Ivan Maidanski [Thu, 8 Sep 2011 10:17:26 +0000 (14:17 +0400)]
Resolve "comparison of signed and unsigned values" compiler warnings.
* cord/cordprnt.c (CORD_vsprintf): Cast "prec" and "width" local
variables to size_t.
* dyn_load.c (GC_register_dynamic_libraries_dl_iterate_phdr): Change
type of "i" local variable to int.
* pthread_support.c (start_mark_threads): Likewise.
* os_dep.c (GC_repeat_read): Change type of "num_read" to size_t.
* os_dep.c (GC_get_maps): Change type of "result" local variable from
int to ssize_t; cast "result" to size_t in comparison.
* pthread_support.c (GC_remove_all_threads_but_me): Cast "result" to
int.
* pthread_support.c (GC_wait_for_gc_completion): Change type of
"old_gc_no" local variable to word.
* pthread_support.c (GC_lock): Change type of "i" local variable to
unsigned.
* tests/staticrootstest.c (main): Cast sizeof() value to int in
comparisons.
Ivan Maidanski [Wed, 7 Sep 2011 14:00:38 +0000 (18:00 +0400)]
HOTFIX: Always reset fault handler in GC_find_limit_with_bound on exit.
* os_dep.c (GC_find_limit_with_bound): Inside loop, set result local
volatile variable and do break instead of return (this also suppresses
compiler warning about the potential clobbering of "bound" variable
by setjmp).
Ivan Maidanski [Wed, 7 Sep 2011 13:35:22 +0000 (17:35 +0400)]
HOTFIX: Remove locking in API GC_get_bytes_since_gc and friends.
Add GC_get_heap_usage_safe() to API as a thread-safe alternative to
GC_get_bytes_since_gc and friends.
Remove newly-added lock-free GC_get_heap_size_inner and
GC_get_free_bytes_inner from API.
* include/gc.h (GC_get_heap_size, GC_get_free_bytes,
GC_get_unmapped_bytes, GC_get_bytes_since_gc, GC_get_total_bytes):
Refine comment.
* include/gc.h (GC_HAVE_GET_HEAP_USAGE_SAFE): New macro.
* include/gc.h (GC_get_heap_usage_safe): New API function.
* misc.c (GC_get_heap_usage_safe): Likewise.
* include/gc_mark.h (GC_get_heap_size_inner, GC_get_free_bytes_inner):
Remove API function.
* misc.c (GC_get_heap_size_inner, GC_get_free_bytes_inner): Likewise.
* misc.c (GC_get_heap_size): Add comment.
* misc.c (GC_get_heap_size, GC_get_free_bytes, GC_get_unmapped_bytes,
GC_get_bytes_since_gc, GC_get_total_bytes): Remove locking.
* misc.c (GC_get_unmapped_bytes): Do not test USE_MUNMAP (not needed
after locking removal).
* misc.c (GC_get_bytes_since_gc, GC_get_total_bytes): Cast result to
size_t.
Ivan Maidanski [Wed, 31 Aug 2011 15:01:42 +0000 (19:01 +0400)]
FIX: MinGW/MingwCE: Use CreateThread in initsecondarythread test and
thread_leak_test.
* tests/initsecondarythread.c: Include windows.h instead of pthread.h
unless GC_PTHREADS.
* tests/thread_leak_test.c: Likewise.
* tests/initsecondarythread.c (thread): Use WINAPI and set return
type to DWORD unless GC_PTHREADS.
* tests/thread_leak_test.c (test): Likewise.
* tests/initsecondarythread.c (main): Use HANDLE, CreateThread and
WaitForSingleObject instead of pthread_t, pthread_create and
pthread_join, respectively, unless GC_PTHREADS.
* tests/thread_leak_test.c (main): Likewise.
Ivan Maidanski [Wed, 31 Aug 2011 10:19:34 +0000 (14:19 +0400)]
Check pthread_create/join result in initsecondarythread test.
* tests/initsecondarythread.c (GC_NO_THREAD_REDIRECTS): Add comment.
* tests/initsecondarythread.c: Include stdio.h.
* tests/initsecondarythread.c (thread): Cast result of malloc to void;
return arg parameter instead of NULL (to suppress compiler warnings).
* tests/initsecondarythread.c (main): Define "code" local variable;
store result of pthread_create and pthread_join to "code" variable;
exit application with an error code (with the corresponding error
message) if pthread_create or pthread_join fails.
Ivan Maidanski [Thu, 25 Aug 2011 08:42:13 +0000 (12:42 +0400)]
Move information about the authors and their emails from the source
files to AUTHORS file. (This information could also be observed
via "git log" or by looking into the original version of a file.)
* doc/README.DGUX386: Remove original-author and modified-by
information (as well as email and time-stamp) from the file.
* doc/README.Mac: Ditto.
* doc/README.amiga: Ditto.
* doc/README.cords: Ditto.
* doc/README.darwin: Ditto.
* doc/README.dj: Ditto.
* doc/README.ews4800: Ditto.
* doc/README.win32: Ditto.
* doc/barrett_diagram: Ditto.
* include/private/gcconfig.h: Ditto.
* tests/initsecondarythread.c: Ditto.
* AUTHORS: Add authors information (with emails).
* doc/README.Mac: Remove non Lattin-1 characters.
* README: Update email to sending bugs information.
* doc/README.Mac: Expand all tabs to spaces; remove trailing spaces
at EOLn.
* doc/README.amiga: Ditto.
* doc/barrett_diagram: Ditto.
Ivan Maidanski [Wed, 24 Aug 2011 20:16:06 +0000 (00:16 +0400)]
Remove information about the authors from the source files.
(This information could be observed via "git log" or by looking into
the original version of a file.)
* Makefile.am: Remove original-author and modified-by information
(as well as a time-stamp) from the file header.
* configure.ac: Ditto.
* cord/cordbscs.c: Ditto.
* cord/cordprnt.c: Ditto.
* cord/cordxtra.c: Ditto.
* cord/de.c: Ditto.
* cord/de_cmds.h: Ditto.
* cord/de_win.h: Ditto.
* doc/README.arm.cross: Ditto.
* doc/doc.am: Ditto.
* dyn_load.c: Ditto.
* gc_cpp.cc: Ditto.
* gc_dlopen.c: Ditto.
* include/cord.h: Ditto.
* include/include.am: Ditto.
* include/private/cord_pos.h: Ditto.
* include/private/gc_hdrs.h: Ditto.
* include/weakpointer.h: Ditto.
* m4/gc_set_version.m4: Ditto.
* tests/test_cpp.cc: Ditto.
* cord/cordprnt.c: Fix a typo in a comment.
* AUTHORS: Add authors.
* cord/cordprnt.c: Expand all tabs to spaces; remove trailing spaces
at EOLn.
* cord/de.c: Ditto.
* cord/de_cmds.h: Ditto.
* cord/de_win.c: Ditto.
* cord/de_win.h: Ditto.
* doc/README.arm.cross: Ditto.
* include/private/cord_pos.h: Ditto.
* include/weakpointer.h: Ditto.
* m4/gc_set_version.m4: Ditto.
Ivan Maidanski [Mon, 22 Aug 2011 19:12:14 +0000 (23:12 +0400)]
Remove the ancient non-integrated patches from README.DGUX386 file.
* doc/README.DGUX386: Fix a typo.
* doc/README.DGUX386: Remove patches for ltconfig and ltmain.sh;
add a note about the removal (the patches could be viewed via
"git diff" for this commit).
Ivan Maidanski [Sun, 21 Aug 2011 07:45:57 +0000 (11:45 +0400)]
Resolve "comparison of signed and unsigned values" compiler warnings.
* allchblk.c (GC_allochblk_nth): Cast MAX_BLACK_LIST_ALLOC and
HBLKSIZE to signed_word.
* mallocx.c (GC_generic_malloc_many): Cast my_bytes_allocd to word.
* mark.c (GC_do_local_mark): Cast the result of local_top minus
local_mark_stack to word (since is non-negative).
* misc.c (GC_base): Declare sz as unsigned word.
* misc.c (GC_enable_incremental): Cast bytes_written to size_t in
comparison to len.
* obj_map.c (GC_initialize_offsets): Declare 'i' as unsigned.
* os_dep.c (GC_or_pages): Ditto.
* typd_mlc.c (GC_init_explicit_typing): Ditto.
* ptr_chck.c (GC_is_visible): Cast the result of p minus base to word.
* typd_mlc.c (GC_make_descriptor): Cast last_set_bit to word (since
non-negative) when compared to BITMAP_BITS.
Petter Urkedal [Sun, 14 Aug 2011 10:57:27 +0000 (12:57 +0200)]
Use pkg-config to pick up libatomic_ops, etc.
* configure.ac: Remove checks for ar and ranlib.
* configure.ac: Replace AC_CHECK_HEADER with PKG_CHECK_MODULES when
checking for libatomic_ops. The macro sets the appropriate flags, so
simplify accordingly.
* Makefile.am, configure.ac: Set ATOMIC_OPS_CFLAGS in configure.ac
instead of conditionally doing it in Makefile.am, to be more consistent
with the pkg-config case.
* configure.ac: Fix a typo and some phrases.
Petter Urkedal [Thu, 11 Aug 2011 20:04:06 +0000 (22:04 +0200)]
Adjust after removal of libatomic_ops from the source tree.
configure.ac: Since we no longer bundle libatomic_ops, we must check for
the sub-directory before using it, in case we didn't find an installed
version.
Makefile.am: Don't include libatomic_ops in the distribution.
Jie Liu [Tue, 9 Aug 2011 19:30:20 +0000 (23:30 +0400)]
Support multi-threading for RTEMS target.
* configure.ac: Add GC_RTEMS_PTHREADS AH_TEMPLATE and configure
for rtems.
* os_dep.c: Add GC_get_stack_base if GC_RTEMS_PTHREADS for rtems.
* pthread_stop_world.c (GC_stop_init): Add ifdef SA_RESTART.
* pthread_stop_world.c (GC_stop_init): Use sigprocmask for rtems
when defined GC_RTEMS_PTHREADS.
* pthread_support.c: Exclude sys/mman.h for rtems.
* pthread_support.c (GC_thr_init): Set default GC_nprocs (1) for
rtems.
* include/gc_config_macros.h: Define GC_RTEMS_PTHREADS for rtems
pthread and define GC_NO_DLOPEN for rtems.
* include/private/gc_locks.h: Define USE_PTHREAD_LOCKS for rtems.
* include/private/gcconfig.h: Use rtems_get_stack_bottom()
for InitStackBottom; and use SIGUSR1 for SIG_SUSPEND, SIGUSR2
for SIG_THR_RESTART on rtems.
* include/private/thread_local_alloc.h: Use USE_PTHREAD_SPECIFIC
for rtems.
* tests/test.c (Init): Use exit(0) for rtems instead of return.
* new_hblk.c (GC_build_fl): Adjust "h" local variable cast type
when setting obj_link (to prevent compiler warning); reformat the
comment.
* tests/test.c (reverse_test_inner): Use proper type when touching
"b" and "c" local variables (to prevent compiler warning).
* misc.c (GC_init): Use HOTTER_THAN (instead of STACK_GROWS_DOWN)
for GC_stackbottom assertion.
* os_dep.c (GC_enclosing_mapping): Define only if IA64 or
INCLUDE_LINUX_THREAD_DESCR; make GC_INNER.
* pthread_support.c (GC_enclosing_mapping): Declare (only if
INCLUDE_LINUX_THREAD_DESCR).
* os_dep.c (GC_get_main_stack_base): Don't call pthread_getattr_np
if REDIRECT_MALLOC as the former is observed to call redirected
malloc (while GC is not initialized yet) on some Linux platforms.
* include/private/gc_priv.h (MAX_HEAP_SECTS): Don't use a smaller
value for SMALL_CONFIG if USE_PROC_FOR_LIBRARIES defined.
* malloc.c (GC_init_lib_bounds): Call GC_init (to ensure GC is
initialized before doing GC_text_mapping).
* misc.c (GC_init): Add a check for GC_init recursion in case of
malloc is redirected (abort with the corresponding message).
* pthread.c (GC_thr_init): Place GC_add_roots_inner call into
"else" branch to prevent "local variable might be uninitialized"
compiler warning; add comment.
* dyn_load.c (GC_register_dynamic_libraries): Remove duplicate
call of GC_FirstDLOpenedLinkMap (twice).
* dyn_load.c (GC_register_main_static_data): Add comment.
* cord/cordbscs.c (CORD_riter): Check for empty string passed (do
not call CORD_riter4 if CORD_len() returned zero).
* cord/cordbscs.c (CORD_init_min_len): Replace the K&R-style
function definition with the ANSI C one.
* cord/cordbscs.c: Expand all tabs to spaces; remove
trailing spaces at EOLn.
* tests/threadkey_test.c (on_thread_exit_inner): Check
GC_pthread_create() result.
* win32_threads.c (CHECK_LOOKUP_MY_THREAD): New macro definition.
* win32_threads.c (GC_reset_finalizer_nested,
GC_check_finalizer_nested, GC_unregister_my_thread,
GC_do_blocking_inner, GC_call_with_gc_active, GC_init_parallel):
Insert CHECK_LOOKUP_MY_THREAD before dereferencing thread
descriptor pointer (to instruct a LINT-like tool that it is ok to
dereference the pointer).
* win32_threads.c (GC_get_next_stack): Assert plast_stack_min is
non-NULL if current_min is not ADDR_LIMIT (for a LINT-like tool).
* win32_threads.c (GC_init_parallel): Define and use "me" local
variable.
* cord/cordtest.c (test_basics): Test CORD_substr() result is
non-NULL.
* cord/cordtest.c (test_extras): Test fopen() result is non-NULL.
* cord/cordtest.c (test_basics, test_extras, test_printf, main):
Replace the K&R-style function definition with the ANSI C one.
* cord/cordtest.c: Expand all tabs to spaces; remove
trailing spaces at EOLn.
* include/private/gc_priv.h (ABORT): Define as abort() when
checking the code with a LINT-like tool (Win32 only).
* tests/test.c (FAIL): Ditto.
* tests/test.c (CHECH_GCLIB_VERSION): New macro (to check that the
version of libgc.so used at runtime matches that at compile time).
* tests/test.c (GC_COND_INIT): Use CHECH_GCLIB_VERSION.
* tests/test.c (CHECK_OUT_OF_MEMORY): New macro (to test malloc
result for out of memory).
* tests/test.c (cons, small_cons, small_cons_uncollectable,
gcj_cons, reverse_test_inner, mktree, alloc8bytes, typed_test,
run_one_test): Use CHECK_OUT_OF_MEMORY.
ivmai [Thu, 30 Jun 2011 15:43:44 +0000 (15:43 +0000)]
2011-06-30 Ivan Maidanski <ivmai@mail.ru>
* dyn_load.c (GC_register_map_entries): Remove "count" local
variable as unused.
* gc_dlopen.c (disable_gc_for_dlopen): Define only if not
USE_PROC_FOR_LIBRARIES.
* malloc.c (calloc): Add parentheses around '&&' operator.
* mark.c (GC_noop_sink): New global variable (instead of a static
local variable inside GC_noop1).
* mark.c (GC_noop1): Use GC_noop_sink variable (to prevent
"variable set but not used" compiler warning).
* include/private/gcconfig.h (USE_PROC_FOR_LIBRARIES): Define only
if undefined yet.
* tests/smash_test.c (main): Don't dereference "p" local variable
if it is NULL.
* tests/staticrootslib.c (main): Ditto.
ivmai [Thu, 30 Jun 2011 15:29:25 +0000 (15:29 +0000)]
2011-06-30 Ivan Maidanski <ivmai@mail.ru>
* pthread_support.c (GC_segment_is_thread_stack): Replace '&'
operator with '&&' one in conditional expressions.
* specific.c (remove_specific): Dereference "entry" local variable
only if it is non-NULL.
* include/gc.h (GC_NEW): Refine the comment (about the returned
value).
ivmai [Tue, 31 May 2011 09:09:34 +0000 (09:09 +0000)]
2011-05-31 Ivan Maidanski <ivmai@mail.ru>
* 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).
ivmai [Mon, 23 May 2011 15:18:04 +0000 (15:18 +0000)]
2011-05-23 Ivan Maidanski <ivmai@mail.ru>
* mark.c (GC_dirty): Add prototype (only if MANUAL_VDB).
* stubborn.c (GC_dirty): Ditto.
* 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
MANUAL_VDB.
* os_dep.c (async_set_pht_entry_from_index): Define for
MANUAL_VDB.
* os_dep.c (GC_read_dirty): Set GC_dirty_maintained only if
success; if ioctl() failed then just print warning instead of
aborting.
ivmai [Mon, 23 May 2011 09:51:11 +0000 (09:51 +0000)]
2011-05-23 Ivan Maidanski <ivmai@mail.ru>
* 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: Refprmat comments.
ivmai [Sun, 22 May 2011 12:46:28 +0000 (12:46 +0000)]
2011-05-22 Ivan Maidanski <ivmai@mail.ru>
* 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()
result.
ivmai [Fri, 20 May 2011 09:57:34 +0000 (09:57 +0000)]
2011-05-20 Ivan Maidanski <ivmai@mail.ru>
* 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
place.
* os_dep.c (GC_page_was_dirty, GC_page_was_ever_dirty): Compute
PHT_HASH(h) only once (store result to a local variable).
ivmai [Wed, 18 May 2011 09:40:00 +0000 (09:40 +0000)]
2011-05-18 Ivan Maidanski <ivmai@mail.ru>
* 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.
ivmai [Wed, 18 May 2011 08:55:41 +0000 (08:55 +0000)]
2011-05-18 Ivan Maidanski <ivmai@mail.ru>
* 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.
ivmai [Tue, 17 May 2011 08:59:42 +0000 (08:59 +0000)]
2011-05-17 Ivan Maidanski <ivmai@mail.ru>
* pthread_support.c (pthread_join): Add assertion (check thread is
finished).
* 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): Ditto.
* 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.
ivmai [Mon, 16 May 2011 13:12:14 +0000 (13:12 +0000)]
2011-05-16 Ivan Maidanski <ivmai@mail.ru>
* pthread_stop_world.c (pthread_sigmask): Undefine even if not
DEBUG_THREADS.
* pthread_stop_world.c (GC_unblock_gc_signals): New function (only
if GC_EXPLICIT_SIGNALS_UNBLOCK).
* 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
GC_EXPLICIT_SIGNALS_UNBLOCK); add comment.
* include/private/gcconfig.h (GC_EXPLICIT_SIGNALS_UNBLOCK): New
macro.
ivmai [Tue, 10 May 2011 14:15:57 +0000 (14:15 +0000)]
2011-05-10 Ivan Maidanski <ivmai@mail.ru>
* 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
win32_threads.c).
* pthread_stop_world.c (GC_push_all_stacks): Rename "me" local
variable to "self".
* win32_threads.c (GC_push_all_stacks): Ditto.
* 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
function.
* 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".
ivmai [Tue, 10 May 2011 11:07:12 +0000 (11:07 +0000)]
2011-05-10 Ivan Maidanski <ivmai@mail.ru>
* include/gc.h (GC_HIDE_POINTER, GC_REVEAL_POINTER): Define
unconditionally (do not test GC_I_HIDE_POINTERS); update the
comment.
* include/gc.h (HIDE_POINTER, REVEAL_POINTER): Define as alias to
GC_HIDE/REVEAL_POINTER, respectively.
* include/private/gc_pmark.h (GC_I_HIDE_POINTERS): Do not define.
* include/private/gc_priv.h (GC_I_HIDE_POINTERS): Ditto.