Petter Urkedal [Mon, 16 Jan 2012 20:51:35 +0000 (04:51 +0800)]
Move finalizer closure to the end of objects.
* fnlz_mlc.c: Move finalizer closure for finalized object kinds to the end
of objects. This way, we don't require all interior pointers, and GC_base
returns the expected address.
* tests/disclaim_test.c: Improve test coverage.
Ivan Maidanski [Tue, 17 Jan 2012 04:19:04 +0000 (08:19 +0400)]
Fix cordtest temporary file names for Win32
* cord/tests/cordtest.c (FNAME1, FNAME2): Do not specify folder
(platform-dependent) for temporary file; use same short file name
(DOS-compatible) for all targets.
Ivan Maidanski [Mon, 16 Jan 2012 04:55:33 +0000 (08:55 +0400)]
Remove dependency on cord in gc_config_macros.h (libcord visibility fix)
* include/cord.h: Do not include gc_config_macros.h.
* include/cord.h (CORD_API): Define similar to GC_API definition in
gc_config_macros.h.
* include/gc_config_macros.h: Revert changes done in
"libcord visibility fix" (do not test CORD_H, do not define
GC_API_EXPORT and GC_API_IMPORT).
Ivan Maidanski [Mon, 16 Jan 2012 04:42:33 +0000 (08:42 +0400)]
Minor adjustment of libcord visibility fix
* cord/cord.am (libcord_la_CPPFLAGS): Do not define CORD_BUILD and
GC_DLL here (same approach as for GC_BUILD).
* cord/cordbscs.c: Include config.h if HAVE_CONFIG_H (for GC_DLL) and
define CORD_BUILD (before including cord.h).
* cord/cordprnt.c: Likewise.
* cord/cordxtra.c: Likewise.
Petter Urkedal [Sat, 14 Jan 2012 10:11:12 +0000 (11:11 +0100)]
Fix visibility of symbols in libcord.
* include/gc_config_macros.h: Make the export specifications usable also to
the cord library.
* include/cord.h, include/private/cord_pos.h: Define CORD_API and annotate
the public API.
Petter Urkedal [Sun, 8 Jan 2012 09:30:42 +0000 (17:30 +0800)]
Export mark-bit manipulation functions.
* include/private/gc_priv.h, include/gc_mark.h: Move GC_is_marked,
GC_clear_mark_bit and GC_set_mark_bit to a public header and adjust
prototypes and comment.
* mark.c: Adjust prototypes accordingly.
Ivan Maidanski [Fri, 13 Jan 2012 15:53:47 +0000 (19:53 +0400)]
Fix extra/gc.c to enable GC source inclusion from multi-threaded app
* extra/gc.c: Include gc_pthread_redirects.h (unless
GC_NO_THREAD_REDIRECTS) to restore thread calls macro-based
redirection after the corresponding undef's in pthread_support.c.
* win32_threads.c: Restore thread calls macro-based redirection
(unless GC_NO_THREAD_REDIRECTS) at the file end.
* extra/gc.c: Remove "file not well tested" comment.
Paolo Molaro [Mon, 24 Jan 2005 15:29:23 +0000 (15:29 +0000)]
Add on-heap-resize event notification to API
(Apply part of commit 3f1314a from 'mono_libgc' branch)
* include/gc.h (GC_on_heap_resize): New API variable declaration.
* alloc.c (GC_on_heap_resize): New global variable.
* alloc.c (GC_finish_collection): Invoke GC_on_heap_resize (if
non-zero) on returning true.
Ivan Maidanski [Thu, 12 Jan 2012 03:51:16 +0000 (07:51 +0400)]
Replace repeating '==' sequences in documentation with double '=' mark
* TODO: Replace sequences of repeating '==' identifying section
titles (which is also used by git-apply) with two '=' symbols at the
beginning and at the end of each title.
* ChangeLog: Likewise.
* doc/README.Mac: Likewise.
* doc/README.darwin: Likewise.
* configure.ac: Remove sequences of repeating '==' (in a comment).
* doc/README.amiga: Likewise.
Ivan Maidanski [Thu, 12 Jan 2012 03:25:56 +0000 (07:25 +0400)]
Improve GC_thread_is_registered implementation and testing
* pthread_support.c (GC_thread_is_registered): Call pthread_self
outside LOCK; add DCL_LOCK_STATE declaration; replace "ptr" local
variable with "GC_thread me" (and remove cast).
* win32_threads.c (GC_thread_is_registered): Fix implementation by
calling GC_lookup_thread_inner (now works the same as in
pthread_support.c).
* tests/test.c (run_one_test): Test GC_thread_is_registered (only if
THREADS).
Zoltan Varga [Thu, 3 Mar 2005 21:09:34 +0000 (21:09 +0000)]
Add GC_thread_is_registered API function
(Apply commit 9b40e5d from 'mono_libgc' branch)
* include/gc.h (GC_thread_is_registered): Declare new API function
(only if GC_THREADS).
* pthread_support.c (GC_thread_is_registered): New API function
implementation.
* win32_threads.c (GC_thread_is_registered): Likewise.
Ivan Maidanski [Tue, 10 Jan 2012 18:03:20 +0000 (22:03 +0400)]
Optimization: move pthread_self calls out of LOCK section
* pthread_support.c (GC_do_blocking_inner, GC_call_with_gc_active,
pthread_exit): Move pthread_self call out of LOCK section (declare
"self" local variable).
* win32_threads.c (GC_call_with_gc_active): Move GetCurrentThreadId
call out of LOCK section (declare "thread_id" local variable).
Zoltan Varga [Mon, 23 Feb 2009 21:26:49 +0000 (21:26 +0000)]
Avoid unnecessary GC_find_limit invocation if GC_no_dls
(Apply commit f5d47a1 from 'mono_libgc' branch)
* os_dep.c (GC_init_linux_data_start): Avoid the call to
GC_find_limit() if GC_no_dls is TRUE, as it is not needed and
it complicates debugging since it causes a SIGSEGV.
* os_dep.c (GC_register_data_segments): Add assertion for DATASTART.
Ivan Maidanski [Tue, 10 Jan 2012 10:16:26 +0000 (14:16 +0400)]
Add 'const' qualifier for GC_make_descriptor bitmap argument
* include/gc_typed.h (GC_make_descriptor): Make bm pointer const
(replace GC_bitmap type with "const GC_word*").
* typd_mlc.c (GC_add_ext_descriptor, GC_make_descriptor): Likewise.
* tests/test.c (bm_huge): Make array const to test updated
GC_make_descriptor declaration.
Ivan Maidanski [Tue, 10 Jan 2012 09:58:14 +0000 (13:58 +0400)]
Enable platform-specific disabling of static data scanning
(Reworked commit a0347f0 from 'mono_libgc' branch)
* include/private/gcconfig.h (GC_DONT_REGISTER_MAIN_STATIC_DATA):
Recognize new macro.
* include/private/gcconfig.h (DYNAMIC_LOADING): Do not define for
Darwin/arm if GC_DONT_REGISTER_MAIN_STATIC_DATA.
* misc.c (GC_REGISTER_MAIN_STATIC_DATA): Define to FALSE if
GC_DONT_REGISTER_MAIN_STATIC_DATA (and not DYNAMIC_LOADING).
Ivan Maidanski [Tue, 10 Jan 2012 06:27:33 +0000 (10:27 +0400)]
Win32: allow DllMain chaining on the client side
(Reworked commits e55eb9c, 34a996f from 'mono_libgc' branch)
* configure.ac (enable_win32_dllmain): Recognize new AC "enable"
option.
* configure.ac (GC_INSIDE_DLL): New AC macro (defined only if
enable_win32_dllmain).
* README.macros (GC_INSIDE_DLL): Document.
* include/gc.h (GC_DllMain): Declare as API function (for Win32) if
GC_INSIDE_DLL.
* win32_threads.c (GC_INSIDE_DLL): Recognize (treat the same as
GC_DLL).
* win32_threads.c (DllMain): Rename to GC_DllMain; use GC_API export
declarator if GC_INSIDE_DLL, otherwise define GC_DllMain macro as
a synonym to DllMain.
Ivan Maidanski [Thu, 29 Dec 2011 14:46:53 +0000 (18:46 +0400)]
Replace printf PRIxMAX specifier with '%p' for thread id debug output
* pthread_support.c (GC_new_thread, GC_delete_thread,
GC_delete_gc_thread, GC_unregister_my_thread_inner,
GC_unregister_my_thread, GC_thread_exit_proc,
GC_start_rtn_prepare_thread, pthread_create): Output thread id value
(when DEBUG_THREADS) using %p format specifier instead of PRIxMAX, %x
and %lx (casting passed id value to pointer type instead of uintmax_t).
* pthread_start.c (GC_inner_start_routine): Likewise.
GC_stop_world, GC_thread_resume, GC_start_world): Likewise.
* pthread_stop_world.c (GC_suspend_handler_inner, GC_restart_handler,
GC_push_all_stacks, GC_suspend_all, GC_stop_world, GC_start_world):
Likewise.
* darwin_stop_world.c (GC_stack_range_for, GC_suspend_thread_list,
* pthread_start.c: Do not include inttypes.h.
* pthread_support.c: Likewise.
* pthread_support.c (GC_count_threads): Define only if DEBUG_THREADS.
* pthread_support.c (GC_unregister_my_thread): Rename gc_self local
variable to "me".
* pthread_support.c (pthread_create): Report thread started (when
DEBUG_THREADS) only if result is 0.
Ivan Maidanski [Thu, 29 Dec 2011 12:12:37 +0000 (16:12 +0400)]
Add GC_is_heap_ptr() to GC API
* include/gc.h (GC_is_heap_ptr): New API function declaration.
* misc.c (GC_is_heap_ptr): New function.
* tests/test.c (run_one_test): Add GC_is_heap_ptr tests.
Ivan Maidanski [Thu, 29 Dec 2011 08:37:01 +0000 (12:37 +0400)]
Refactoring: rename GC_EXPECT to EXPECT in .c files
* fnlz_mlc.c (GC_core_finalized_malloc, GC_finalized_malloc):
Rename GC_EXPECT to EXPECT; replace 0/1 with TRUE/FALSE for the 2nd
argument of EXPECT.
* thread_local_alloc.c (GC_gcj_malloc): Likewise.
Ivan Maidanski [Wed, 28 Dec 2011 07:13:35 +0000 (11:13 +0400)]
configure: do not compile pthread_stop_world.c for Cygwin/Darwin
(to reduce linker warnings about empty object files)
* Makefile.am (libgc_la_SOURCES): Do not add pthread_start.c,
pthread_support.c, pthread_stop_world.c entries for Cygwin and
win32-pthread; do not add pthread_stop_world.c entry for Darwin.
Ivan Maidanski [Wed, 28 Dec 2011 06:42:49 +0000 (10:42 +0400)]
Fix compiler warning in GC_dyld_image_add/remove (Darwin)
* dyn_load.c (GC_dyld_image_add, GC_dyld_image_remove): Declare i, j
local variables as unsigned (to prevent compiler warning in
a comparison involving sizeof)
Ivan Maidanski [Wed, 28 Dec 2011 06:42:49 +0000 (10:42 +0400)]
Fix compiler warning in GC_dyld_image_add/remove (Darwin)
* dyn_load.c (GC_dyld_image_add, GC_dyld_image_remove): Declare i, j
local variables as unsigned (to prevent compiler warning in
a comparison involving sizeof)
Ivan Maidanski [Tue, 27 Dec 2011 07:43:41 +0000 (11:43 +0400)]
MacOSX: Accept i386_ prefix for exception_state_t (for compatibility)
* os_dep.c (DARWIN_EXC_STATE, DARWIN_EXC_STATE_COUNT,
DARWIN_EXC_STATE_T): Define to i386_EXCEPTION_STATE,
i386_EXCEPTION_STATE_COUNT and i386_exception_state_t, respectively,
for Darwin/x86 if i386_EXCEPTION_STATE_COUNT macro is defined.
Ivan Maidanski [Mon, 26 Dec 2011 12:36:07 +0000 (16:36 +0400)]
configure: Add script code to force USE_MMAP for some targets
(Apply part of commit 21a49a9 from 'gcc_boehmgc' branch)
* configure.ac (gc_use_mmap): New variable (blank currently); add
comment and FIXME.
* configure.ac (USE_MMAP): Force define in case of gc_use_mmap is yes.
Ivan Maidanski [Mon, 26 Dec 2011 07:18:55 +0000 (11:18 +0400)]
Localize references in 'doc' html files
* doc/gcinterface.html: Set "text/plain" type for references to GC
header files; make some absolute references to local (for HTML files
existing in doc folder).
* doc/overview.html: Likewise.
Ivan Maidanski [Fri, 23 Dec 2011 11:34:19 +0000 (15:34 +0400)]
MacOSX: Accept i386_ prefix for thread_state_t (for compatibility)
* include/private/gc_priv.h (GC_THREAD_STATE_T, GC_MACH_THREAD_STATE,
GC_MACH_THREAD_STATE_COUNT): Define to i386_thread_state_t,
i386_THREAD_STATE, i386_THREAD_STATE_COUNT for Darwin/x86 if the
latter macro is available (for compatibility).
* include/private/gc_priv.h (GC_MACH_THREAD_STATE,
GC_MACH_THREAD_STATE_COUNT): Define to ARM_MACHINE_THREAD_STATE and
ARM_MACHINE_THREAD_STATE_COUNT for Darwin/arm (iPhone), respectively,
if the latter macro is available.
* include/private/gc_priv.h (GC_MACH_THREAD_STATE,
GC_MACH_THREAD_STATE_COUNT): Define to platform-independent
MACHINE_THREAD_STATE and MACHINE_THREAD_STATE_COUNT for Darwin,
respectively, in case of missing platform-specific ones.
Ivan Maidanski [Mon, 19 Dec 2011 12:27:18 +0000 (16:27 +0400)]
Fix GC_get_thr_restart_signal for Darwin and Win32
* misc.c (GC_get_thr_restart_signal): Implement for Darwin and Win32
(always returns -1) if THREADS.
* pthread_stop_world.c (GC_get_thr_restart_signal): Remove
implementation for Darwin/Win32 (since the file might not be included
for these targets).
Ivan Maidanski [Fri, 16 Dec 2011 11:07:14 +0000 (15:07 +0400)]
Recognize __ANDROID__ as synonym for PLATFORM_ANDROID
* README.macros (PLATFORM_ANDROID): Update.
* include/gc_config_macros.h (__ANDROID__): Recognize as a synonym for
PLATFORM_ANDROID.
* include/private/gcconfig.h (PLATFORM_ANDROID): Define if __ANDROID__.
Ivan Maidanski [Thu, 15 Dec 2011 15:01:47 +0000 (19:01 +0400)]
Instruct configure to hide internal libgc.so symbols if supported (GCC)
* configure.ac (ac_cv_fvisibility_hidden): New variable (set to "yes"
if only shared library is built and GCC supports "-fvisibility" option.
* configure.ac (CFLAGS): Add "-fvisibility=hidden" and
"-DGC_VISIBILITY_HIDDEN_SET" if ac_cv_fvisibility_hidden is "yes".
* include/gc_config_macros.h (GC_API): Force "default visibility"
attribute if GC_VISIBILITY_HIDDEN_SET (only if GCC and GC_BUILD).
* tests/staticrootstest.c (GC_VISIBILITY_HIDDEN_SET): Test the macro
and skip the test if defined (since "staticrootslib" symbols are of
hidden visibility).
Ivan Maidanski [Thu, 15 Dec 2011 13:42:01 +0000 (17:42 +0400)]
Fix configure to disable GCC aliasing optimization unless forced to
* configure.ac (ac_cv_fno_strict_aliasing): New variable (set to
"skipped" if the client passed "-fstrict-aliasing" option to CFLAGS
else set to "yes" if GCC supports "-fno-strict-aliasing" option,
otherwise set to "no").
* configure.ac (CFLAGS): Append "-fno-strict-aliasing" if
ac_cv_fno_strict_aliasing is "yes" (only if GCC).
Ivan Maidanski [Thu, 15 Dec 2011 12:02:38 +0000 (16:02 +0400)]
Add configure option to compile all library .c files into single gc.o
* Makefile.am (SINGLE_GC_OBJ): Test new AM conditional.
* Makefile.am (libgc_la_SOURCES): Put only extra/gc.c entry here if
SINGLE_GC_OBJ.
* Makefile.am (EXTRA_DIST): Add extra/gc.c only if not SINGLE_GC_OBJ.
* configure.ac (single-obj-compilation): New AC "enable" argument
(turning on compilation of single extra/gc.c file instead of all .c
files from GC base folder).
* configure.ac (SINGLE_GC_OBJ): New AM conditional.
Ivan Maidanski [Tue, 13 Dec 2011 11:37:59 +0000 (15:37 +0400)]
configure: Do not pass '-Wextra' option to GCC if unsupported
* configure.ac (WEXTRA): New variable (set to "-Wextra" if the latter
is supported by GCC, otherwise to "-W").
* configure.ac (CFLAGS): Use WEXTRA variable (only if GCC).