* tests/disclaim_bench.c (main): Run all three sub-tests in the same
process, rather than invoking them through a system-call.
* tests/disclaim_bench.c (free_count, testobj_finalize): Drop the use of
atomic ops, since the benchmark is single-threaded. We can now also run
the test unconditionally.
* 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.
Fix issues proposed in Ivan's previous commit, etc.
* disclaim.c -> {finalized_mlc.c, misc.c}: Move low-level code to misc.c and
the finalized object-kind to finalized_mlc.c.
* Makefile.am: Update accordingly.
* reclaim.c: Condition #include "gc_disclaim.h" and remove "register".
* include/gc_disclaim.h, include/private/gc_priv.h, finalized_mlc.c, misc.c:
Add GC_API, GC_CALL, and GC_CALLBACK. Use typedefs for function pointers.
* tests/disclaim_test.c, tests/disclaim_bench.c: Fix portability and other
issues.
* include/gc_disclaim.h: Forward declare ...
* finalized_mlc.c: ... and export GC_finalized_objfreelist.
* thread_local_alloc.c (GC_destroy_thread_local): Return finalized
freelists though the same global.
* include/private/thread_local_alloc.h: Tweak (move array above comment).
* Makefile.dj, NT_MAKEFILE, NT_STATIC_THREADS_MAKEFILE,
NT_X64_STATIC_THREADS_MAKEFILE, NT_X64_THREADS_MAKEFILE, gc.mak,
windows-untested/vc60/gc.dsp, windows-untested/vc70/gc.vcproj,
windows-untested/vc71/gc.vcproj: Add include/gc_disclaim.h to various build
systems. (Untested.)
Add and update some copyright and remove README.disclaim.
* README.disclaim: Remove as it only contained patching instructions.
* disclaim.c: Add copyright notice.
* include/gc_disclaim.h: Update year on copyright notice.
* configure.ac: Add --disable-disclaim option and set ENABLE_DISCLAIM macro
and conditional accordingly.
* include/include.am, Makefile.am Add sources disclaim.c and
include/gc_disclaim.h.
* Makefile.direct: Ditto and define ENABLE_DISCLAIM.
* include/private/gc_priv.h (obj_kind): Add ok_mark_unconditionally,
ok_disclaim_proc and ok_disclaim_cd.
* misc.c (GC_new_kind_inner): Initialize them.
* include/private/gc_priv.h (hblkhdr): Add HAS_DISCLAIM and
MARK_UNCONDITIONALLY flags.
* allchblk.c (setup_header): Set HAS_DISCLAIM and MARK_UNCONDITIONALLY flags
as indicated by the object kind.
* reclaim.c: Main adjustments to support the disclaim callbacks.
* mark.c (GC_push_unconditionally, GC_push_next_marked_uncollecable):
Unconditionally mark from objects in blocks flagged MARK_UNCONDITIONALLY.
This preserves links reachable from the finalizer when using the the
finalized object kind.
* disclaim.c: Add file with support functions for disclaim callbacks and
implementation of the "finalized" object kind.
* include/gc_disclaim.h: Add file providing the corresponding API.
* include/private/thread_local_alloc.h (thread_local_freelists): Add
finalized_freelists.
* thread_local_alloc.c: Initialize them.
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.