ivmai [Sat, 7 Nov 2009 10:01:15 +0000 (10:01 +0000)]
2009-11-07 Ivan Maidanski <ivmai@mail.ru>
* win32_threads.c (THREAD_TABLE_SZ): Change back to a power-of-two
const value (for speed).
* win32_threads.c (THREAD_TABLE_INDEX): New macro.
* win32_threads.c (GC_new_thread, GC_lookup_thread_inner,
GC_delete_gc_thread, GC_delete_thread, GC_lookup_pthread): Use
THREAD_TABLE_INDEX instead of THREAD_TABLE_SZ.
* win32_threads.c (PTHREAD_MAP_HASH): Rename to PTHREAD_MAP_INDEX.
ivmai [Fri, 6 Nov 2009 05:54:29 +0000 (05:54 +0000)]
2009-11-06 Ivan Maidanski <ivmai@mail.ru>
* include/private/gc_priv.h (GC_write_disabled): New variable
declaration (only if GC_ASSERTIONS and Win32 threads).
* misc.c (GC_write): Add assertion for GC_write_disabled value is
not on (only if THREADS).
* win32_threads.c (GC_write_disabled): New variable (only if
GC_ASSERTIONS and not Cygwin).
* win32_threads.c (GC_stop_world): Set and clear GC_write_disabled
(while holding GC_write_cs).
ivmai [Thu, 5 Nov 2009 17:19:06 +0000 (17:19 +0000)]
2009-11-05 Ivan Maidanski <ivmai@mail.ru>
* win32_threads.c (GC_please_stop): If DllMain-based thread
registration is not compiled in then define GC_please_stop as
a non-volatile variable for assertion only.
* win32_threads.c (GC_stop_world): Set and clear only if defined.
* win32_threads.c (GC_stop_world): Add the comment for GC_printf()
usage (while holding GC_write_cs).
* win32_threads.c (GC_delete_gc_thread): Ditto.
* os_depc.c (GC_remove_protection): Ditto.
ivmai [Thu, 5 Nov 2009 12:35:44 +0000 (12:35 +0000)]
2009-11-05 Ivan Maidanski <ivmai@mail.ru>
* include/private/gc_priv.h (GC_total_stacksize): New variable
declaration (only if THREADS).
* alloc.c (GC_total_stacksize): New variable (only if THREADS).
* alloc.c (min_bytes_allocd): Calculate stack_size using
GC_stackbottom only in the single-threaded case; otherwise use
GC_total_stacksize; print GC_total_stacksize value if
DEBUG_THREADS.
* darwin_stop_world.c (GC_push_all_stacks): Use "%p" printf type
specifier for lo/hi values (instead of "%lx").
* darwin_stop_world.c (GC_push_all_stacks): Use
GC_push_all_stack_frames() instead of GC_push_all_stack().
* darwin_stop_world.c (GC_push_all_stacks): Recalculate
GC_total_stacksize value.
* pthread_stop_world.c (GC_push_all_stacks): Ditto.
* win32_threads.c (GC_push_all_stacks): Ditto.
* win32_threads.c (GC_push_stack_for): Pass "me" argument; return
stack size; don't check for non-zero value of thread->stack_base.
* win32_threads.c (GC_push_all_stacks): Don't call
GC_push_stack_for() and don't check for "t->id == me" if
thread->stack_base is zero.
ivmai [Thu, 5 Nov 2009 11:58:23 +0000 (11:58 +0000)]
2009-11-05 Ivan Maidanski <ivmai@mail.ru>
* dyn_load.c (GC_dump_meminfo): Prefix "%lx" printf type specifier
with "0x".
* os_dep.c (PROTECT): Ditto.
* win32_threads.c (GC_mark_thread_local_free_lists): Cast p->id to
int (to match printf type specifier).
ivmai [Mon, 2 Nov 2009 17:46:29 +0000 (17:46 +0000)]
2009-11-02 Ivan Maidanski <ivmai@mail.ru>
* include/private/gcconfig.h (STACKBOTTOM): Add a presence check
for eCos/NOSYS.
* misc.c (GC_write): Comment out _Jv_diag_write() call (since no
longer defined in GCJ).
ivmai [Sun, 1 Nov 2009 09:44:56 +0000 (09:44 +0000)]
2009-11-01 Ivan Maidanski <ivmai@mail.ru>
* alloc.c (min_bytes_allocd): Use GC_stackbottom value to compute
stack_size even if THREADS.
* doc/README.macros (DEBUG_THREADS): Document.
* pthread_support.c (DEBUG_THREADS): Remove the commented out
definition.
* win32_threads.c (DEBUG_WIN32_THREADS): Remove duplicate
definition.
* win32_threads.c: Include errno.h (except for WinCE).
* win32_threads.c (GC_win32_start_inner): Copy "start" and "param"
to local variables, and free "arg" parameter before "start"
invocation.
* win32_threads.c (GC_beginthreadex): Set errno to EAGAIN on error
(instead of calling SetLastError(ERROR_NOT_ENOUGH_MEMORY)).
* win32_threads.c (GC_beginthreadex): Return 0 on error (instead
of -1).
ivmai [Fri, 23 Oct 2009 10:23:41 +0000 (10:23 +0000)]
2009-10-23 Ivan Maidanski <ivmai@mail.ru>
* darwin_stop_world.c (GC_darwin_register_mach_handler_thread):
Use GC_INNER for the function definition.
* include/private/darwin_stop_world.h
(GC_darwin_register_mach_handler_thread): Remove the prototype.
* include/private/darwin_stop_world.h: Add copyright header.
* os_dep.c (GC_darwin_register_mach_handler_thread): Use GC_INNER
for the function prototype.
* include/private/gc_priv.h (NDEBUG): Explicitly define if
NO_DEBUGGING and not GC_ASSERTIONS (before the standard headers
inclusion).
ivmai [Mon, 19 Oct 2009 14:17:03 +0000 (14:17 +0000)]
2009-10-19 Ivan Maidanski <ivmai@mail.ru>
* include/private/gc_priv.h (GC_bytes_allocd, GC_objfreelist,
GC_aobjfreelist): Replace GC_EXTERN to extern for SEPARATE_GLOBALS
case (since they are not defined inside GC at present).
* include/private/gc_priv.h (GC_objects_are_marked): Remove the
declaration (since made static).
* mark.c (GC_objects_are_marked): Define as STATIC.
* win32_threads.c (GC_thr_initialized, GC_in_thread_creation):
Ditto.
* mark.c (GC_N_KINDS_INITIAL_VALUE): New macro (defined and used
to initialize GC_n_kinds).
* win32_threads.c (start_mark_threads): Adjust the comment.
ivmai [Mon, 19 Oct 2009 08:44:47 +0000 (08:44 +0000)]
2009-10-19 Ivan Maidanski <ivmai@mail.ru>
* misc.c (GC_log): Remove the declaration; move the definition (to
the place where it is used); make STATIC.
* misc.c (GC_init): Use GC_err_printf() instead of GC_log_printf()
to print open log failure.
* misc.c (GC_write): Don't abort on open log failure if the GC is
compiled with GC_PRINT_VERBOSE_STATS (useful for WinCE).
ivmai [Sat, 17 Oct 2009 21:54:30 +0000 (21:54 +0000)]
2009-10-17 Ivan Maidanski <ivmai@mail.ru>
* gc_dlopen.c (GC_MUST_RESTORE_REDEFINED_DLOPEN): Define if dlopen
redirection is turned off; turn it on later when dlopen real
symbol is no longer needed (according to the comment and the same
as in dyn_load.c).
* gc_dlopen.c (WRAP_FUNC, REAL_FUNC): Rename to WRAP_DLFUNC and
REAL_DLFUNC, respectively (to have unique names since the
definitions may differ from that of the similar ones in
pthread_support.c).
* mark.c (source): Undefine the macro when no longer needed.
* os_dep.c (handler): Rename the type to GC_fault_handler_t (to
have the unique name across the project).
* os_dep.c (STAT_BUF_SIZE, STAT_READ); Guard with ifndef; add the
comment.
* pthread_support.c (STAT_BUF_SIZE, STAT_READ): Ditto.
* os_dep.c (sbrk): Undo sbrk() redirection (for ECOS) when no
longer needed.
ivmai [Sat, 17 Oct 2009 21:22:12 +0000 (21:22 +0000)]
2009-10-17 Ivan Maidanski <ivmai@mail.ru>
* pthread_stop_world.c (pthread_sigmask): Undefine before using
in GC_print_sig_mask() (only if DEBUG_THREADS); add the comment.
* win32_threads.c (dlopen, _beginthread): Don't undefine (since
neither redirected nor used here).
* win32_threads.c (GC_Thread_Rep): Rename "table_management" to
"tm" for short; remove "tm_" prefix.
* win32_threads.c (in_use, next): Don't define the macros; use
tm.in_use and tm.next fields, respectively (to ease debugging).
* win32_threads.c (HASH): Rename to PTHREAD_MAP_HASH (to have
unique name across the project).
ivmai [Sat, 17 Oct 2009 20:40:55 +0000 (20:40 +0000)]
2009-10-17 Ivan Maidanski <ivmai@mail.ru>
* dyn_load.c: Include gc_priv.h before using configuration
information (MACOS).
* dyn_load.c (GC_must_restore_redefined_dlopen): Rename to
GC_MUST_RESTORE_REDEFINED_DLOPEN.
ivmai [Thu, 15 Oct 2009 16:41:07 +0000 (16:41 +0000)]
2009-10-15 Ivan Maidanski <ivmai@mail.ru>
* include/private/gcconfig.h: Define DebugBreak() as _exit(-1) for
x86mingw32ce toolchain to workaround the incorrect DebugBreak()
declaration in winbase.h (the workaround would turn into a no-op
when DebugBreak() will be defined as a macro in the toolchain).
ivmai [Thu, 15 Oct 2009 12:49:40 +0000 (12:49 +0000)]
2009-10-15 Ivan Maidanski <ivmai@mail.ru>
* include/private/gcconfig.h: Recognize __i386__ if WinCE (for
x86mingw32ce toolchain).
* include/private/gcconfig.h (NO_GETENV): Don't define for CeGCC
toolchain (or if already defined).
* include/private/gcconfig.h (NO_GETENV_WIN32): New macro (always
defined for WinCE or if NO_GETENV is defined).
* misc.c (GC_CreateLogFile): Use NO_GETENV_WIN32 macro instead of
NO_GETENV one.
ivmai [Sat, 10 Oct 2009 07:45:57 +0000 (07:45 +0000)]
2009-10-10 Ivan Maidanski <ivmai@mail.ru>
* include/gc.h (GC_UNDERSCORE_STDCALL): Recognize new macro;
prefix GC_CreateThread and GC_ExitThread with '_' if defined.
* doc/README.macros (GC_UNDERSCORE_STDCALL): Document.
ivmai [Fri, 9 Oct 2009 17:03:35 +0000 (17:03 +0000)]
2009-10-09 Ivan Maidanski <ivmai@mail.ru>
* alloc.c (GC_collect_or_expand): Add "retry" argument; add the
comments; don't use "default" stop_func on a retry if
GC_dont_expand.
* alloc.c (GC_collect_or_expand): Reformat the code (make the
indentation style uniform across the function).
* alloc.c (GC_allocobj): Pass "retry" argument to
GC_collect_or_expand().
* malloc.c (GC_alloc_large): Ditto.
* include/private/gc_priv.h (GC_collect_or_expand): Move the
declaration to malloc.c; add "retry" argument.
ivmai [Fri, 9 Oct 2009 07:04:46 +0000 (07:04 +0000)]
2009-10-09 Ivan Maidanski <ivmai@mail.ru>
* alloc.c (GC_start_call_back): Move the variable definition from
misc.c.
* include/private/gc_priv.h (GC_start_call_back): Remove the
declaration.
* alloc.c (GC_notify_full_gc): Remove unnecessary cast of 0.
* alloc.c (GC_try_to_collect_inner): Also call stop_func at the
beginning of the function.
* include/gc.h (GC_try_to_collect): Refine the comment about
stop_func.
ivmai [Thu, 8 Oct 2009 08:24:13 +0000 (08:24 +0000)]
2009-10-08 Ivan Maidanski <ivmai@mail.ru>
* alloc.c (GC_default_stop_func, GC_try_to_collect_general,
GC_gcollect): Add the comment.
* alloc.c (GC_try_to_collect_general): Move the assertion on
stop_func != 0 to GC_try_to_collect().
* alloc.c (GC_try_to_collect_general): If stop_func == 0 then use
GC_default_stop_func instead (holding the lock).
* alloc.c (GC_gcollect): Pass 0 as stop_func instead of
GC_default_stop_func (to prevent data races).
ivmai [Tue, 6 Oct 2009 16:16:01 +0000 (16:16 +0000)]
2009-10-06 Ivan Maidanski <ivmai@mail.ru>
* include/gc_config_macros.h: Use old behavior for FreeBSD and
NetBSD platform detection code (check that other GC_xxx_THREADS
are undefined); add FIXME.
ivmai [Tue, 6 Oct 2009 15:38:52 +0000 (15:38 +0000)]
2009-10-06 Ivan Maidanski <ivmai@mail.ru>
* include/gc_config_macros.h: Rearrange the platform detection
code (GC_WIN32_PTHREADS implies GC_WIN32_THREADS; define
GC_THREADS first if GC_XXX_THREADS already set; define proper
GC_XXX_THREADS if GC_THREADS; define GC_PTHREADS in a single
place; define _REENTRANT if posix threads except for Win32).
* include/gc_config_macros.h: Reformat the code (make the
indentation style uniform across the file).
ivmai [Tue, 6 Oct 2009 12:50:34 +0000 (12:50 +0000)]
2009-10-06 Ivan Maidanski <ivmai@mail.ru>
* alloc.c (GC_try_to_collect_general): New function (move the code
from GC_try_to_collect, pass force_unmap argument).
* alloc.c (GC_try_to_collect, GC_gcollect): Call
GC_try_to_collect_general().
* alloc.c (GC_gcollect_and_unmap): New public function.
* include/gc.h (GC_gcollect_and_unmap): New function declaration.
* tests/test.c (window_proc): Call GC_gcollect_and_unmap() on
WM_HIBERNATE event (instead of GC_set_force_unmap_on_gcollect()
and GC_gcollect()).
ivmai [Tue, 6 Oct 2009 10:52:03 +0000 (10:52 +0000)]
2009-10-06 Ivan Maidanski <ivmai@mail.ru>
* include/gc.h (GC_allow_register_threads, GC_register_my_thread,
GC_unregister_my_thread, GC_malloc_many): Refine the comment.
* include/gc.h (GC_malloc_many, GC_NEXT): Declare unconditionally
(that is, don't depend on GC_THREADS macro).
* include/gc.h: Don't check for __CYGWIN32__ and __CYGWIN__ along
with a check for GC_PTHREADS (since the former implies the
latter).
ivmai [Fri, 2 Oct 2009 08:29:50 +0000 (08:29 +0000)]
2009-10-02 Ivan Maidanski <ivmai@mail.ru> (really Petter Urkedal)
* configure.ac: Drop the subdir-objects Automake option, since
it's incompatible with picking source files from libatomic_ops.
* Makefile.in: Regenerate.
ivmai [Thu, 1 Oct 2009 19:23:14 +0000 (19:23 +0000)]
2009-10-01 Ivan Maidanski <ivmai@mail.ru>
* tests/huge_test.c: Define GC_IGNORE_WARN (if not defined) to
suppress misleading GC "Out of Memory!" warning printed on every
GC_MALLOC(LONG_MAX) call.
* tests/huge_test.c: Include "gc.h" instead of <gc.h>.
* tests/huge_test.c (main): Replace K&R-style function definition
with the ANSI C one.
* tests/huge_test.c: Expand all tabs to spaces.
ivmai [Thu, 1 Oct 2009 12:48:38 +0000 (12:48 +0000)]
2009-10-01 Ivan Maidanski <ivmai@mail.ru>
* dyn_load.c (GC_register_dynamic_libraries): Always use
lpMaximumApplicationAddress value for WinCE (even for old
versions).
* os_dep.c (VER_PLATFORM_WIN32_CE): Define if not in winbase.h.
* os_dep.c (GC_dont_query_stack_min): New global variable (only if
WinCE and THREADS).
* os_dep.c (GC_setpagesize): Adjust lpMaximumApplicationAddress
for WinCE (prior to version 6) if not _WIN32_WCE_EMULATION; set
GC_dont_query_stack_min for older WinCE (prior to version 5).
* win32_threads.c (GC_dont_query_stack_min): Declare.
* win32_threads.c (GC_get_stack_min): Rename the macro to
GC_wince_evaluate_stack_min for WinCE; update the comment.
* win32_threads.c (GC_push_stack_for, GC_get_next_stack): Use
GC_wince_evaluate_stack_min() instead of GC_get_stack_min() for
WinCE and don't update thread's last_stack_min value (only if
GC_dont_query_stack_min).
* win32_threads.c (GC_push_stack_for): Skip assertion for WinCE if
GC_dont_query_stack_min (since the evaluated stack_min value may
be incorrect if the stack is bigger than 64 KiB).
ivmai [Thu, 1 Oct 2009 12:22:02 +0000 (12:22 +0000)]
2009-10-01 Ivan Maidanski <ivmai@mail.ru>
* gc_dlopen.c (GC_dlopen): Add function redirector (only if
GC_USE_LD_WRAP).
* include/gc.h: Include "gc_pthread_redirects.h" even if
GC_USE_LD_WRAP or GC_NO_THREAD_REDIRECTS.
* include/gc_pthread_redirects.h (GC_PTHREAD_REDIRECTS_H): Don't
define and check for (since included only from gc.h).
* include/gc_pthread_redirects.h: Declare "GC_" symbols even if
GC_USE_LD_WRAP or GC_NO_THREAD_REDIRECTS.
* include/gc_pthread_redirects.h: Include signal.h only to get
sigset_t definition.
* Makefile.direct: Remove trailing spaces at EOLn.
* Makefile.direct: Document GC_REGISTER_MEM_PRIVATE.
* mark_rts.c (GC_is_tmp_root): Define also for WinCE unless
NO_DEBUGGING (that is, replace _WIN32_WCE_EMULATION with MSWINCE).
* os_dep.c (GC_sysinfo): Remove explicit global variable
initialization to "{0}" (revert back the previous change) since it
might produce a warning.
2009-09-30 Ivan Maidanski <ivmai@mail.ru> (really Petter Urkedal)
* configure.ac: Rewrite the tests for external or internal
libatomic_ops.
* configure.ac: In particular, drop the symbolic links. Add option
--with-libatomic-ops for forced selection.
* Makefile.am: Adjust the path of source files from libatomic_ops
to not use the links.
* Makefile.am (libgc_la_LIBADD): Add $(ATOMIC_OPS_LIBS). This will
be empty if we use the bundled AO sources.
* configure: Regenerate.
* Makefile.in: Ditto.
* alloc.c (GC_version): Add "const" keyword.
* alloc.c (GC_get_version): New public function.
* include/gc.h (GC_get_version): New function declaration; update
the comment for the GC version.
* win32_threads.c (GC_get_stack_min, GC_push_stack_for,
GC_get_next_stack): Recognize _WIN32_WCE_EMULATION macro (used for
WinCE emulation and for custom WinCE 6 devices); add the comment.
* win32_threads.c (GC_get_stack_min): Cast pointer to word instead
of DWORD.
* win32_threads.c (GC_get_next_stack): Don't use and maintain the
latest known stack_min value for WinCE (if GC_get_stack_min is
defined as a macro); update the comments.
* win32_threads.c (GC_wnt): Don't declare for WinCE.
* Makefile.direct: Document EMPTY_GETENV_RESULTS.
* gcj_mlc.c (GC_clear_stack): Remove declaration.
* malloc.c (GC_clear_stack): Ditto.
* mallocx.c (GC_clear_stack): Ditto.
* typd_mlc.c (GC_clear_stack): Ditto.
* gcj_mlc.c (GENERAL_MALLOC, GENERAL_MALLOC_IOP): Rename to
GENERAL_MALLOC_INNER and GENERAL_MALLOC_INNER_IOP, respectively;
remove "lb" unnecessary cast to word.
* include/private/gc_priv.h (GC_clear_stack): Add declaration.
* include/private/gc_priv.h (GENERAL_MALLOC, GENERAL_MALLOC_IOP):
Move common declaration from typd_mlc.c and malloc.c; remove
unnecessary result and "lb" parameter casts.
* include/private/thread_local_alloc.h: Guard against duplicate
header file inclusion.
* os_dep.c (USE_MUNMAP): Replace "-->" with an error directive for
the case when USE_MMAP is not defined.
* pthread_support.c (GC_is_thread_tsd_valid): New internal
function (only if GC_ASSERTIONS and THREAD_LOCAL_ALLOC); move the
code from thread-local GC_malloc(); add FIXME for the condition.
* win32_threads.c (GC_is_thread_tsd_valid): Ditto.
* thread_local_alloc.c (GC_gcjobjfreelist): Change the type (to
match that of its definition).
* thread_local_alloc.c (GC_destroy_thread_local): Add a cast for
GC_gcjobjfreelist.
* thread_local_alloc.c (GC_lookup_thread, GC_lookup_thread_inner):
Remove unused declaration; don't include pthread.h.
* thread_local_alloc.c (GC_is_thread_tsd_valid): New declaration
(only if GC_ASSERTIONS).
* thread_local_alloc.c (GC_malloc): Use GC_is_thread_tsd_valid()
instead of GC_lookup_thread().
* win32_threads.c (GC_lookup_thread_inner): Define as STATIC.
* win32_threads.c (UNPROTECT): Rename to UNPROTECT_THREAD (to have
id different from that in os_dep.c).
2009-09-26 Ivan Maidanski <ivmai@mail.ru> (really Petter Urkedal)
* Makefile.am: Don't add libtool.m4 to EXTRA_DIST.
* acinclude.m4: Place GC_SET_VERSION in [].
* README.QUICK: Update information for Makefile.
* Makefile.am: Replace dist_pkgconfig_DATA with pkgconfig_DATA for
bdw-gc.pc.
* configure.ac: Enable tracetest.
* tests/tests.am: Ditto.
* dyn_load.c (GC_wnt): Update the comment.
* dyn_load.c (GC_register_dynamic_libraries): Add the comment for
_WIN32_WCE_EMULATION; recognize GC_REGISTER_MEM_PRIVATE (new
macro); call GC_is_heap_base() only if check for Type succeeded.