Ivan Maidanski [Fri, 7 Oct 2011 14:33:50 +0000 (18:33 +0400)]
Do not define internal GC_parse_map_entry() unless really used.
* include/private/gc_priv.h (GC_parse_map_entry): Do not declare
unless USE_PROC_FOR_LIBRARIES.
* os_dep.c (GC_parse_map_entry): Test USE_PROC_FOR_LIBRARIES macro
in addition to DYNAMIC_LOADING (in condition whether to define this
function).
Ivan Maidanski [Fri, 30 Sep 2011 13:32:47 +0000 (17:32 +0400)]
Resolve some minor warnings reported by GCC with '-pedantic' option
* allchblk.c (GC_print_hblkfreelist, GC_dump_regions, GC_freehblk):
Explicitly cast a pointer argument of GC_printf to void* to match %p
format specifier.
* reclaim.c (GC_print_free_list): Likewise.
Ivan Maidanski [Fri, 30 Sep 2011 12:17:31 +0000 (16:17 +0400)]
tests: Add missing checks of GC_malloc result (for out-of-memory)
* tests/test.c (mktree): Insert CHECK_OUT_OF_MEMORY to report mktree()
out-of-memory failures.
* tests/trace_test.c (mktree): Test whether GC_MALLOC_ATOMIC returns
NULL (exit with an error code and the appropriate message printed in
this case).
* configure.ac (THREAD_LOCAL_ALLOC): Test enable_shared and
enable_static values properly when setting THREAD_LOCAL_ALLOC
in case PARALLEL_MARK is off (Win32 only).
Ivan Maidanski [Thu, 22 Sep 2011 11:46:54 +0000 (15:46 +0400)]
Define GC_DLL if building only dynamic libraries.
Update README for Cygwin/MinGW.
* configure.ac (GC_DLL): New AC template; define if only the dynamic
libraries are being built.
* configure.ac (THREAD_LOCAL_ALLOC): Define for Win32 implicitly
if static libraries are being built (i.e. GC_DLL is not defined).
* doc/README.win32: Update "GNU Tools" section.
Ivan Maidanski [Tue, 20 Sep 2011 07:58:56 +0000 (11:58 +0400)]
Adjust subthread_create test.
* tests/subthread_create.c: Skip test if AO_fetch_and_add is missing.
* tests/subthread_create.c: Implement for Win32 threads (include
windows.h instead of pthread.h unless GC_PTHREADS).
* tests/subthread_create.c (entry, main): Likewise.
* tests/subthread_create.c (MAX_SUBTHREAD_DEPTH, MAX_SUBTHREAD_COUNT,
INITIAL_THREAD_COUNT): Define only if INITIAL_THREAD_COUNT undefined.
* tests/subthread_create.c (MAX_ALIVE_THREAD_COUNT): New macro.
* tests/subthread_create.c (DECAY_NUMER, DECAY_DENOM): Define only if
DECAY_NUMER is undefined.
* tests/subthread_create.c (INITIAL_THREAD_COUNT, MAX_SUBTHREAD_DEPTH,
MAX_SUBTHREAD_COUNT): Make the values smaller.
* tests/subthread_create.c (thread_created_cnt): Move out of entry();
make volatile.
* tests/subthread_create.c (thread_ended_cnt): New AO variable.
* tests/subthread_create.c (entry): Use "arg" value (instead of
address); adjust thread_ended_cnt on function exit; print thread
number in case of failure; limit the number of concurrently running
threads (by MAX_ALIVE_THREAD_COUNT).
* tests/subthread_create.c (main): Print threads creation statistic on
exit; exit with code 1 (instead of 69) in case of failure.
Ivan Maidanski [Sun, 18 Sep 2011 09:55:04 +0000 (13:55 +0400)]
Rewrite ChangeLog to contain only major per-release changes description
(only starting from 7.2alpha7, the rest remains in the form of commit
log except for versions prior to 7.0alpha9)
Ivan Maidanski [Thu, 15 Sep 2011 15:38:30 +0000 (19:38 +0400)]
Fix mach_dep.c to include sys/ucontext.h on Mac OS X 10.6.
* include/private/gc_priv.h (DARWIN): Include AvailabilityMacros.h
(unless MAC_OS_X_VERSION_MAX_ALLOWED already defined).
* mach_dep.c (GC_with_callee_saves_pushed): Include sys/ucontext.h
(instead of ucontext.h) if Mac OS X 10.6 or higher.
Ivan Maidanski [Wed, 14 Sep 2011 07:00:23 +0000 (11:00 +0400)]
Delete configure.host (move its content to configure.ac).
* Makefile.am (dist_noinst_SCRIPTS): Remove configure.host.
* Makefile.direct (GNU_BUILD_FILES): Likewise.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove.
* configure.ac: Put the content of configure.host instead of
including it.
* configure.host: Remove file.
Ivan Maidanski [Tue, 13 Sep 2011 07:50:42 +0000 (11:50 +0400)]
Remove non-STDC code and comments.
* cord/cordbscs.c (CORD_substr): Remove code for non-STDC compilers.
* include/private/gc_priv.h (clock): Likewise.
* cord/de.c (beep): Replace the K&R-style function definition with
the ANSI C one.
* include/new_gc_alloc.h: Remove comment about expecting STDC
compiler.
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.