[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog libgc/ChangeLog libgc/Makefile.a...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog libgc/ChangeLog libgc/Makefile.a... |
Date: |
Tue, 28 Oct 2008 20:35:35 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 08/10/28 20:35:35
Modified files:
. : ChangeLog
libgc : ChangeLog Makefile.am Makefile.direct alloc.c
configure.ac dbg_mlc.c dyn_load.c finalize.c
gcj_mlc.c mach_dep.c malloc.c mallocx.c mark.c
mark_rts.c misc.c mkinstalldirs obj_map.c
os_dep.c pthread_support.c ptr_chck.c
stubborn.c thread_local_alloc.c typd_mlc.c
win32_threads.c
libgc/include : gc.h gc_config_macros.h gc_cpp.h gc_gcj.h
gc_mark.h gc_typed.h javaxfc.h
libgc/include/private: gc_locks.h gc_priv.h thread_local_alloc.h
libgc/tests : test.c
Added files:
libgc : build_atomic_ops.sh build_atomic_ops.sh.cygwin
Removed files:
libgc : configure_atomic_ops.sh
Log message:
Update libgc to current bdwgc cvs (Fix a bug with typed allocation).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3578&r2=1.3579
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/Makefile.am?cvsroot=dotgnu-pnet&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/Makefile.direct?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/alloc.c?cvsroot=dotgnu-pnet&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/configure.ac?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/dbg_mlc.c?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/dyn_load.c?cvsroot=dotgnu-pnet&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/finalize.c?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/gcj_mlc.c?cvsroot=dotgnu-pnet&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/mach_dep.c?cvsroot=dotgnu-pnet&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/malloc.c?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/mallocx.c?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/mark.c?cvsroot=dotgnu-pnet&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/mark_rts.c?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/misc.c?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/mkinstalldirs?cvsroot=dotgnu-pnet&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/obj_map.c?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/os_dep.c?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/pthread_support.c?cvsroot=dotgnu-pnet&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/ptr_chck.c?cvsroot=dotgnu-pnet&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/stubborn.c?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/thread_local_alloc.c?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/typd_mlc.c?cvsroot=dotgnu-pnet&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/win32_threads.c?cvsroot=dotgnu-pnet&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/build_atomic_ops.sh?cvsroot=dotgnu-pnet&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/build_atomic_ops.sh.cygwin?cvsroot=dotgnu-pnet&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/configure_atomic_ops.sh?cvsroot=dotgnu-pnet&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/include/gc.h?cvsroot=dotgnu-pnet&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/include/gc_config_macros.h?cvsroot=dotgnu-pnet&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/include/gc_cpp.h?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/include/gc_gcj.h?cvsroot=dotgnu-pnet&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/include/gc_mark.h?cvsroot=dotgnu-pnet&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/include/gc_typed.h?cvsroot=dotgnu-pnet&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/include/javaxfc.h?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/include/private/gc_locks.h?cvsroot=dotgnu-pnet&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/include/private/gc_priv.h?cvsroot=dotgnu-pnet&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/include/private/thread_local_alloc.h?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/tests/test.c?cvsroot=dotgnu-pnet&r1=1.7&r2=1.8
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3578
retrieving revision 1.3579
diff -u -b -r1.3578 -r1.3579
--- ChangeLog 22 Oct 2008 19:23:29 -0000 1.3578
+++ ChangeLog 28 Oct 2008 20:35:31 -0000 1.3579
@@ -1,3 +1,23 @@
+2008-10-27 Klaus Treichel <address@hidden>
+
+ * libgc/build_atomic_ops.sh, libgc/build_atomic_ops.sh.cygwin: Added
+
+ * libgc/configure_atomic_ops.sh: Removed
+
+ * libgc/ChangeLog, libgc/Makefile.am, libgc/Makefile.direct,
+ libgc/alloc.c, libgc/configure.ac, libgc/dbg_mlc.c, libgc/dyn_load.c,
+ libgc/finalize.c, libgc/gcj_mlc.c, libgc/mach_dep.c, libgc/malloc.c,
+ libgc/mallocx.c, libgc/mark.c, libgc/mark_rts.c, libgc/misc.c,
+ libgc/mkinstalldirs, libgc/obj_map.c, libgc/os_dep.c,
+ libgc/pthread_support.c, libgc/ptr_chck.c, libgc/stubborn.c,
+ libgc/thread_local_alloc.c, libgc/typd_mlc.c, libgc/win32_threads.c,
+ libgc/include/gc.h, libgc/include/gc_config_macros.h,
+ libgc/include/gc_cpp.h, libgc/include/gc_gcj.h, libgc/include/gc_mark.h,
+ libgc/include/gc_typed.h, libgc/include/javaxfc.h,
+ libgc/include/private/gc_locks.h, libgc/include/private/gc_priv.h,
+ libgc/include/private/thread_local_alloc.h, libgc/tests/test.c: Update
to
+ bdwgc cvs till 2008-10-27.
+
2008-10-22 Klaus Treichel <address@hidden>
* libgc/ChangeLog, libgc/alloc.c, libgc/configure.ac,
Index: libgc/ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/ChangeLog,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libgc/ChangeLog 22 Oct 2008 19:19:59 -0000 1.3
+++ libgc/ChangeLog 28 Oct 2008 20:35:32 -0000 1.4
@@ -1,3 +1,63 @@
+2008-10-27 Hans Boehm <address@hidden> (Really Ivan Maidansky)
+ * thread_local_alloc.c, include/private/thread_local_alloc.h:
+ Fix typos in comments.
+ * finalize.c: Declare mark_procs and GC_register_finalizer_inner
+ STATIC.
+ * malloc.c (GC_free): Move size calculation below assertion.
+
+2008-10-27 Hans Boehm <address@hidden>
+ * win32_threads.c (GC_get_stack_min, GC_may_be_in_stack):
+ Add one entry VirtualQuery cache, I_HOLD_LOCK assertions.
+ (GC_push_stack_for, GC_get_next_stack) : Hopefully fix WINCE support.
+
+2008-10-27 Hans Boehm <address@hidden> (Thanks to Klaus Treichel.)
+ * finalize.c (GC_general_register_disappearing_link): Add
+ assertion.
+ * malloc.c (GC_generic_malloc): Round lb to granules, not words.
+ * mallocx.c (GC_generic_malloc_ignore_off_page): Round lb to
+ granules, not words.
+
+2008-10-27 Hans Boehm <address@hidden> (Really Rex Dieter and
+ Petr Krajca)
+ * mach_dep.c (NO_GETCONTEXT): Define for sparc linux.
+ * configure.ac: Define mach_dep for sparc-linux.
+ * configure: Regenerate.
+
+2008-10-25 Hans Boehm <address@hidden> (Really Ivan Maidansky)
+ * mark_rts.c (GC_approx_sp): Use volatile to avoid common
+ warning.
+
+2008-10-25 Hans Boehm <address@hidden>
+ * dyn_load.c (GC_cond_add_roots): Fix GC_get_next_stack argument
+ order.
+
+2008-10-24 Hans Boehm <address@hidden> (Really Ivan Maidanski)
+ * alloc.c, dbg_mlc.c, dyn_load.c, finalize.c, gcj_mlc.c,
+ include/gc.h, include/gc_config_macros.h, include/gc_cpp.h,
+ include/gc_gcj.h, include/gc_mark.h, include/gc_typed.h,
+ include/javaxfc.h, include/private/gc_locks.h,
+ include/private/gc_priv.h, malloc.c, mallocx.c, mark.c, mark_rts.c,
+ misc.c, obj_map.c, os_dep.c, pthread_support.c, ptr_chck.c,
+ stubborn.c, tests/test.c, thread_local_alloc.c, typd_mlc.c
+ win32_threads.c: Add GC_CALL and GC_CALLBACK macro invocations.
+ * test.c: Remove some old K&R code.
+
+2008-10-24 Hans Boehm <address@hidden>
+ (Partially based loosely on patch from Ivan Maidanski)
+ * win32_threads.c (GC_may_be_in_stack): New. (GC_Thread_Rep):
+ Add last_stack_min. (GC_push_stack_for): Use last_stack_min.
+ (GC_get_next_stack): Add limit argument, use_last_stack_min.
+ (GC_suspend): make stack_base assignment conditional.
+ * dyn_load.c (win32 GC_cod_add_roots): Pass limit to
+ GC_get_next_stack.
+ * configure_atomic_ops.sh: Remove.
+ * build_atomic_ops.sh, build_atomic_ops.sh.cygwin, doc/README.win32,
+ Makefile.direct: Partially support build directories whose path
+ name contains blanks.
+ * Makefile.am: Support new files (build_atomic_ops.sh,
+ build_atomic_ops.sh.cygwin)
+ * Makefile.in: Regenerate.
+
2008-10-21 Hans Boehm <address@hidden> (Really Ivan Maidanski)
* include/private/gc_locks.h, include/private/gc_pmark.h,
include/private/gc_priv.h, include/private/gcconfig.h,
Index: libgc/Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- libgc/Makefile.am 31 Jul 2008 19:39:01 -0000 1.10
+++ libgc/Makefile.am 28 Oct 2008 20:35:32 -0000 1.11
@@ -164,7 +164,7 @@
EXTRA_DIST += BCC_MAKEFILE NT_MAKEFILE NT_THREADS_MAKEFILE \
OS2_MAKEFILE PCR-Makefile digimars.mak EMX_MAKEFILE \
Makefile.direct Makefile.dj Makefile.DLLs SMakefile.amiga \
- WCC_MAKEFILE configure_atomic_ops.sh \
+ WCC_MAKEFILE build_atomic_ops.sh build_atomic_ops.sh.cygwin \
NT_STATIC_THREADS_MAKEFILE NT_X64_STATIC_THREADS_MAKEFILE \
NT_X64_THREADS_MAKEFILE
Index: libgc/Makefile.direct
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/Makefile.direct,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- libgc/Makefile.direct 30 Aug 2008 13:57:43 -0000 1.8
+++ libgc/Makefile.direct 28 Oct 2008 20:35:32 -0000 1.9
@@ -403,8 +403,7 @@
PCR-Makefile SMakefile.amiga Makefile.DLLs \
digimars.mak Makefile.direct NT_STATIC_THREADS_MAKEFILE \
NT_X64_STATIC_THREADS_MAKEFILE NT_X64_THREADS_MAKEFILE \
- configure_atomic_ops.sh
-# Makefile and Makefile.direct are copies of each other.
+ build_atomic_ops.sh build_atomic_ops.sh.cygwin
OTHER_FILES= Makefile setjmp_t.c callprocs \
MacProjects.sit.hqx MacOS.c \
@@ -438,8 +437,7 @@
# if AO_INSTALL_DIR doesn't exist, we assume that it is pointing to
# the default location, and we need to build
$(AO_INSTALL_DIR):
- CC=$(CC) $(srcdir)/configure_atomic_ops.sh
- cd $(AO_SRC_DIR); $(MAKE) CC=$(CC) install
+ CC=$(CC) MAKE=$(MAKE) $(srcdir)/build_atomic_ops.sh
LEAKFLAGS=$(CFLAGS) -DFIND_LEAK
Index: libgc/alloc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/alloc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- libgc/alloc.c 22 Oct 2008 19:19:59 -0000 1.9
+++ libgc/alloc.c 28 Oct 2008 20:35:32 -0000 1.10
@@ -111,7 +111,7 @@
extern GC_bool GC_collection_in_progress(void);
/* Collection is in progress, or was abandoned. */
-int GC_never_stop_func (void) { return(0); }
+int GC_CALLBACK GC_never_stop_func (void) { return(0); }
unsigned long GC_time_limit = TIME_LIMIT;
@@ -126,7 +126,7 @@
#if defined(SMALL_CONFIG) || defined(NO_CLOCK)
# define GC_timeout_stop_func GC_never_stop_func
#else
- STATIC int GC_timeout_stop_func (void)
+ STATIC int GC_CALLBACK GC_timeout_stop_func (void)
{
CLOCK_TYPE current_time;
static unsigned count = 0;
@@ -444,7 +444,7 @@
}
}
-GC_API int GC_collect_a_little(void)
+GC_API int GC_CALL GC_collect_a_little(void)
{
int result;
DCL_LOCK_STATE;
@@ -776,7 +776,7 @@
}
/* Externally callable routine to invoke full, stop-world collection */
-GC_API int GC_try_to_collect(GC_stop_func stop_func)
+GC_API int GC_CALL GC_try_to_collect(GC_stop_func stop_func)
{
int result;
DCL_LOCK_STATE;
@@ -799,7 +799,7 @@
return(result);
}
-GC_API void GC_gcollect(void)
+GC_API void GC_CALL GC_gcollect(void)
{
(void)GC_try_to_collect(GC_never_stop_func);
if (GC_have_errors) GC_print_all_errors();
@@ -912,7 +912,7 @@
return(x < y? x : y);
}
-GC_API void GC_set_max_heap_size(GC_word n)
+GC_API void GC_CALL GC_set_max_heap_size(GC_word n)
{
GC_max_heapsize = n;
}
@@ -997,7 +997,7 @@
/* Really returns a bool, but it's externally visible, so that's clumsy. */
/* Arguments is in bytes. */
-GC_API int GC_expand_hp(size_t bytes)
+GC_API int GC_CALL GC_expand_hp(size_t bytes)
{
int result;
DCL_LOCK_STATE;
Index: libgc/configure.ac
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/configure.ac,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libgc/configure.ac 22 Oct 2008 19:20:00 -0000 1.4
+++ libgc/configure.ac 28 Oct 2008 20:35:32 -0000 1.5
@@ -22,7 +22,7 @@
AC_CONFIG_SRCDIR(gcj_mlc.c)
AC_CANONICAL_TARGET
AC_PREREQ(2.53)
-AC_REVISION($Revision: 1.4 $)
+AC_REVISION($Revision: 1.5 $)
GC_SET_VERSION
AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects nostdinc])
AM_MAINTAINER_MODE
@@ -403,6 +403,9 @@
dnl This is now redundant, but it is also important for incremental GC
dnl performance under Irix.
;;
+ sparc*-*-linux*)
+ machdep="mach_dep.lo sparc_mach_dep.lo"
+ ;;
sparc-*-netbsd*)
machdep="mach_dep.lo sparc_netbsd_mach_dep.lo"
;;
Index: libgc/dbg_mlc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/dbg_mlc.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- libgc/dbg_mlc.c 22 Oct 2008 19:20:00 -0000 1.8
+++ libgc/dbg_mlc.c 28 Oct 2008 20:35:32 -0000 1.9
@@ -19,8 +19,8 @@
#include <string.h>
#include "private/dbg_mlc.h"
-void GC_default_print_heap_obj_proc();
-GC_API void GC_register_finalizer_no_order
+void GC_default_print_heap_obj_proc(ptr_t p);
+GC_API void GC_CALL GC_register_finalizer_no_order
(void * obj, GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void * *ocd);
@@ -329,7 +329,7 @@
static GC_describe_type_fn GC_describe_type_fns[MAXOBJKINDS] = {0};
-void GC_register_describe_type_fn(int kind, GC_describe_type_fn fn)
+void GC_CALL GC_register_describe_type_fn(int kind, GC_describe_type_fn fn)
{
GC_describe_type_fns[kind] = fn;
}
@@ -457,13 +457,13 @@
size_t GC_debug_header_size = sizeof(oh);
-GC_API void GC_debug_register_displacement(size_t offset)
+GC_API void GC_CALL GC_debug_register_displacement(size_t offset)
{
GC_register_displacement(offset);
GC_register_displacement((word)sizeof(oh) + offset);
}
-GC_API void * GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
+GC_API void * GC_CALL GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
{
void * result = GC_malloc(lb + DEBUG_BYTES);
@@ -481,7 +481,8 @@
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
-GC_API void * GC_debug_malloc_ignore_off_page(size_t lb, GC_EXTRA_PARAMS)
+GC_API void * GC_CALL GC_debug_malloc_ignore_off_page(size_t lb,
+ GC_EXTRA_PARAMS)
{
void * result = GC_malloc_ignore_off_page(lb + DEBUG_BYTES);
@@ -499,7 +500,8 @@
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
-GC_API void * GC_debug_malloc_atomic_ignore_off_page(size_t lb,
GC_EXTRA_PARAMS)
+GC_API void * GC_CALL GC_debug_malloc_atomic_ignore_off_page(size_t lb,
+ GC_EXTRA_PARAMS)
{
void * result = GC_malloc_atomic_ignore_off_page(lb + DEBUG_BYTES);
@@ -555,7 +557,7 @@
# endif
#ifdef STUBBORN_ALLOC
-GC_API void * GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS)
+GC_API void * GC_CALL GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS)
{
void * result = GC_malloc_stubborn(lb + DEBUG_BYTES);
@@ -573,7 +575,7 @@
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
-GC_API void GC_debug_change_stubborn(void *p)
+GC_API void GC_CALL GC_debug_change_stubborn(void *p)
{
void * q = GC_base(p);
hdr * hhdr;
@@ -590,7 +592,7 @@
GC_change_stubborn(q);
}
-GC_API void GC_debug_end_stubborn_change(void *p)
+GC_API void GC_CALL GC_debug_end_stubborn_change(void *p)
{
register void * q = GC_base(p);
register hdr * hhdr;
@@ -609,22 +611,22 @@
#else /* !STUBBORN_ALLOC */
-GC_API void * GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS)
+GC_API void * GC_CALL GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS)
{
return GC_debug_malloc(lb, OPT_RA s, i);
}
-GC_API void GC_debug_change_stubborn(void *p)
+GC_API void GC_CALL GC_debug_change_stubborn(void *p)
{
}
-GC_API void GC_debug_end_stubborn_change(void *p)
+GC_API void GC_CALL GC_debug_end_stubborn_change(void *p)
{
}
#endif /* !STUBBORN_ALLOC */
-GC_API void * GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS)
+GC_API void * GC_CALL GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS)
{
void * result = GC_malloc_atomic(lb + DEBUG_BYTES);
@@ -642,7 +644,7 @@
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
-GC_API char *GC_debug_strdup(const char *str, GC_EXTRA_PARAMS)
+GC_API char * GC_CALL GC_debug_strdup(const char *str, GC_EXTRA_PARAMS)
{
char *copy;
if (str == NULL) return NULL;
@@ -655,7 +657,7 @@
return copy;
}
-GC_API void * GC_debug_malloc_uncollectable(size_t lb, GC_EXTRA_PARAMS)
+GC_API void * GC_CALL GC_debug_malloc_uncollectable(size_t lb, GC_EXTRA_PARAMS)
{
void * result = GC_malloc_uncollectable(lb + UNCOLLECTABLE_DEBUG_BYTES);
@@ -695,7 +697,7 @@
}
#endif /* ATOMIC_UNCOLLECTABLE */
-GC_API void GC_debug_free(void * p)
+GC_API void GC_CALL GC_debug_free(void * p)
{
ptr_t base;
# ifndef SHORT_DBG_HDRS
@@ -770,7 +772,7 @@
}
#endif
-GC_API void * GC_debug_realloc(void * p, size_t lb, GC_EXTRA_PARAMS)
+GC_API void * GC_CALL GC_debug_realloc(void * p, size_t lb, GC_EXTRA_PARAMS)
{
void * base;
# ifndef SHORT_DBG_HDRS
@@ -934,7 +936,7 @@
return((void *)result);
}
-void GC_debug_invoke_finalizer(void * obj, void * data)
+void GC_CALLBACK GC_debug_invoke_finalizer(void * obj, void * data)
{
register struct closure * cl = (struct closure *) data;
@@ -961,7 +963,8 @@
}
}
-GC_API void GC_debug_register_finalizer(void * obj, GC_finalization_proc fn,
+GC_API void GC_CALL GC_debug_register_finalizer(void * obj,
+ GC_finalization_proc fn,
void * cd, GC_finalization_proc *ofn,
void * *ocd)
{
@@ -983,7 +986,7 @@
store_old(obj, my_old_fn, (struct closure *)my_old_cd, ofn, ocd);
}
-GC_API void GC_debug_register_finalizer_no_order
+GC_API void GC_CALL GC_debug_register_finalizer_no_order
(void * obj, GC_finalization_proc fn,
void * cd, GC_finalization_proc *ofn,
void * *ocd)
@@ -1008,7 +1011,7 @@
store_old(obj, my_old_fn, (struct closure *)my_old_cd, ofn, ocd);
}
-GC_API void GC_debug_register_finalizer_unreachable
+GC_API void GC_CALL GC_debug_register_finalizer_unreachable
(void * obj, GC_finalization_proc fn,
void * cd, GC_finalization_proc *ofn,
void * *ocd)
@@ -1033,7 +1036,7 @@
store_old(obj, my_old_fn, (struct closure *)my_old_cd, ofn, ocd);
}
-GC_API void GC_debug_register_finalizer_ignore_self
+GC_API void GC_CALL GC_debug_register_finalizer_ignore_self
(void * obj, GC_finalization_proc fn,
void * cd, GC_finalization_proc *ofn,
void * *ocd)
@@ -1063,12 +1066,12 @@
# define RA
#endif
-GC_API void * GC_debug_malloc_replacement(size_t lb)
+GC_API void * GC_CALL GC_debug_malloc_replacement(size_t lb)
{
return GC_debug_malloc(lb, RA "unknown", 0);
}
-GC_API void * GC_debug_realloc_replacement(void *p, size_t lb)
+GC_API void * GC_CALL GC_debug_realloc_replacement(void *p, size_t lb)
{
return GC_debug_realloc(p, lb, RA "unknown", 0);
}
Index: libgc/dyn_load.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/dyn_load.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- libgc/dyn_load.c 22 Oct 2008 19:20:00 -0000 1.12
+++ libgc/dyn_load.c 28 Oct 2008 20:35:33 -0000 1.13
@@ -382,7 +382,7 @@
/* A user-supplied routine that is called to determine if a DSO must
be scanned by the gc. */
-static int (*GC_has_static_roots)(const char *, void *, size_t);
+static int (GC_CALLBACK * GC_has_static_roots)(const char *, void *, size_t);
static int GC_register_dynlib_callback(info, size, ptr)
struct dl_phdr_info * info;
@@ -699,7 +699,9 @@
extern GC_bool GC_is_heap_base (ptr_t p);
# ifdef GC_WIN32_THREADS
- extern void GC_get_next_stack(char *start, char **lo, char **hi);
+ extern void GC_get_next_stack(char *start, char * limit, char **lo,
+ char **hi);
+
void GC_cond_add_roots(char *base, char * limit)
{
char * curr_base = base;
@@ -708,8 +710,9 @@
if (base == limit) return;
for(;;) {
- GC_get_next_stack(curr_base, &next_stack_lo, &next_stack_hi);
+ GC_get_next_stack(curr_base, limit, &next_stack_lo, &next_stack_hi);
if (next_stack_lo >= limit) break;
+ if (next_stack_lo > curr_base)
GC_add_roots_inner(curr_base, next_stack_lo, TRUE);
curr_base = next_stack_hi;
}
@@ -1218,9 +1221,8 @@
}
/* Register a routine to filter dynamic library registration. */
-GC_API void
-GC_register_has_static_roots_callback
- (int (*callback)(const char *, void *, size_t)) {
+GC_API void GC_CALL GC_register_has_static_roots_callback
+ (int (GC_CALLBACK * callback)(const char *, void *, size_t)) {
# ifdef HAVE_DL_ITERATE_PHDR
GC_has_static_roots = callback;
# endif
Index: libgc/finalize.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/finalize.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- libgc/finalize.c 22 Oct 2008 19:20:00 -0000 1.8
+++ libgc/finalize.c 28 Oct 2008 20:35:33 -0000 1.9
@@ -137,7 +137,7 @@
*table = new_table;
}
-GC_API int GC_register_disappearing_link(void * * link)
+GC_API int GC_CALL GC_register_disappearing_link(void * * link)
{
ptr_t base;
@@ -147,18 +147,20 @@
return(GC_general_register_disappearing_link(link, base));
}
-GC_API int GC_general_register_disappearing_link(void * * link, void * obj)
+GC_API int GC_CALL GC_general_register_disappearing_link(void * * link,
+ void * obj)
{
struct disappearing_link *curr_dl;
size_t index;
struct disappearing_link * new_dl;
DCL_LOCK_STATE;
- if ((word)link & (ALIGNMENT-1))
+ if (((word)link & (ALIGNMENT-1)) || link == NULL)
ABORT("Bad arg to GC_general_register_disappearing_link");
# ifdef THREADS
LOCK();
# endif
+ GC_ASSERT(GC_base(obj) == obj);
if (log_dl_table_size == -1
|| GC_dl_entries > ((word)1 << log_dl_table_size)) {
GC_grow_table((struct hash_chain_entry ***)(&dl_head),
@@ -206,7 +208,7 @@
return(0);
}
-GC_API int GC_unregister_disappearing_link(void * * link)
+GC_API int GC_CALL GC_unregister_disappearing_link(void * * link)
{
struct disappearing_link *curr_dl, *prev_dl;
size_t index;
@@ -242,7 +244,7 @@
/* Possible finalization_marker procedures. Note that mark stack */
/* overflow is handled by the caller, and is not a disaster. */
-GC_API void GC_normal_finalize_mark_proc(ptr_t p)
+STATIC void GC_normal_finalize_mark_proc(ptr_t p)
{
hdr * hhdr = HDR(p);
@@ -253,7 +255,7 @@
/* This only pays very partial attention to the mark descriptor. */
/* It does the right thing for normal and atomic objects, and treats */
/* most others as normal. */
-GC_API void GC_ignore_self_finalize_mark_proc(ptr_t p)
+STATIC void GC_ignore_self_finalize_mark_proc(ptr_t p)
{
hdr * hhdr = HDR(p);
word descr = hhdr -> hb_descr;
@@ -275,7 +277,7 @@
}
/*ARGSUSED*/
-GC_API void GC_null_finalize_mark_proc(ptr_t p)
+STATIC void GC_null_finalize_mark_proc(ptr_t p)
{
}
@@ -287,7 +289,7 @@
/* behavior. Objects registered in this way are not finalized */
/* if they are reachable by other finalizable objects, eve if those */
/* other objects specify no ordering. */
-GC_API void GC_unreachable_finalize_mark_proc(ptr_t p)
+STATIC void GC_unreachable_finalize_mark_proc(ptr_t p)
{
GC_normal_finalize_mark_proc(p);
}
@@ -302,7 +304,7 @@
/* marking for finalization ordering. Any objects marked */
/* by that procedure will be guaranteed to not have been */
/* finalized when this finalizer is invoked. */
-GC_API void GC_register_finalizer_inner(void * obj,
+STATIC void GC_register_finalizer_inner(void * obj,
GC_finalization_proc fn, void *cd,
GC_finalization_proc *ofn, void **ocd,
finalization_mark_proc mp)
@@ -421,7 +423,7 @@
# endif
}
-GC_API void GC_register_finalizer(void * obj,
+GC_API void GC_CALL GC_register_finalizer(void * obj,
GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void ** ocd)
{
@@ -429,7 +431,7 @@
ocd, GC_normal_finalize_mark_proc);
}
-GC_API void GC_register_finalizer_ignore_self(void * obj,
+GC_API void GC_CALL GC_register_finalizer_ignore_self(void * obj,
GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void ** ocd)
{
@@ -437,7 +439,7 @@
ocd, GC_ignore_self_finalize_mark_proc);
}
-GC_API void GC_register_finalizer_no_order(void * obj,
+GC_API void GC_CALL GC_register_finalizer_no_order(void * obj,
GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void ** ocd)
{
@@ -448,7 +450,7 @@
static GC_bool need_unreachable_finalization = FALSE;
/* Avoid the work if this isn't used. */
-GC_API void GC_register_finalizer_unreachable(void * obj,
+GC_API void GC_CALL GC_register_finalizer_unreachable(void * obj,
GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void ** ocd)
{
@@ -713,7 +715,7 @@
* This routine is externally callable, so is called without
* the allocation lock.
*/
-GC_API void GC_finalize_all(void)
+GC_API void GC_CALL GC_finalize_all(void)
{
DCL_LOCK_STATE;
@@ -731,14 +733,14 @@
/* Returns true if it is worth calling GC_invoke_finalizers. (Useful if
*/
/* finalizers can only be called from some kind of `safe state' and */
/* getting into that safe state is expensive.) */
-GC_API int GC_should_invoke_finalizers(void)
+GC_API int GC_CALL GC_should_invoke_finalizers(void)
{
return GC_finalize_now != 0;
}
/* Invoke finalizers for all objects that are ready to be finalized. */
/* Should be called without allocation lock. */
-GC_API int GC_invoke_finalizers(void)
+GC_API int GC_CALL GC_invoke_finalizers(void)
{
struct finalizable_object * curr_fo;
int count = 0;
@@ -833,7 +835,8 @@
}
}
-GC_API void * GC_call_with_alloc_lock(GC_fn_type fn, void * client_data)
+GC_API void * GC_CALL GC_call_with_alloc_lock(GC_fn_type fn,
+ void * client_data)
{
void * result;
DCL_LOCK_STATE;
Index: libgc/gcj_mlc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/gcj_mlc.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libgc/gcj_mlc.c 22 Oct 2008 19:20:00 -0000 1.6
+++ libgc/gcj_mlc.c 28 Oct 2008 20:35:33 -0000 1.7
@@ -50,7 +50,8 @@
ptr_t * GC_gcjdebugobjfreelist;
/* Caller does not hold allocation lock. */
-GC_API void GC_init_gcj_malloc(int mp_index, void * /* really GC_mark_proc
*/mp)
+GC_API void GC_CALL GC_init_gcj_malloc(int mp_index,
+ void * /* really GC_mark_proc */mp)
{
GC_bool ignore_gcj_info;
DCL_LOCK_STATE;
@@ -134,7 +135,8 @@
#ifdef THREAD_LOCAL_ALLOC
void * GC_core_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr)
#else
- GC_API void * GC_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr)
+ GC_API void * GC_CALL GC_gcj_malloc(size_t lb,
+ void * ptr_to_struct_containing_descr)
#endif
{
ptr_t op;
@@ -179,7 +181,7 @@
/* Similar to GC_gcj_malloc, but add debug info. This is allocated */
/* with GC_gcj_debug_kind. */
-GC_API void * GC_debug_gcj_malloc(size_t lb,
+GC_API void * GC_CALL GC_debug_gcj_malloc(size_t lb,
void * ptr_to_struct_containing_descr, GC_EXTRA_PARAMS)
{
void * result;
@@ -206,7 +208,7 @@
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
-GC_API void * GC_gcj_malloc_ignore_off_page(size_t lb,
+GC_API void * GC_CALL GC_gcj_malloc_ignore_off_page(size_t lb,
void * ptr_to_struct_containing_descr)
{
ptr_t op;
Index: libgc/mach_dep.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/mach_dep.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- libgc/mach_dep.c 22 Oct 2008 19:20:00 -0000 1.9
+++ libgc/mach_dep.c 28 Oct 2008 20:35:33 -0000 1.10
@@ -168,6 +168,10 @@
(defined(DARWIN) || defined(HURD) || defined(ARM32) || defined(MIPS))
# define NO_GETCONTEXT
#endif
+
+#if defined(LINUX) && defined(SPARC) && !defined(NO_GETCONTEXT)
+# define NO_GETCONTEXT
+#endif
/* Ensure that either registers are pushed, or callee-save registers */
/* are somewhere on the stack, and then call fn(arg, ctxt). */
/* ctxt is either a pointer to a ucontext_t we generated, or NULL. */
Index: libgc/malloc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/malloc.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- libgc/malloc.c 30 Aug 2008 13:57:43 -0000 1.8
+++ libgc/malloc.c 28 Oct 2008 20:35:33 -0000 1.9
@@ -159,12 +159,13 @@
result = GC_generic_malloc_inner((word)lb, k);
UNLOCK();
} else {
- size_t lw;
+ size_t lg, lw;
size_t lb_rounded;
word n_blocks;
GC_bool init;
- lw = ROUNDED_UP_WORDS(lb);
- lb_rounded = WORDS_TO_BYTES(lw);
+ lg = ROUNDED_UP_GRANULES(lb);
+ lw = GRANULES_TO_WORDS(lg);
+ lb_rounded = GRANULES_TO_BYTES(lg);
n_blocks = OBJ_SZ_TO_BLOCKS(lb_rounded);
init = GC_obj_kinds[k].ok_init;
LOCK();
@@ -206,7 +207,7 @@
#ifdef THREAD_LOCAL_ALLOC
void * GC_core_malloc_atomic(size_t lb)
#else
- GC_API void * GC_malloc_atomic(size_t lb)
+ GC_API void * GC_CALL GC_malloc_atomic(size_t lb)
#endif
{
void *op;
@@ -233,7 +234,7 @@
/* provide a version of strdup() that uses the collector to allocate the
copy of the string */
-GC_API char *GC_strdup(const char *s)
+GC_API char * GC_CALL GC_strdup(const char *s)
{
char *copy;
@@ -250,7 +251,7 @@
#ifdef THREAD_LOCAL_ALLOC
void * GC_core_malloc(size_t lb)
#else
- GC_API void * GC_malloc(size_t lb)
+ GC_API void * GC_CALL GC_malloc(size_t lb)
#endif
{
void *op;
@@ -386,7 +387,7 @@
# endif /* REDIRECT_MALLOC */
/* Explicitly deallocate an object p. */
-GC_API void GC_free(void * p)
+GC_API void GC_CALL GC_free(void * p)
{
struct hblk *h;
hdr *hhdr;
@@ -404,8 +405,6 @@
# endif
h = HBLKPTR(p);
hhdr = HDR(h);
- sz = hhdr -> hb_sz;
- ngranules = BYTES_TO_GRANULES(sz);
# if defined(REDIRECT_MALLOC) && \
(defined(GC_SOLARIS_THREADS) || defined(GC_LINUX_THREADS) \
|| defined(MSWIN32))
@@ -416,6 +415,8 @@
if (0 == hhdr) return;
# endif
GC_ASSERT(GC_base(p) == p);
+ sz = hhdr -> hb_sz;
+ ngranules = BYTES_TO_GRANULES(sz);
knd = hhdr -> hb_obj_kind;
ok = &GC_obj_kinds[knd];
if (EXPECT((ngranules <= MAXOBJGRANULES), 1)) {
Index: libgc/mallocx.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/mallocx.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- libgc/mallocx.c 22 Oct 2008 19:20:00 -0000 1.8
+++ libgc/mallocx.c 28 Oct 2008 20:35:33 -0000 1.9
@@ -64,7 +64,7 @@
/* lb bytes. The object may be (and quite likely will be) moved. */
/* The kind (e.g. atomic) is the same as that of the old. */
/* Shrinking of large blocks is not implemented well. */
-GC_API void * GC_realloc(void * p, size_t lb)
+GC_API void * GC_CALL GC_realloc(void * p, size_t lb)
{
struct hblk * h;
hdr * hhdr;
@@ -167,7 +167,7 @@
void * GC_generic_malloc_ignore_off_page(size_t lb, int k)
{
void *result;
- size_t lw;
+ size_t lg, lw;
size_t lb_rounded;
word n_blocks;
GC_bool init;
@@ -175,8 +175,9 @@
if (SMALL_OBJ(lb))
return(GC_generic_malloc((word)lb, k));
- lw = ROUNDED_UP_WORDS(lb);
- lb_rounded = WORDS_TO_BYTES(lw);
+ lg = ROUNDED_UP_GRANULES(lb);
+ lw = GRANULES_TO_WORDS(lg);
+ lb_rounded = GRANULES_TO_BYTES(lg);
n_blocks = OBJ_SZ_TO_BLOCKS(lb_rounded);
init = GC_obj_kinds[k].ok_init;
if (GC_have_errors) GC_print_all_errors();
@@ -209,12 +210,12 @@
}
}
-GC_API void * GC_malloc_ignore_off_page(size_t lb)
+GC_API void * GC_CALL GC_malloc_ignore_off_page(size_t lb)
{
return((void *)GC_generic_malloc_ignore_off_page(lb, NORMAL));
}
-GC_API void * GC_malloc_atomic_ignore_off_page(size_t lb)
+GC_API void * GC_CALL GC_malloc_atomic_ignore_off_page(size_t lb)
{
return((void *)GC_generic_malloc_ignore_off_page(lb, PTRFREE));
}
@@ -419,7 +420,7 @@
(void) GC_clear_stack(0);
}
-GC_API void * GC_malloc_many(size_t lb)
+GC_API void * GC_CALL GC_malloc_many(size_t lb)
{
void *result;
GC_generic_malloc_many(((lb + EXTRA_BYTES + GRANULE_BYTES-1)
@@ -433,7 +434,7 @@
# endif
/* Allocate lb bytes of pointerful, traced, but not collectable data */
-GC_API void * GC_malloc_uncollectable(size_t lb)
+GC_API void * GC_CALL GC_malloc_uncollectable(size_t lb)
{
void *op;
void **opp;
@@ -521,7 +522,7 @@
/* Allocate lb bytes of pointerfree, untraced, uncollectable data */
/* This is normally roughly equivalent to the system malloc. */
/* But it may be useful if malloc is redefined.
*/
-GC_API void * GC_malloc_atomic_uncollectable(size_t lb)
+GC_API void * GC_CALL GC_malloc_atomic_uncollectable(size_t lb)
{
void *op;
void **opp;
Index: libgc/mark.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/mark.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- libgc/mark.c 30 Aug 2008 13:57:43 -0000 1.10
+++ libgc/mark.c 28 Oct 2008 20:35:33 -0000 1.11
@@ -32,7 +32,7 @@
#endif
/* Single argument version, robust against whole program analysis. */
-GC_API void GC_noop1(word x)
+GC_API void GC_CALL GC_noop1(word x)
{
static volatile word sink;
Index: libgc/mark_rts.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/mark_rts.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- libgc/mark_rts.c 22 Oct 2008 19:20:00 -0000 1.8
+++ libgc/mark_rts.c 28 Oct 2008 20:35:33 -0000 1.9
@@ -142,7 +142,7 @@
word GC_root_size = 0;
-GC_API void GC_add_roots(void *b, void *e)
+GC_API void GC_CALL GC_add_roots(void *b, void *e)
{
DCL_LOCK_STATE;
@@ -242,7 +242,7 @@
static GC_bool roots_were_cleared = FALSE;
-GC_API void GC_clear_roots (void)
+GC_API void GC_CALL GC_clear_roots (void)
{
DCL_LOCK_STATE;
@@ -303,7 +303,7 @@
#endif
#if !defined(MSWIN32) && !defined(MSWINCE)
-GC_API void GC_remove_roots(void *b, void *e)
+GC_API void GC_CALL GC_remove_roots(void *b, void *e)
{
DCL_LOCK_STATE;
@@ -353,19 +353,13 @@
ptr_t GC_approx_sp(void)
{
- volatile word dummy;
-
- dummy = 42; /* Force stack to grow if necessary. Otherwise the
*/
+ volatile word sp;
+ sp = (word)&sp;
+ /* Also force stack to grow if necessary. Otherwise the */
/* later accesses might cause the kernel to think we're */
/* doing something wrong. */
-# ifdef _MSC_VER
-# pragma warning(disable:4172)
-# endif
- /* Ignore "function returns address of local variable" warning. */
- return((ptr_t)(&dummy));
-# ifdef _MSC_VER
-# pragma warning(default:4172)
-# endif
+
+ return((ptr_t)sp);
}
/*
@@ -406,7 +400,7 @@
return GC_excl_table + low;
}
-GC_API void GC_exclude_static_roots(void *start, void *finish)
+GC_API void GC_CALL GC_exclude_static_roots(void *start, void *finish)
{
struct exclusion * next;
size_t next_index, i;
Index: libgc/misc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/misc.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- libgc/misc.c 22 Oct 2008 19:20:01 -0000 1.11
+++ libgc/misc.c 28 Oct 2008 20:35:33 -0000 1.12
@@ -123,7 +123,7 @@
/* Number of warnings suppressed so far. */
/*ARGSUSED*/
-STATIC void * GC_default_oom_fn(size_t bytes_requested)
+STATIC void * GC_CALLBACK GC_default_oom_fn(size_t bytes_requested)
{
return(0);
}
@@ -324,7 +324,7 @@
/* Return a pointer to the base address of p, given a pointer to a */
/* an address within an object. Return 0 o.w. */
-GC_API void * GC_base(void * p)
+GC_API void * GC_CALL GC_base(void * p)
{
ptr_t r;
struct hblk *h;
@@ -367,29 +367,29 @@
/* Return the size of an object, given a pointer to its base. */
/* (For small objects this also happens to work from interior pointers,
*/
/* but that shouldn't be relied upon.) */
-GC_API size_t GC_size(void * p)
+GC_API size_t GC_CALL GC_size(void * p)
{
hdr * hhdr = HDR(p);
return hhdr -> hb_sz;
}
-GC_API size_t GC_get_heap_size(void)
+GC_API size_t GC_CALL GC_get_heap_size(void)
{
return GC_heapsize;
}
-GC_API size_t GC_get_free_bytes(void)
+GC_API size_t GC_CALL GC_get_free_bytes(void)
{
return GC_large_free_bytes;
}
-GC_API size_t GC_get_bytes_since_gc(void)
+GC_API size_t GC_CALL GC_get_bytes_since_gc(void)
{
return GC_bytes_allocd;
}
-GC_API size_t GC_get_total_bytes(void)
+GC_API size_t GC_CALL GC_get_total_bytes(void)
{
return GC_bytes_allocd+GC_bytes_allocd_before_gc;
}
@@ -401,7 +401,7 @@
# endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */
/* FIXME: The GC_init/GC_init_inner distinction should go away. */
-GC_API void GC_init(void)
+GC_API void GC_CALL GC_init(void)
{
/* LOCK(); -- no longer does anything this early. */
GC_init_inner();
@@ -761,7 +761,7 @@
# endif
}
-GC_API void GC_enable_incremental(void)
+GC_API void GC_CALL GC_enable_incremental(void)
{
# if !defined(SMALL_CONFIG) && !defined(KEEP_BACK_PTRS)
/* If we are keeping back pointers, the GC itself dirties all */
@@ -1009,14 +1009,14 @@
}
#endif
-STATIC void GC_default_warn_proc(char *msg, GC_word arg)
+STATIC void GC_CALLBACK GC_default_warn_proc(char *msg, GC_word arg)
{
GC_err_printf(msg, arg);
}
GC_warn_proc GC_current_warn_proc = GC_default_warn_proc;
-GC_API GC_warn_proc GC_set_warn_proc(GC_warn_proc p)
+GC_API GC_warn_proc GC_CALL GC_set_warn_proc(GC_warn_proc p)
{
GC_warn_proc result;
@@ -1031,7 +1031,7 @@
return(result);
}
-GC_API GC_word GC_set_free_space_divisor (GC_word value)
+GC_API GC_word GC_CALL GC_set_free_space_divisor (GC_word value)
{
GC_word old = GC_free_space_divisor;
if (value != ~(GC_word)0)
@@ -1062,14 +1062,14 @@
}
#endif
-GC_API void GC_enable(void)
+GC_API void GC_CALL GC_enable(void)
{
LOCK();
GC_dont_gc--;
UNLOCK();
}
-GC_API void GC_disable(void)
+GC_API void GC_CALL GC_disable(void)
{
LOCK();
GC_dont_gc++;
@@ -1135,7 +1135,7 @@
return result;
}
-GC_API void * GC_call_with_stack_base(GC_stack_base_func fn, void *arg)
+GC_API void * GC_CALL GC_call_with_stack_base(GC_stack_base_func fn, void *arg)
{
int dummy;
struct GC_stack_base base;
@@ -1151,7 +1151,7 @@
#if !defined(NO_DEBUGGING)
-GC_API void GC_dump(void)
+GC_API void GC_CALL GC_dump(void)
{
GC_printf("***Static roots:\n");
GC_print_static_roots();
@@ -1167,17 +1167,17 @@
#endif /* NO_DEBUGGING */
-GC_API GC_word GC_get_gc_no(void)
+GC_API GC_word GC_CALL GC_get_gc_no(void)
{
return GC_gc_no;
}
-GC_API int GC_get_parallel(void)
+GC_API int GC_CALL GC_get_parallel(void)
{
return GC_parallel;
}
-GC_API GC_oom_func GC_set_oom_fn(GC_oom_func fn)
+GC_API GC_oom_func GC_CALL GC_set_oom_fn(GC_oom_func fn)
{
GC_oom_func ofn = GC_oom_fn;
if (fn != (GC_oom_func)0)
@@ -1185,7 +1185,7 @@
return ofn;
}
-GC_API GC_finalizer_notifier_proc GC_set_finalizer_notifier(
+GC_API GC_finalizer_notifier_proc GC_CALL GC_set_finalizer_notifier(
GC_finalizer_notifier_proc fn)
{
GC_finalizer_notifier_proc ofn = GC_finalizer_notifier;
@@ -1194,7 +1194,7 @@
return ofn;
}
-GC_API int GC_set_finalize_on_demand(int value)
+GC_API int GC_CALL GC_set_finalize_on_demand(int value)
{
int ovalue = GC_finalize_on_demand;
if (value != -1)
@@ -1202,7 +1202,7 @@
return ovalue;
}
-GC_API int GC_set_java_finalization(int value)
+GC_API int GC_CALL GC_set_java_finalization(int value)
{
int ovalue = GC_java_finalization;
if (value != -1)
@@ -1210,7 +1210,7 @@
return ovalue;
}
-GC_API int GC_set_dont_expand(int value)
+GC_API int GC_CALL GC_set_dont_expand(int value)
{
int ovalue = GC_dont_expand;
if (value != -1)
@@ -1218,7 +1218,7 @@
return ovalue;
}
-GC_API int GC_set_no_dls(int value)
+GC_API int GC_CALL GC_set_no_dls(int value)
{
int ovalue = GC_no_dls;
if (value != -1)
@@ -1226,7 +1226,7 @@
return ovalue;
}
-GC_API GC_word GC_set_max_retries(GC_word value)
+GC_API GC_word GC_CALL GC_set_max_retries(GC_word value)
{
GC_word ovalue = GC_max_retries;
if (value != ~(GC_word)0)
@@ -1234,7 +1234,7 @@
return ovalue;
}
-GC_API int GC_set_dont_precollect(int value)
+GC_API int GC_CALL GC_set_dont_precollect(int value)
{
int ovalue = GC_dont_precollect;
if (value != -1)
Index: libgc/mkinstalldirs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/mkinstalldirs,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- libgc/mkinstalldirs 22 Oct 2008 19:20:01 -0000 1.7
+++ libgc/mkinstalldirs 28 Oct 2008 20:35:33 -0000 1.8
@@ -4,7 +4,7 @@
# Created: 1993-05-16
# Public domain
-# $Id: mkinstalldirs,v 1.7 2008/10/22 19:20:01 ktreichel Exp $
+# $Id: mkinstalldirs,v 1.8 2008/10/28 20:35:33 ktreichel Exp $
errstatus=0
dirmode=""
Index: libgc/obj_map.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/obj_map.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libgc/obj_map.c 30 Aug 2008 13:57:43 -0000 1.3
+++ libgc/obj_map.c 28 Oct 2008 20:35:33 -0000 1.4
@@ -24,7 +24,7 @@
/* Consider pointers that are offset bytes displaced from the beginning */
/* of an object to be valid. */
-GC_API void GC_register_displacement(size_t offset)
+GC_API void GC_CALL GC_register_displacement(size_t offset)
{
DCL_LOCK_STATE;
Index: libgc/os_dep.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/os_dep.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- libgc/os_dep.c 22 Oct 2008 19:20:01 -0000 1.14
+++ libgc/os_dep.c 28 Oct 2008 20:35:33 -0000 1.15
@@ -653,7 +653,7 @@
return(buf.RegionSize);
}
-GC_API int GC_get_stack_base(struct GC_stack_base *sb)
+GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb)
{
int dummy;
ptr_t sp = (ptr_t)(&dummy);
@@ -1072,7 +1072,7 @@
/* From pthread_support.c */
#endif
-GC_API int GC_get_stack_base(struct GC_stack_base *b)
+GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *b)
{
pthread_attr_t attr;
size_t size;
@@ -1122,7 +1122,7 @@
/* next. Thus this is likely to identify way too large a */
/* "stack" and thus at least result in disastrous performance. */
/* FIXME - Implement better strategies here. */
-GC_API int GC_get_stack_base(struct GC_stack_base *b)
+GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *b)
{
# ifdef NEED_FIND_LIMIT
int dummy;
@@ -1871,7 +1871,7 @@
return(result);
}
-GC_API void GC_win32_free_heap(void)
+GC_API void GC_CALL GC_win32_free_heap(void)
{
if (GC_no_win32_dlls) {
while (GC_n_heap_bases > 0) {
@@ -2882,7 +2882,7 @@
}
#endif /* !DARWIN */
-GC_API int GC_incremental_protection_needs(void)
+GC_API int GC_CALL GC_incremental_protection_needs(void)
{
if (GC_page_size == HBLKSIZE) {
return GC_PROTECTS_POINTER_HEAP;
@@ -3895,7 +3895,7 @@
#endif /* DARWIN && MPROTECT_VDB */
# ifndef HAVE_INCREMENTAL_PROTECTION_NEEDS
- GC_API int GC_incremental_protection_needs(void)
+ GC_API int GC_CALL GC_incremental_protection_needs(void)
{
return GC_PROTECTS_NONE;
}
Index: libgc/pthread_support.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/pthread_support.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- libgc/pthread_support.c 22 Oct 2008 19:20:03 -0000 1.10
+++ libgc/pthread_support.c 28 Oct 2008 20:35:33 -0000 1.11
@@ -870,7 +870,7 @@
/* length of time. */
struct blocking_data {
- void (*fn)(void *);
+ void (GC_CALLBACK *fn)(void *);
void *arg;
};
@@ -897,7 +897,7 @@
UNLOCK();
}
-void GC_do_blocking(void (*fn)(void *), void *arg) {
+void GC_CALL GC_do_blocking(void (GC_CALLBACK *fn)(void *), void *arg) {
struct blocking_data my_data;
my_data.fn = fn;
@@ -913,7 +913,7 @@
/* parent hasn't yet noticed. */
};
-GC_API int GC_unregister_my_thread(void)
+GC_API int GC_CALL GC_unregister_my_thread(void)
{
GC_thread me;
@@ -1024,7 +1024,7 @@
return me;
}
-GC_API int GC_register_my_thread(struct GC_stack_base *sb)
+GC_API int GC_CALL GC_register_my_thread(struct GC_stack_base *sb)
{
pthread_t my_pthread = pthread_self();
GC_thread me;
@@ -1047,7 +1047,8 @@
}
}
-STATIC void * GC_inner_start_routine(struct GC_stack_base *sb, void * arg)
+STATIC void * GC_CALLBACK GC_inner_start_routine(struct GC_stack_base *sb,
+ void * arg)
{
struct start_info * si = arg;
void * result;
Index: libgc/ptr_chck.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/ptr_chck.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- libgc/ptr_chck.c 22 Oct 2008 19:20:04 -0000 1.5
+++ libgc/ptr_chck.c 28 Oct 2008 20:35:33 -0000 1.6
@@ -18,13 +18,13 @@
#include "private/gc_pmark.h"
-STATIC void GC_default_same_obj_print_proc(void * p, void * q)
+STATIC void GC_CALLBACK GC_default_same_obj_print_proc(void * p, void * q)
{
GC_err_printf("%p and %p are not in the same object\n", p, q);
ABORT("GC_same_obj test failed");
}
-void (*GC_same_obj_print_proc) (void *, void *)
+void (GC_CALLBACK *GC_same_obj_print_proc) (void *, void *)
= GC_default_same_obj_print_proc;
/* Check that p and q point to the same object. Call */
@@ -36,7 +36,7 @@
/* We assume this is performance critical. (It shouldn't */
/* be called by production code, but this can easily make */
/* debugging intolerably slow.) */
-GC_API void * GC_same_obj(void *p, void *q)
+GC_API void * GC_CALL GC_same_obj(void *p, void *q)
{
struct hblk *h;
hdr *hhdr;
@@ -99,13 +99,13 @@
return(p);
}
-STATIC void GC_default_is_valid_displacement_print_proc (void *p)
+STATIC void GC_CALLBACK GC_default_is_valid_displacement_print_proc (void *p)
{
GC_err_printf("%p does not point to valid object displacement\n", p);
ABORT("GC_is_valid_displacement test failed");
}
-void (*GC_is_valid_displacement_print_proc)(void *) =
+void (GC_CALLBACK *GC_is_valid_displacement_print_proc)(void *) =
GC_default_is_valid_displacement_print_proc;
/* Check that if p is a pointer to a heap page, then it points to */
@@ -114,7 +114,7 @@
/* Always returns its argument.
*/
/* Note that we don't lock, since nothing relevant about the header */
/* should change while we have a valid object pointer to the block. */
-GC_API void * GC_is_valid_displacement(void *p)
+GC_API void * GC_CALL GC_is_valid_displacement(void *p)
{
hdr *hhdr;
word pdispl;
@@ -149,13 +149,14 @@
return(p);
}
-STATIC void GC_default_is_visible_print_proc(void * p)
+STATIC void GC_CALLBACK GC_default_is_visible_print_proc(void * p)
{
GC_err_printf("%p is not a GC visible pointer location\n", p);
ABORT("GC_is_visible test failed");
}
-void (*GC_is_visible_print_proc)(void * p) = GC_default_is_visible_print_proc;
+void (GC_CALLBACK *GC_is_visible_print_proc)(void * p) =
+ GC_default_is_visible_print_proc;
#ifndef THREADS
/* Could p be a stack address? */
@@ -183,7 +184,7 @@
/* untyped allocations. The idea is that it should be possible, though
*/
/* slow, to add such a call to all indirect pointer stores.) */
/* Currently useless for multithreaded worlds. */
-GC_API void * GC_is_visible(void *p)
+GC_API void * GC_CALL GC_is_visible(void *p)
{
hdr *hhdr;
@@ -255,7 +256,7 @@
}
-GC_API void * GC_pre_incr (void **p, ptrdiff_t how_much)
+GC_API void * GC_CALL GC_pre_incr (void **p, ptrdiff_t how_much)
{
void * initial = *p;
void * result = GC_same_obj((void *)((ptr_t)initial + how_much), initial);
@@ -266,7 +267,7 @@
return (*p = result);
}
-GC_API void * GC_post_incr (void **p, ptrdiff_t how_much)
+GC_API void * GC_CALL GC_post_incr (void **p, ptrdiff_t how_much)
{
void * initial = *p;
void * result = GC_same_obj((void *)((ptr_t)initial + how_much), initial);
Index: libgc/stubborn.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/stubborn.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libgc/stubborn.c 30 Aug 2008 13:57:43 -0000 1.3
+++ libgc/stubborn.c 28 Oct 2008 20:35:34 -0000 1.4
@@ -22,35 +22,35 @@
/* MANUAL_VDB. But that imposes the additional constraint that */
/* written, but not yet GC_dirty()ed objects must be referenced */
/* by a stack. */
-GC_API void * GC_malloc_stubborn(size_t lb)
+GC_API void * GC_CALL GC_malloc_stubborn(size_t lb)
{
return(GC_malloc(lb));
}
-GC_API void GC_end_stubborn_change(void *p)
+GC_API void GC_CALL GC_end_stubborn_change(void *p)
{
GC_dirty(p);
}
/*ARGSUSED*/
-GC_API void GC_change_stubborn(void *p)
+GC_API void GC_CALL GC_change_stubborn(void *p)
{
}
#else /* !MANUAL_VDB */
-GC_API void * GC_malloc_stubborn(size_t lb)
+GC_API void * GC_CALL GC_malloc_stubborn(size_t lb)
{
return(GC_malloc(lb));
}
/*ARGSUSED*/
-GC_API void GC_end_stubborn_change(void *p)
+GC_API void GC_CALL GC_end_stubborn_change(void *p)
{
}
/*ARGSUSED*/
-GC_API void GC_change_stubborn(void *p)
+GC_API void GC_CALL GC_change_stubborn(void *p)
{
}
Index: libgc/thread_local_alloc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/thread_local_alloc.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libgc/thread_local_alloc.c 22 Oct 2008 19:20:06 -0000 1.3
+++ libgc/thread_local_alloc.c 28 Oct 2008 20:35:34 -0000 1.4
@@ -134,7 +134,7 @@
void * /*GC_thread*/ GC_lookup_thread_inner(unsigned /*DWORD*/ thread_id);
#endif
-GC_API void * GC_malloc(size_t bytes)
+GC_API void * GC_CALL GC_malloc(size_t bytes)
{
size_t granules = ROUNDED_UP_GRANULES(bytes);
void *tsd;
@@ -181,7 +181,7 @@
return result;
}
-GC_API void * GC_malloc_atomic(size_t bytes)
+GC_API void * GC_CALL GC_malloc_atomic(size_t bytes)
{
size_t granules = ROUNDED_UP_GRANULES(bytes);
void *tsd;
@@ -241,7 +241,7 @@
/* incremental GC should be enabled before we fork a second thread. */
/* Unlike the other thread local allocation calls, we assume that the */
/* collector has been explicitly initialized. */
-GC_API void * GC_gcj_malloc(size_t bytes,
+GC_API void * GC_CALL GC_gcj_malloc(size_t bytes,
void * ptr_to_struct_containing_descr)
{
if (GC_EXPECT(GC_incremental, 0)) {
@@ -284,7 +284,7 @@
/* The thread support layer must arrange to mark thread-local */
/* free lists explicitly, since the link field is often */
-/* invisible to the marker. It knows hoe to find all threads; */
+/* invisible to the marker. It knows how to find all threads; */
/* we take care of an individual thread freelist structure. */
void GC_mark_thread_local_fls_for(GC_tlfs p)
{
Index: libgc/typd_mlc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/typd_mlc.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libgc/typd_mlc.c 22 Oct 2008 19:20:07 -0000 1.6
+++ libgc/typd_mlc.c 28 Oct 2008 20:35:34 -0000 1.7
@@ -529,7 +529,7 @@
return new_mark_stack_ptr;
}
-GC_API GC_descr GC_make_descriptor(GC_bitmap bm, size_t len)
+GC_API GC_descr GC_CALL GC_make_descriptor(GC_bitmap bm, size_t len)
{
signed_word last_set_bit = len - 1;
GC_descr result;
@@ -584,7 +584,7 @@
#define GENERAL_MALLOC_IOP(lb,k) \
(void *)GC_clear_stack(GC_generic_malloc_ignore_off_page(lb, k))
-GC_API void * GC_malloc_explicitly_typed(size_t lb, GC_descr d)
+GC_API void * GC_CALL GC_malloc_explicitly_typed(size_t lb, GC_descr d)
{
ptr_t op;
ptr_t * opp;
@@ -617,7 +617,8 @@
return((void *) op);
}
-GC_API void * GC_malloc_explicitly_typed_ignore_off_page(size_t lb, GC_descr d)
+GC_API void * GC_CALL GC_malloc_explicitly_typed_ignore_off_page(size_t lb,
+ GC_descr d)
{
ptr_t op;
ptr_t * opp;
@@ -649,7 +650,8 @@
return((void *) op);
}
-GC_API void * GC_calloc_explicitly_typed(size_t n, size_t lb, GC_descr d)
+GC_API void * GC_CALL GC_calloc_explicitly_typed(size_t n, size_t lb,
+ GC_descr d)
{
ptr_t op;
ptr_t * opp;
Index: libgc/win32_threads.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/win32_threads.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- libgc/win32_threads.c 22 Oct 2008 19:20:08 -0000 1.19
+++ libgc/win32_threads.c 28 Oct 2008 20:35:34 -0000 1.20
@@ -137,7 +137,7 @@
#ifdef GC_DLL
/* Turn on GC_win32_dll_threads */
- GC_API void GC_use_DllMain(void)
+ GC_API void GC_CALL GC_use_DllMain(void)
{
# ifdef THREAD_LOCAL_ALLOC
ABORT("Cannot use thread local allocation with DllMain-based "
@@ -150,7 +150,7 @@
GC_init_parallel();
}
#else
- GC_API void GC_use_DllMain(void)
+ GC_API void GC_CALL GC_use_DllMain(void)
{
ABORT("GC not configured as DLL");
}
@@ -158,6 +158,8 @@
STATIC DWORD GC_main_thread = 0;
+#define ADDR_LIMIT ((ptr_t)(word)-1)
+
struct GC_Thread_Rep {
union {
AO_t tm_in_use; /* Updated without lock. */
@@ -181,6 +183,8 @@
ptr_t stack_base; /* The cold end of the stack. */
/* 0 ==> entry not valid. */
/* !in_use ==> stack_base == 0 */
+ ptr_t last_stack_min; /* Last known minimum (hottest) address */
+ /* in stack or ADDR_LIMIT if unset */
GC_bool suspended;
# ifdef GC_PTHREADS
@@ -387,6 +391,7 @@
GC_err_printf("Last error code: %d\n", last_error);
ABORT("DuplicateHandle failed");
}
+ me -> last_stack_min = ADDR_LIMIT;
me -> stack_base = sb -> mem_base;
/* Up until this point, GC_push_all_stacks considers this thread */
/* invalid. */
@@ -561,7 +566,7 @@
}
}
-GC_API int GC_register_my_thread(struct GC_stack_base *sb) {
+GC_API int GC_CALL GC_register_my_thread(struct GC_stack_base *sb) {
DWORD t = GetCurrentThreadId();
if (0 == GC_lookup_thread(t)) {
@@ -575,7 +580,7 @@
}
}
-GC_API int GC_unregister_my_thread(void)
+GC_API int GC_CALL GC_unregister_my_thread(void)
{
DWORD t = GetCurrentThreadId();
@@ -702,8 +707,9 @@
DWORD exitCode;
if (GetExitCodeThread(t -> handle, &exitCode) &&
exitCode != STILL_ACTIVE) {
+# ifdef GC_PTHREADS
t -> stack_base = 0; /* prevent stack from being pushed */
-# ifndef GC_PTHREADS
+# else
/* this breaks pthread_join on Cygwin, which is guaranteed to */
/* only see user pthreads */
GC_ASSERT(GC_win32_dll_threads);
@@ -808,18 +814,46 @@
# define GC_get_stack_min(s) \
((ptr_t)(((DWORD)(s) - 1) & 0xFFFF0000))
# else
+
+ /* A cache holding the results of the last VirtualQuery call. */
+ /* Protected by the allocation lock. */
+ static ptr_t last_address = 0;
+ static MEMORY_BASIC_INFORMATION last_info;
+
+ /* Probe stack memory region (starting at "s") to find out its */
+ /* lowest address (i.e. stack top).
*/
+ /* S must be a mapped address inside the region, NOT the first */
+ /* unmapped address. */
static ptr_t GC_get_stack_min(ptr_t s)
{
ptr_t bottom;
- MEMORY_BASIC_INFORMATION info;
- VirtualQuery(s, &info, sizeof(info));
+
+ GC_ASSERT(I_HOLD_LOCK());
+ if (s != last_address) {
+ VirtualQuery(s, &last_info, sizeof(last_info));
+ last_address = s;
+ }
do {
- bottom = info.BaseAddress;
- VirtualQuery(bottom - 1, &info, sizeof(info));
- } while ((info.Protect & PAGE_READWRITE)
- && !(info.Protect & PAGE_GUARD));
+ bottom = last_info.BaseAddress;
+ VirtualQuery(bottom - 1, &last_info, sizeof(last_info));
+ last_address = bottom - 1;
+ } while ((last_info.Protect & PAGE_READWRITE)
+ && !(last_info.Protect & PAGE_GUARD));
return(bottom);
}
+
+ /* Return true if the page at s has protections appropriate */
+ /* for a stack page. */
+ static GC_bool GC_may_be_in_stack(ptr_t s)
+ {
+ GC_ASSERT(I_HOLD_LOCK());
+ if (s != last_address) {
+ VirtualQuery(s, &last_info, sizeof(last_info));
+ last_address = s;
+ }
+ return (last_info.Protect & PAGE_READWRITE)
+ && !(last_info.Protect & PAGE_GUARD);
+ }
# endif
STATIC void GC_push_stack_for(GC_thread thread)
@@ -880,11 +914,29 @@
# endif
} /* ! current thread */
- stack_min = GC_get_stack_min(thread->stack_base);
+ /* If got sp value seems to be correct (at least, less than the */
+ /* bottom of the stack) then do its further validation by quick */
+ /* probing the memory region at it. */
+ /* Set stack_min to the lowest address in the thread stack, */
+ /* taking advantage of the old value to avoid slow traversals */
+ /* of large stacks. */
+ if (thread -> last_stack_min == ADDR_LIMIT) {
+ stack_min = GC_get_stack_min(thread -> stack_base);
+ } else {
+# ifdef MSWINCE
+ stack_min = GC_get_stack_min(thread -> stack_base);
+# else
+ if (GC_may_be_in_stack(thread -> last_stack_min)) {
+ stack_min = GC_get_stack_min(thread -> last_stack_min);
+ } else {
+ stack_min = GC_get_stack_min(thread -> stack_base);
+ }
+# endif
+ }
+ thread -> last_stack_min = stack_min;
if (sp >= stack_min && sp < thread->stack_base) {
-# if DEBUG_WIN32_PTHREADS || DEBUG_WIN32_THREADS \
- || DEBUG_CYGWIN_THREADS
+# ifdef DEBUG_THREADS
GC_printf("Pushing thread from %p to %p for 0x%x from 0x%x\n",
sp, thread -> stack_base, thread -> id, me);
# endif
@@ -947,12 +999,21 @@
ABORT("Collecting from unknown thread.");
}
-void GC_get_next_stack(char *start, char **lo, char **hi)
+/* Find stack with the lowest address which overlaps the */
+/* interval [start, limit). */
+/* Return stack bounds in *lo and *hi. If no such stack */
+/* is found, both *hi and *lo will be set to an address */
+/* higher than limit. */
+void GC_get_next_stack(char *start, char *limit,
+ char **lo, char **hi)
{
int i;
-# define ADDR_LIMIT (char *)(-1L)
- char * current_min = ADDR_LIMIT;
+ char * current_min = ADDR_LIMIT; /* Least in-range stack base */
+ ptr_t *plast_stack_min = NULL; /* Address of last_stack_min */
+ /* field for thread corresponding */
+ /* to current_min. */
+ /* First set current_min, ignoring limit. */
if (GC_win32_dll_threads) {
LONG my_max = GC_get_max_thread_index();
@@ -960,6 +1021,9 @@
ptr_t s = (ptr_t)(dll_thread_table[i].stack_base);
if (0 != s && s > start && s < current_min) {
+ /* Update address of last_stack_min. */
+ plast_stack_min = (ptr_t * /* no volatile */)
+ &dll_thread_table[i].last_stack_min;
current_min = s;
}
}
@@ -968,21 +1032,48 @@
GC_thread t;
for (t = GC_threads[i]; t != 0; t = t -> next) {
- ptr_t s = (ptr_t)(t -> stack_base);
+ ptr_t s = t -> stack_base;
if (0 != s && s > start && s < current_min) {
+ /* Update address of last_stack_min. */
+ plast_stack_min = &t -> last_stack_min;
current_min = s;
}
}
}
}
+
*hi = current_min;
if (current_min == ADDR_LIMIT) {
*lo = ADDR_LIMIT;
return;
}
- *lo = GC_get_stack_min(current_min);
- if (*lo < start) *lo = start;
+
+ GC_ASSERT(current_min > start);
+
+# ifndef MSWINCE
+ if (current_min > limit && !GC_may_be_in_stack(limit)) {
+ /* Skip the rest since the memory region at limit address is */
+ /* not a stack (so the lowest address of the found stack would */
+ /* be above the limit value anyway). */
+ *lo = ADDR_LIMIT;
+ return;
+ }
+# endif
+
+ /* Get the minimum address of the found stack by probing its memory
*/
+ /* region starting from the last known minimum (if set). */
+ if (*plast_stack_min == ADDR_LIMIT
+ || !GC_may_be_in_stack(*plast_stack_min)) {
+ /* Unsafe to start from last value. */
+ *lo = GC_get_stack_min(current_min-1);
+ } else {
+ /* Use last value value to optimize search for min address */
+ *lo = GC_get_stack_min(*plast_stack_min);
+ }
+
+ /* Remember current stack_min value. */
+ *plast_stack_min = *lo;
}
#ifndef GC_PTHREADS
@@ -995,7 +1086,8 @@
LPVOID param;
} thread_args;
-STATIC void * GC_win32_start_inner(struct GC_stack_base *sb, LPVOID arg)
+STATIC void * GC_CALLBACK GC_win32_start_inner(struct GC_stack_base *sb,
+ void *arg)
{
void * ret;
thread_args *args = (thread_args *)arg;
@@ -1081,7 +1173,7 @@
ExitThread(dwExitCode);
}
-GC_API GC_uintptr_t GC_beginthreadex(
+GC_API GC_uintptr_t GC_CALL GC_beginthreadex(
void *security, unsigned stack_size,
unsigned ( __stdcall *start_address )( void * ),
void *arglist, unsigned initflag, unsigned *thrdaddr)
@@ -1121,7 +1213,7 @@
}
}
-GC_API void GC_endthreadex(unsigned retval)
+GC_API void GC_CALL GC_endthreadex(unsigned retval)
{
GC_unregister_my_thread();
_endthreadex(retval);
@@ -1454,7 +1546,8 @@
return(result);
}
-STATIC void * GC_pthread_start_inner(struct GC_stack_base *sb, void * arg)
+STATIC void * GC_CALLBACK GC_pthread_start_inner(struct GC_stack_base *sb,
+ void * arg)
{
struct start_info * si = arg;
void * result;
Index: libgc/include/gc.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/gc.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- libgc/include/gc.h 22 Oct 2008 19:20:16 -0000 1.18
+++ libgc/include/gc.h 28 Oct 2008 20:35:34 -0000 1.19
@@ -74,7 +74,7 @@
GC_API GC_word GC_gc_no;/* Counter incremented per collection. */
/* Includes empty GCs at startup. */
-GC_API GC_word GC_get_gc_no(void);
+GC_API GC_word GC_CALL GC_get_gc_no(void);
GC_API int GC_parallel; /* GC is parallelized for performance on
*/
/* multiprocessors. Currently set only */
@@ -85,12 +85,12 @@
/* If GC_parallel is set, incremental */
/* collection is only partially functional, */
/* and may not be desirable. */
-GC_API int GC_get_parallel(void);
+GC_API int GC_CALL GC_get_parallel(void);
/* Public R/W variables */
-typedef void * (* GC_oom_func)(size_t /* bytes_requested */);
+typedef void * (GC_CALLBACK * GC_oom_func)(size_t /* bytes_requested */);
GC_API GC_oom_func GC_oom_fn;
/* When there is insufficient memory to satisfy */
/* an allocation request, we return */
@@ -99,7 +99,7 @@
/* If it returns, it must return 0 or a valid */
/* pointer to a previously allocated heap */
/* object. */
-GC_API GC_oom_func GC_set_oom_fn(GC_oom_func);
+GC_API GC_oom_func GC_CALL GC_set_oom_fn(GC_oom_func);
GC_API int GC_find_leak;
/* Do not actually garbage collect, but simply */
@@ -125,7 +125,7 @@
/* call. The default is determined by whether */
/* the FINALIZE_ON_DEMAND macro is defined */
/* when the collector is built. */
-GC_API int GC_set_finalize_on_demand(int);
+GC_API int GC_CALL GC_set_finalize_on_demand(int);
GC_API int GC_java_finalization;
/* Mark objects reachable from finalizable */
@@ -135,9 +135,9 @@
/* determined by JAVA_FINALIZATION macro. */
/* Enables register_finalizer_unreachable to */
/* work correctly. */
-GC_API int GC_set_java_finalization(int);
+GC_API int GC_CALL GC_set_java_finalization(int);
-typedef void (* GC_finalizer_notifier_proc)(void);
+typedef void (GC_CALLBACK * GC_finalizer_notifier_proc)(void);
GC_API GC_finalizer_notifier_proc GC_finalizer_notifier;
/* Invoked by the collector when there are */
/* objects to be finalized. Invoked at most */
@@ -146,7 +146,7 @@
/* Typically this will notify a finalization */
/* thread, which will call GC_invoke_finalizers */
/* in response. */
-GC_API GC_finalizer_notifier_proc GC_set_finalizer_notifier(
+GC_API GC_finalizer_notifier_proc GC_CALL GC_set_finalizer_notifier(
GC_finalizer_notifier_proc);
GC_API int GC_dont_gc; /* != 0 ==> Dont collect. In versions 6.2a1+, */
@@ -161,7 +161,7 @@
GC_API int GC_dont_expand;
/* Dont expand heap unless explicitly requested */
/* or forced to. */
-GC_API int GC_set_dont_expand(int);
+GC_API int GC_CALL GC_set_dont_expand(int);
GC_API int GC_use_entire_heap;
/* Causes the non-incremental collector to use the */
@@ -197,7 +197,7 @@
/* In Microsoft Windows environments, this will */
/* usually also prevent registration of the */
/* main data segment as part of the root set. */
-GC_API int GC_set_no_dls(int);
+GC_API int GC_CALL GC_set_no_dls(int);
GC_API GC_word GC_free_space_divisor;
/* We try to make sure that we allocate at */
@@ -217,7 +217,7 @@
/* The maximum number of GCs attempted before */
/* reporting out of memory after heap */
/* expansion fails. Initially 0. */
-GC_API GC_word GC_set_max_retries(GC_word);
+GC_API GC_word GC_CALL GC_set_max_retries(GC_word);
GC_API char *GC_stackbottom; /* Cool end of user stack. */
@@ -239,7 +239,7 @@
/* before the first collection. */
/* Interferes with blacklisting. */
/* Wizards only. */
-GC_API int GC_set_dont_precollect(int);
+GC_API int GC_CALL GC_set_dont_precollect(int);
GC_API unsigned long GC_time_limit;
/* If incremental collection is enabled, */
@@ -260,7 +260,7 @@
/* Initialize the collector. Portable clients should call GC_INIT() from
* the main program instead.
*/
-GC_API void GC_init(void);
+GC_API void GC_CALL GC_init(void);
/*
* general purpose allocation routines, with roughly malloc calling conv.
@@ -278,15 +278,15 @@
* starting in 6.0. GC_malloc_stubborn is an alias for GC_malloc unless
* the collector is built with STUBBORN_ALLOC defined.
*/
-GC_API void * GC_malloc(size_t size_in_bytes);
-GC_API void * GC_malloc_atomic(size_t size_in_bytes);
-GC_API char * GC_strdup (const char *str);
-GC_API void * GC_malloc_uncollectable(size_t size_in_bytes);
-GC_API void * GC_malloc_stubborn(size_t size_in_bytes);
+GC_API void * GC_CALL GC_malloc(size_t size_in_bytes);
+GC_API void * GC_CALL GC_malloc_atomic(size_t size_in_bytes);
+GC_API char * GC_CALL GC_strdup (const char *str);
+GC_API void * GC_CALL GC_malloc_uncollectable(size_t size_in_bytes);
+GC_API void * GC_CALL GC_malloc_stubborn(size_t size_in_bytes);
/* The following is only defined if the library has been suitably */
/* compiled: */
-GC_API void * GC_malloc_atomic_uncollectable(size_t size_in_bytes);
+GC_API void * GC_CALL GC_malloc_atomic_uncollectable(size_t size_in_bytes);
/* Explicitly deallocate an object. Dangerous if used incorrectly. */
/* Requires a pointer to the base of an object.
*/
@@ -294,7 +294,7 @@
/* An object should not be enable for finalization when it is */
/* explicitly deallocated. */
/* GC_free(0) is a no-op, as required by ANSI C for free. */
-GC_API void GC_free(void * object_addr);
+GC_API void GC_CALL GC_free(void * object_addr);
/*
* Stubborn objects may be changed only if the collector is explicitly
informed.
@@ -311,8 +311,8 @@
* do so. The same applies to dropping stubborn objects that are still
* changeable.
*/
-GC_API void GC_change_stubborn(void *);
-GC_API void GC_end_stubborn_change(void *);
+GC_API void GC_CALL GC_change_stubborn(void *);
+GC_API void GC_CALL GC_end_stubborn_change(void *);
/* Return a pointer to the base (lowest address) of an object given */
/* a pointer to a location within the object. */
@@ -325,12 +325,12 @@
/* Note that a deallocated object in the garbage collected heap
*/
/* may be considered valid, even if it has been deallocated with */
/* GC_free. */
-GC_API void * GC_base(void * displaced_pointer);
+GC_API void * GC_CALL GC_base(void * displaced_pointer);
/* Given a pointer to the base of an object, return its size in bytes. */
/* The returned size may be slightly larger than what was originally */
/* requested. */
-GC_API size_t GC_size(void * object_addr);
+GC_API size_t GC_CALL GC_size(void * object_addr);
/* For compatibility with C library. This is occasionally faster than */
/* a malloc followed by a bcopy. But if you rely on that, either here */
@@ -340,33 +340,35 @@
/* If the argument is stubborn, the result will have changes enabled. */
/* It is an error to have changes enabled for the original object. */
/* Follows ANSI conventions for NULL old_object. */
-GC_API void * GC_realloc(void * old_object, size_t new_size_in_bytes);
+GC_API void * GC_CALL GC_realloc(void * old_object, size_t new_size_in_bytes);
/* Explicitly increase the heap size. */
/* Returns 0 on failure, 1 on success. */
-GC_API int GC_expand_hp(size_t number_of_bytes);
+GC_API int GC_CALL GC_expand_hp(size_t number_of_bytes);
/* Limit the heap size to n bytes. Useful when you're debugging, */
/* especially on systems that don't handle running out of memory well. */
/* n == 0 ==> unbounded. This is the default. */
-GC_API void GC_set_max_heap_size(GC_word n);
+GC_API void GC_CALL GC_set_max_heap_size(GC_word n);
/* Inform the collector that a certain section of statically allocated */
/* memory contains no pointers to garbage collected memory. Thus it */
/* need not be scanned. This is sometimes important if the application */
/* maps large read/write files into the address space, which could be */
/* mistaken for dynamic library data segments on some systems. */
-GC_API void GC_exclude_static_roots(void * low_address,
+GC_API void GC_CALL GC_exclude_static_roots(void * low_address,
void * high_address_plus_1);
/* Clear the set of root segments. Wizards only. */
-GC_API void GC_clear_roots(void);
+GC_API void GC_CALL GC_clear_roots(void);
/* Add a root segment. Wizards only. */
-GC_API void GC_add_roots(void * low_address, void * high_address_plus_1);
+GC_API void GC_CALL GC_add_roots(void * low_address,
+ void * high_address_plus_1);
/* Remove a root segment. Wizards only. */
-GC_API void GC_remove_roots(void * low_address, void * high_address_plus_1);
+GC_API void GC_CALL GC_remove_roots(void * low_address,
+ void * high_address_plus_1);
/* Add a displacement to the set of those considered valid by the */
/* collector. GC_register_displacement(n) means that if p was returned */
@@ -380,14 +382,14 @@
/* retention. */
/* This is a no-op if the collector has recognition of */
/* arbitrary interior pointers enabled, which is now the default. */
-GC_API void GC_register_displacement(size_t n);
+GC_API void GC_CALL GC_register_displacement(size_t n);
/* The following version should be used if any debugging allocation is */
/* being done. */
-GC_API void GC_debug_register_displacement(size_t n);
+GC_API void GC_CALL GC_debug_register_displacement(size_t n);
/* Explicitly trigger a full, world-stop collection. */
-GC_API void GC_gcollect(void);
+GC_API void GC_CALL GC_gcollect(void);
/* Trigger a full world-stopped collection. Abort the collection if */
/* and when stop_func returns a nonzero value. Stop_func will be */
@@ -398,32 +400,32 @@
/* aborted collections do no useful work; the next collection needs */
/* to start from the beginning.
*/
/* Return 0 if the collection was aborted, 1 if it succeeded. */
-typedef int (* GC_stop_func)(void);
-GC_API int GC_try_to_collect(GC_stop_func stop_func);
+typedef int (GC_CALLBACK * GC_stop_func)(void);
+GC_API int GC_CALL GC_try_to_collect(GC_stop_func stop_func);
/* Return the number of bytes in the heap. Excludes collector private */
/* data structures. Includes empty blocks and fragmentation loss. */
/* Includes some pages that were allocated but never written. */
-GC_API size_t GC_get_heap_size(void);
+GC_API size_t GC_CALL GC_get_heap_size(void);
/* Return a lower bound on the number of free bytes in the heap. */
-GC_API size_t GC_get_free_bytes(void);
+GC_API size_t GC_CALL GC_get_free_bytes(void);
/* Return the number of bytes allocated since the last collection. */
-GC_API size_t GC_get_bytes_since_gc(void);
+GC_API size_t GC_CALL GC_get_bytes_since_gc(void);
/* Return the total number of bytes allocated in this process. */
/* Never decreases, except due to wrapping. */
-GC_API size_t GC_get_total_bytes(void);
+GC_API size_t GC_CALL GC_get_total_bytes(void);
/* Disable garbage collection. Even GC_gcollect calls will be
*/
/* ineffective.
*/
-GC_API void GC_disable(void);
+GC_API void GC_CALL GC_disable(void);
/* Re-enable garbage collection. GC_disable() and GC_enable() calls */
/* nest. Garbage collection is enabled if the number of calls to both */
/* both functions is equal. */
-GC_API void GC_enable(void);
+GC_API void GC_CALL GC_enable(void);
/* Enable incremental/generational collection. */
/* Not advisable unless dirty bits are */
@@ -440,7 +442,7 @@
/* For best performance, should be called as early as possible. */
/* On some platforms, calling it later may have adverse effects.*/
/* Safe to call before GC_INIT(). Includes a GC_init() call. */
-GC_API void GC_enable_incremental(void);
+GC_API void GC_CALL GC_enable_incremental(void);
/* Does incremental mode write-protect pages? Returns zero or */
/* more of the following, or'ed together: */
@@ -450,7 +452,7 @@
#define GC_PROTECTS_STACK 8 /* Probably impractical. */
#define GC_PROTECTS_NONE 0
-GC_API int GC_incremental_protection_needs(void);
+GC_API int GC_CALL GC_incremental_protection_needs(void);
/* Perform some garbage collection work, if appropriate. */
/* Return 0 if there is no more work to be done. */
@@ -459,7 +461,7 @@
/* progress requires it, e.g. if incremental collection is */
/* disabled. It is reasonable to call this in a wait loop */
/* until it returns 0. */
-GC_API int GC_collect_a_little(void);
+GC_API int GC_CALL GC_collect_a_little(void);
/* Allocate an object of size lb bytes. The client guarantees that */
/* as long as the object is live, it will be referenced by a pointer */
@@ -475,8 +477,8 @@
/* for arrays likely to be larger than 100K or so. For other systems, */
/* or if the collector is not configured to recognize all interior */
/* pointers, the threshold is normally much higher. */
-GC_API void * GC_malloc_ignore_off_page(size_t lb);
-GC_API void * GC_malloc_atomic_ignore_off_page(size_t lb);
+GC_API void * GC_CALL GC_malloc_ignore_off_page(size_t lb);
+GC_API void * GC_CALL GC_malloc_atomic_ignore_off_page(size_t lb);
#if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION >= 720
# define GC_ADD_CALLER
@@ -541,22 +543,23 @@
/* Debugging (annotated) allocation. GC_gcollect will check */
/* objects allocated in this way for overwrites, etc. */
-GC_API void * GC_debug_malloc(size_t size_in_bytes, GC_EXTRA_PARAMS);
-GC_API void * GC_debug_malloc_atomic(size_t size_in_bytes, GC_EXTRA_PARAMS);
-GC_API char * GC_debug_strdup(const char *str, GC_EXTRA_PARAMS);
-GC_API void * GC_debug_malloc_uncollectable
+GC_API void * GC_CALL GC_debug_malloc(size_t size_in_bytes, GC_EXTRA_PARAMS);
+GC_API void * GC_CALL GC_debug_malloc_atomic
+ (size_t size_in_bytes, GC_EXTRA_PARAMS);
+GC_API char * GC_CALL GC_debug_strdup(const char *str, GC_EXTRA_PARAMS);
+GC_API void * GC_CALL GC_debug_malloc_uncollectable
(size_t size_in_bytes, GC_EXTRA_PARAMS);
-GC_API void * GC_debug_malloc_stubborn
+GC_API void * GC_CALL GC_debug_malloc_stubborn
(size_t size_in_bytes, GC_EXTRA_PARAMS);
-GC_API void * GC_debug_malloc_ignore_off_page
+GC_API void * GC_CALL GC_debug_malloc_ignore_off_page
(size_t size_in_bytes, GC_EXTRA_PARAMS);
-GC_API void * GC_debug_malloc_atomic_ignore_off_page
+GC_API void * GC_CALL GC_debug_malloc_atomic_ignore_off_page
(size_t size_in_bytes, GC_EXTRA_PARAMS);
-GC_API void GC_debug_free (void * object_addr);
-GC_API void * GC_debug_realloc
+GC_API void GC_CALL GC_debug_free (void * object_addr);
+GC_API void * GC_CALL GC_debug_realloc
(void * old_object, size_t new_size_in_bytes, GC_EXTRA_PARAMS);
-GC_API void GC_debug_change_stubborn(void *);
-GC_API void GC_debug_end_stubborn_change(void *);
+GC_API void GC_CALL GC_debug_change_stubborn(void *);
+GC_API void GC_CALL GC_debug_end_stubborn_change(void *);
/* Routines that allocate objects with debug information (like the */
/* above), but just fill in dummy file and line number information. */
@@ -570,8 +573,8 @@
/* platforms it may be more convenient not to recompile, e.g. for */
/* leak detection. This can be accomplished by instructing the */
/* linker to replace malloc/realloc with these. */
-GC_API void * GC_debug_malloc_replacement (size_t size_in_bytes);
-GC_API void * GC_debug_realloc_replacement
+GC_API void * GC_CALL GC_debug_malloc_replacement (size_t size_in_bytes);
+GC_API void * GC_CALL GC_debug_realloc_replacement
(void * object_addr, size_t size_in_bytes);
# ifdef GC_DEBUG
@@ -642,12 +645,13 @@
/* with Alan Demers, Dan Greene, Carl Hauser, Barry Hayes, */
/* Christian Jacobi, and Russ Atkinson. It's not perfect, and */
/* probably nobody else agrees with it. Hans-J. Boehm 3/13/92
*/
-typedef void (*GC_finalization_proc) (void * obj, void * client_data);
+typedef void (GC_CALLBACK * GC_finalization_proc) (void * obj,
+ void * client_data);
-GC_API void GC_register_finalizer(void * obj, GC_finalization_proc fn,
+GC_API void GC_CALL GC_register_finalizer(void * obj, GC_finalization_proc fn,
void * cd, GC_finalization_proc *ofn,
void * *ocd);
-GC_API void GC_debug_register_finalizer
+GC_API void GC_CALL GC_debug_register_finalizer
(void * obj, GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void * *ocd);
/* When obj is no longer accessible, invoke */
@@ -692,10 +696,10 @@
/* avoid cycles. */
/* Note that cd will still be viewed as accessible, even if it */
/* refers to the object itself. */
-GC_API void GC_register_finalizer_ignore_self
+GC_API void GC_CALL GC_register_finalizer_ignore_self
(void * obj, GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void * *ocd);
-GC_API void GC_debug_register_finalizer_ignore_self
+GC_API void GC_CALL GC_debug_register_finalizer_ignore_self
(void * obj, GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void * *ocd);
@@ -703,10 +707,10 @@
/* It should probably only be used by Java implementations. */
/* Note that cd will still be viewed as accessible, even if it */
/* refers to the object itself. */
-GC_API void GC_register_finalizer_no_order
+GC_API void GC_CALL GC_register_finalizer_no_order
(void * obj, GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void * *ocd);
-GC_API void GC_debug_register_finalizer_no_order
+GC_API void GC_CALL GC_debug_register_finalizer_no_order
(void * obj, GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void * *ocd);
@@ -726,10 +730,10 @@
/* Only works if GC_java_finalization is set. Probably only */
/* of interest when implementing a language that requires */
/* unordered finalization (e.g. Java, C#). */
-GC_API void GC_register_finalizer_unreachable
+GC_API void GC_CALL GC_register_finalizer_unreachable
(void * obj, GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void * *ocd);
-GC_API void GC_debug_register_finalizer_unreachable
+GC_API void GC_CALL GC_debug_register_finalizer_unreachable
(void * obj, GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void * *ocd);
@@ -740,7 +744,7 @@
/* where p is a pointer that is not followed by finalization */
/* code, and should not be considered in determining */
/* finalization order. */
-GC_API int GC_register_disappearing_link(void * * link );
+GC_API int GC_CALL GC_register_disappearing_link(void * * link );
/* Link should point to a field of a heap allocated */
/* object obj. *link will be cleared when obj is */
/* found to be inaccessible. This happens BEFORE any */
@@ -761,7 +765,8 @@
/* memory, and GC_oom_fn did not handle the problem. */
/* Only exists for backward compatibility. See below: */
-GC_API int GC_general_register_disappearing_link (void * * link, void * obj);
+GC_API int GC_CALL GC_general_register_disappearing_link (void * * link,
+ void * obj);
/* A slight generalization of the above. *link is */
/* cleared when obj first becomes inaccessible. This */
/* can be used to implement weak pointers easily and */
@@ -788,15 +793,15 @@
/* decides to reclaim the object and the link is */
/* cleared. */
-GC_API int GC_unregister_disappearing_link (void * * link);
+GC_API int GC_CALL GC_unregister_disappearing_link (void * * link);
/* Returns 0 if link was not actually registered. */
/* Undoes a registration by either of the above two */
/* routines. */
/* Returns !=0 if GC_invoke_finalizers has something to do. */
-GC_API int GC_should_invoke_finalizers(void);
+GC_API int GC_CALL GC_should_invoke_finalizers(void);
-GC_API int GC_invoke_finalizers(void);
+GC_API int GC_CALL GC_invoke_finalizers(void);
/* Run finalizers for all objects that are ready to */
/* be finalized. Return the number of finalizers */
/* that were run. Normally this is also called */
@@ -817,19 +822,19 @@
# define GC_reachable_here(ptr) \
__asm__ volatile(" " : : "X"(ptr) : "memory");
# else
- GC_API void GC_noop1(GC_word x);
+ GC_API void GC_CALL GC_noop1(GC_word x);
# define GC_reachable_here(ptr) GC_noop1((GC_word)(ptr));
#endif
/* GC_set_warn_proc can be used to redirect or filter warning messages.
*/
/* p may not be a NULL pointer.
*/
-typedef void (*GC_warn_proc) (char *msg, GC_word arg);
-GC_API GC_warn_proc GC_set_warn_proc(GC_warn_proc p);
+typedef void (GC_CALLBACK * GC_warn_proc) (char *msg, GC_word arg);
+GC_API GC_warn_proc GC_CALL GC_set_warn_proc(GC_warn_proc p);
/* Returns old warning procedure. */
/* With 0 argument, current warn_proc remains unchanged. */
/* (Only true for GC7.2+) */
-GC_API GC_word GC_set_free_space_divisor(GC_word value);
+GC_API GC_word GC_CALL GC_set_free_space_divisor(GC_word value);
/* Set free_space_divisor. See above for definition. */
/* Returns old value. */
/* With zero argument, nothing is changed, but old value is */
@@ -852,8 +857,9 @@
/* allocator lock to avoid a race with the collector. */
# endif /* I_HIDE_POINTERS */
-typedef void * (*GC_fn_type) (void * client_data);
-GC_API void * GC_call_with_alloc_lock (GC_fn_type fn, void * client_data);
+typedef void * (GC_CALLBACK * GC_fn_type) (void * client_data);
+GC_API void * GC_CALL GC_call_with_alloc_lock (GC_fn_type fn,
+ void * client_data);
/* These routines are intended to explicitly notify the collector */
/* of new threads. Often this is unnecessary because thread creation */
@@ -874,13 +880,15 @@
# endif
};
-typedef void * (*GC_stack_base_func)(struct GC_stack_base *sb, void *arg);
+typedef void * (GC_CALLBACK * GC_stack_base_func)(struct GC_stack_base *sb,
+ void *arg);
/* Call a function with a stack base structure corresponding to
*/
/* somewhere in the GC_call_with_stack_base frame. This often can */
/* be used to provide a sufficiently accurate stack base. And we */
/* implement it everywhere. */
-GC_API void * GC_call_with_stack_base(GC_stack_base_func fn, void *arg);
+GC_API void * GC_CALL GC_call_with_stack_base(GC_stack_base_func fn,
+ void *arg);
/* Register the current thread, with the indicated stack base, as */
/* a new thread whose stack(s) should be traced by the GC. If a */
@@ -893,7 +901,7 @@
#define GC_DUPLICATE 1 /* Was already registered. */
#define GC_NO_THREADS 2 /* No thread support in GC. */
#define GC_UNIMPLEMENTED 3 /* Not yet implemented on this platform. */
-GC_API int GC_register_my_thread(struct GC_stack_base *);
+GC_API int GC_CALL GC_register_my_thread(struct GC_stack_base *);
/* Unregister the current thread. The thread may no longer allocate */
/* garbage collected memory or manipulate pointers to the */
@@ -902,7 +910,7 @@
/* pointer to the garbage-collected heap to another thread, it must */
/* do this before calling GC_unregister_my_thread, most probably */
/* by saving it in a global data structure. */
-GC_API int GC_unregister_my_thread(void);
+GC_API int GC_CALL GC_unregister_my_thread(void);
/* Attempt to fill in the GC_stack_base structure with the stack base */
/* for this thread. This appears to be required to implement anything */
@@ -910,7 +918,7 @@
/* threads are not automatically registered with the collector.
*/
/* It is also unfortunately hard to implement well on many platforms. */
/* Returns GC_SUCCESS or GC_UNIMPLEMENTED. */
-GC_API int GC_get_stack_base(struct GC_stack_base *);
+GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *);
/* The following routines are primarily intended for use with a */
/* preprocessor which inserts calls to check C pointer arithmetic. */
@@ -921,14 +929,14 @@
/* Returns the first argument. */
/* Succeeds if neither p nor q points to the heap. */
/* May succeed if both p and q point to between heap objects. */
-GC_API void * GC_same_obj (void * p, void * q);
+GC_API void * GC_CALL GC_same_obj (void * p, void * q);
/* Checked pointer pre- and post- increment operations. Note that */
/* the second argument is in units of bytes, not multiples of the */
/* object size. This should either be invoked from a macro, or the */
/* call should be automatically generated. */
-GC_API void * GC_pre_incr (void * *p, ptrdiff_t how_much);
-GC_API void * GC_post_incr (void * *p, ptrdiff_t how_much);
+GC_API void * GC_CALL GC_pre_incr (void * *p, ptrdiff_t how_much);
+GC_API void * GC_CALL GC_post_incr (void * *p, ptrdiff_t how_much);
/* Check that p is visible */
/* to the collector as a possibly pointer containing location. */
@@ -938,19 +946,19 @@
/* untyped allocations. The idea is that it should be possible, though
*/
/* slow, to add such a call to all indirect pointer stores.) */
/* Currently useless for multithreaded worlds. */
-GC_API void * GC_is_visible (void * p);
+GC_API void * GC_CALL GC_is_visible (void * p);
/* Check that if p is a pointer to a heap page, then it points to */
/* a valid displacement within a heap object. */
/* Fail conspicuously if this property does not hold. */
/* Uninteresting with GC_all_interior_pointers.
*/
/* Always returns its argument.
*/
-GC_API void * GC_is_valid_displacement (void * p);
+GC_API void * GC_CALL GC_is_valid_displacement (void * p);
/* Explicitly dump the GC state. This is most often called from the */
/* debugger, or by setting the GC_DUMP_REGULARLY environment variable, */
/* but it may be useful to call it from client code during debugging. */
-GC_API void GC_dump(void);
+GC_API void GC_CALL GC_dump(void);
/* Safer, but slow, pointer addition. Probably useful mainly with */
/* a preprocessor. Useful only for heap pointers. */
@@ -995,11 +1003,11 @@
#endif
/* Functions called to report pointer checking errors */
-GC_API void (*GC_same_obj_print_proc) (void * p, void * q);
+GC_API void (GC_CALLBACK * GC_same_obj_print_proc) (void * p, void * q);
-GC_API void (*GC_is_valid_displacement_print_proc) (void * p);
+GC_API void (GC_CALLBACK * GC_is_valid_displacement_print_proc) (void * p);
-GC_API void (*GC_is_visible_print_proc) (void * p);
+GC_API void (GC_CALLBACK * GC_is_visible_print_proc) (void * p);
/* For pthread support, we generally need to intercept a number of */
@@ -1018,7 +1026,7 @@
/* the allocation lock can be acquired and released many fewer times. */
/* It is used internally by gc_local_alloc.h, which provides a simpler */
/* programming interface on Linux. */
-GC_API void * GC_malloc_many(size_t lb);
+GC_API void * GC_CALL GC_malloc_many(size_t lb);
#define GC_NEXT(p) (*(void * *)(p)) /* Retrieve the next element */
/* in returned list. */
@@ -1029,9 +1037,8 @@
first call a user-supplied routine with filename of the library and
the address and length of the memory region. This routine should
return nonzero if that region should be scanned. */
-GC_API void
-GC_register_has_static_roots_callback
- (int (*callback)(const char *, void *, size_t));
+GC_API void GC_CALL GC_register_has_static_roots_callback
+ (int (GC_CALLBACK * callback)(const char *, void *, size_t));
#if defined(GC_WIN32_THREADS)
@@ -1076,12 +1083,12 @@
typedef uintptr_t GC_uintptr_t;
# endif
- GC_API GC_uintptr_t GC_beginthreadex(
+ GC_API GC_uintptr_t GC_CALL GC_beginthreadex(
void *security, unsigned stack_size,
unsigned ( __stdcall *start_address )( void * ),
void *arglist, unsigned initflag, unsigned *thrdaddr);
- GC_API void GC_endthreadex(unsigned retval);
+ GC_API void GC_CALL GC_endthreadex(unsigned retval);
GC_API void WINAPI GC_ExitThread(DWORD dwExitCode);
@@ -1107,7 +1114,7 @@
* Should be avoided if GC_beginthreadex and friends can be called
* instead.
*/
-GC_API void GC_use_DllMain(void);
+GC_API void GC_CALL GC_use_DllMain(void);
# ifndef GC_NO_THREAD_REDIRECTS
# define CreateThread GC_CreateThread
@@ -1161,7 +1168,7 @@
/* win32S may not free all resources on process exit. */
/* This explicitly deallocates the heap. */
-GC_API void GC_win32_free_heap(void);
+GC_API void GC_CALL GC_win32_free_heap(void);
#if ( defined(_AMIGA) && !defined(GC_AMIGA_MAKINGLIB) )
/* Allocation really goes through GC_amiga_allocwrapper_do */
Index: libgc/include/gc_config_macros.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/gc_config_macros.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- libgc/include/gc_config_macros.h 22 Oct 2008 19:20:18 -0000 1.7
+++ libgc/include/gc_config_macros.h 28 Oct 2008 20:35:34 -0000 1.8
@@ -175,6 +175,13 @@
#endif
#ifndef GC_API
-#define GC_API extern
+# define GC_API extern
#endif
+#ifndef GC_CALL
+# define GC_CALL
+#endif
+
+#ifndef GC_CALLBACK
+# define GC_CALLBACK GC_CALL
+#endif
Index: libgc/include/gc_cpp.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/gc_cpp.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- libgc/include/gc_cpp.h 30 Aug 2008 13:57:44 -0000 1.8
+++ libgc/include/gc_cpp.h 28 Oct 2008 20:35:34 -0000 1.9
@@ -141,7 +141,7 @@
#include "gc.h"
#ifndef THINK_CPLUS
-# define GC_cdecl
+# define GC_cdecl GC_CALLBACK
#else
# define GC_cdecl _cdecl
#endif
@@ -212,7 +212,9 @@
member derived from "gc_cleanup", its destructors will be
invoked. */
-extern "C" {typedef void (*GCCleanUpFunc)( void* obj, void* clientData );}
+extern "C" {
+ typedef void (GC_CALLBACK * GCCleanUpFunc)( void* obj, void* clientData );
+}
#ifdef _MSC_VER
// Disable warning that "no matching operator delete found; memory will
@@ -339,7 +341,7 @@
inline gc_cleanup::~gc_cleanup() {
GC_register_finalizer_ignore_self( GC_base(this), 0, 0, 0, 0 );}
-inline void gc_cleanup::cleanup( void* obj, void* displ ) {
+inline void GC_CALLBACK gc_cleanup::cleanup( void* obj, void* displ ) {
((gc_cleanup*) ((char*) obj + (ptrdiff_t) displ))->~gc_cleanup();}
inline gc_cleanup::gc_cleanup() {
Index: libgc/include/gc_gcj.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/gc_gcj.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- libgc/include/gc_gcj.h 30 Aug 2008 13:57:44 -0000 1.5
+++ libgc/include/gc_gcj.h 28 Oct 2008 20:35:34 -0000 1.6
@@ -58,21 +58,23 @@
/* detect the presence or absence of the debug header. */
/* Mp is really of type mark_proc, as defined in gc_mark.h. We don't */
/* want to include that here for namespace pollution reasons. */
-GC_API void GC_init_gcj_malloc(int mp_index, void * /* really mark_proc */mp);
+GC_API void GC_CALL GC_init_gcj_malloc(int mp_index,
+ void * /* really mark_proc */mp);
/* Allocate an object, clear it, and store the pointer to the */
/* type structure (vtable in gcj). */
/* This adds a byte at the end of the object if GC_malloc would.*/
-GC_API void * GC_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr);
+GC_API void * GC_CALL GC_gcj_malloc(size_t lb,
+ void * ptr_to_struct_containing_descr);
/* The debug versions allocate such that the specified mark_proc */
/* is always invoked. */
-GC_API void * GC_debug_gcj_malloc(size_t lb,
+GC_API void * GC_CALL GC_debug_gcj_malloc(size_t lb,
void * ptr_to_struct_containing_descr,
GC_EXTRA_PARAMS);
/* Similar to GC_gcj_malloc, but assumes that a pointer to near the */
/* beginning of the resulting object is always maintained. */
-GC_API void * GC_gcj_malloc_ignore_off_page(size_t lb,
+GC_API void * GC_CALL GC_gcj_malloc_ignore_off_page(size_t lb,
void * ptr_to_struct_containing_descr);
/* The kind numbers of normal and debug gcj objects. */
Index: libgc/include/gc_mark.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/gc_mark.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libgc/include/gc_mark.h 22 Oct 2008 19:20:18 -0000 1.6
+++ libgc/include/gc_mark.h 28 Oct 2008 20:35:34 -0000 1.7
@@ -180,7 +180,7 @@
/* cause a GC crash if they are accidentally traced. */
void * GC_generic_malloc(size_t lb, int k);
-typedef void (*GC_describe_type_fn) (void *p, char *out_buf);
+typedef void (GC_CALLBACK * GC_describe_type_fn) (void *p, char *out_buf);
/* A procedure which */
/* produces a human-readable */
/* description of the "type" of object */
@@ -194,7 +194,7 @@
/* global free list. */
# define GC_TYPE_DESCR_LEN 40
-void GC_register_describe_type_fn(int kind, GC_describe_type_fn knd);
+void GC_CALL GC_register_describe_type_fn(int kind, GC_describe_type_fn knd);
/* Register a describe_type function */
/* to be used when printing objects */
/* of a particular kind. */
Index: libgc/include/gc_typed.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/gc_typed.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- libgc/include/gc_typed.h 22 Oct 2008 19:20:19 -0000 1.5
+++ libgc/include/gc_typed.h 28 Oct 2008 20:35:34 -0000 1.6
@@ -47,7 +47,7 @@
typedef GC_word GC_descr;
-GC_API GC_descr GC_make_descriptor(GC_bitmap bm, size_t len);
+GC_API GC_descr GC_CALL GC_make_descriptor(GC_bitmap bm, size_t len);
/* Return a type descriptor for the object whose layout */
/* is described by the argument. */
/* The least significant bit of the first word is one */
@@ -74,15 +74,16 @@
/* ... */
/* T_descr = GC_make_descriptor(T_bitmap, GC_WORD_LEN(T)); */
-GC_API void * GC_malloc_explicitly_typed(size_t size_in_bytes, GC_descr d);
+GC_API void * GC_CALL GC_malloc_explicitly_typed(size_t size_in_bytes,
+ GC_descr d);
/* Allocate an object whose layout is described by d. */
/* The resulting object MAY NOT BE PASSED TO REALLOC. */
/* The returned object is cleared. */
-GC_API void * GC_malloc_explicitly_typed_ignore_off_page
+GC_API void * GC_CALL GC_malloc_explicitly_typed_ignore_off_page
(size_t size_in_bytes, GC_descr d);
-GC_API void * GC_calloc_explicitly_typed(size_t nelements,
+GC_API void * GC_CALL GC_calloc_explicitly_typed(size_t nelements,
size_t element_size_in_bytes,
GC_descr d);
/* Allocate an array of nelements elements, each of the */
Index: libgc/include/javaxfc.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/javaxfc.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libgc/include/javaxfc.h 22 Oct 2008 19:20:19 -0000 1.4
+++ libgc/include/javaxfc.h 28 Oct 2008 20:35:34 -0000 1.5
@@ -20,7 +20,7 @@
* probably unlikely.
* Thus this is not recommended for general use.
*/
-GC_API void GC_finalize_all(void);
+GC_API void GC_CALL GC_finalize_all(void);
# ifdef __cplusplus
} /* end of extern "C" */
Index: libgc/include/private/gc_locks.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/private/gc_locks.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- libgc/include/private/gc_locks.h 22 Oct 2008 19:20:20 -0000 1.9
+++ libgc/include/private/gc_locks.h 28 Oct 2008 20:35:34 -0000 1.10
@@ -29,7 +29,7 @@
# ifdef THREADS
# include <atomic_ops.h>
- void GC_noop1(word);
+ GC_API void GC_CALL GC_noop1(word);
# ifdef PCR
# include <base/PCR_Base.h>
# include <th/PCR_Th.h>
Index: libgc/include/private/gc_priv.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/private/gc_priv.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- libgc/include/private/gc_priv.h 22 Oct 2008 19:20:22 -0000 1.10
+++ libgc/include/private/gc_priv.h 28 Oct 2008 20:35:34 -0000 1.11
@@ -1649,7 +1649,7 @@
/* reclaimed bytes to *count. */
GC_bool GC_block_empty(hdr * hhdr);
/* Block completely unmarked? */
-GC_bool GC_never_stop_func(void);
+GC_bool GC_CALLBACK GC_never_stop_func(void);
/* Returns FALSE. */
GC_bool GC_try_to_collect_inner(GC_stop_func f);
@@ -1760,7 +1760,7 @@
/* this procedure yet this GC cycle. */
GC_API void * GC_make_closure(GC_finalization_proc fn, void * data);
-GC_API void GC_debug_invoke_finalizer(void * obj, void * data);
+GC_API void GC_CALLBACK GC_debug_invoke_finalizer(void * obj, void * data);
/* Auxiliary fns to make finalization work */
/* correctly with displaced pointers introduced */
/* by the debugging allocators. */
@@ -1923,7 +1923,7 @@
# endif
# endif
-void GC_noop1(word);
+GC_API void GC_CALL GC_noop1(word);
/* Logging and diagnostic output: */
GC_API void GC_printf (const char * format, ...);
Index: libgc/include/private/thread_local_alloc.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/private/thread_local_alloc.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libgc/include/private/thread_local_alloc.h 31 Jul 2008 19:39:09 -0000
1.1
+++ libgc/include/private/thread_local_alloc.h 28 Oct 2008 20:35:34 -0000
1.2
@@ -133,7 +133,7 @@
/* The thread support layer must arrange to mark thread-local */
/* free lists explicitly, since the link field is often */
-/* invisible to the marker. It knows hoe to find all threads; */
+/* invisible to the marker. It knows how to find all threads; */
/* we take care of an individual thread freelist structure. */
void GC_mark_thread_local_fls_for(GC_tlfs p);
Index: libgc/tests/test.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/tests/test.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- libgc/tests/test.c 22 Oct 2008 19:23:30 -0000 1.7
+++ libgc/tests/test.c 28 Oct 2008 20:35:35 -0000 1.8
@@ -63,9 +63,7 @@
static CRITICAL_SECTION incr_cs;
# endif
-#ifdef __STDC__
# include <stdarg.h>
-#endif
/* Call GC_INIT only on platforms on which we think we really need it, */
/* so that we can test automatic initialization on the rest. */
@@ -128,6 +126,9 @@
# ifdef MSWINCE
# define FAIL DebugBreak()
# else
+# ifdef SMALL_CONFIG
+ void GC_abort(const char * msg);
+# endif
# define FAIL GC_abort("Test failed");
# endif
# endif
@@ -280,7 +281,6 @@
{
GC_word * r;
sexpr result;
- static int count = 0;
r = (GC_word *) GC_GCJ_MALLOC(sizeof(struct SEXPR)
+ sizeof(struct fake_vtable*),
@@ -575,11 +575,8 @@
c = (sexpr)((char *)c + sizeof(char *));
d = (sexpr)((char *)d + sizeof(char *));
-# ifdef __STDC__
GC_FREE((void *)e);
-# else
- GC_FREE((char *)e);
-# endif
+
check_ints(b,1,50);
check_ints(a,1,49);
for (i = 0; i < 50; i++) {
@@ -637,13 +634,7 @@
int finalized_count = 0;
volatile int dropped_something = 0;
-# ifdef __STDC__
- void finalizer(void * obj, void * client_data)
-# else
- void finalizer(obj, client_data)
- char * obj;
- char * client_data;
-# endif
+void GC_CALLBACK finalizer(void * obj, void * client_data)
{
tn * t = (tn *)obj;
@@ -981,18 +972,8 @@
int fail_count = 0;
-#ifndef __STDC__
-/*ARGSUSED*/
-void fail_proc1(x)
-void * x;
-{
- fail_count++;
-}
-
-#else
-
/*ARGSUSED*/
-void fail_proc1(void * x)
+void GC_CALLBACK fail_proc1(void * x)
{
fail_count++;
}
@@ -1003,7 +984,7 @@
int n = 0, i, j;
q[n++] = p;
va_start(a,p);
- for (;(q[n] = va_arg(a,void *));n++) ;
+ for (;(q[n] = va_arg(a,void *)) != NULL;n++) ;
va_end(a);
for (i=0; i<n; i++)
for (j=0; j<i; j++)
@@ -1016,8 +997,6 @@
}
}
-#endif /* __STDC__ */
-
#ifdef THREADS
# define TEST_FAIL_COUNT(n) 1
#else
@@ -1026,6 +1005,7 @@
void run_one_test()
{
+# ifndef DBG_HDRS_ALL
char *x;
char **z;
# ifdef LINT
@@ -1033,9 +1013,10 @@
# else
char *y = (char *)(size_t)fail_proc1;
# endif
+ CLOCK_TYPE typed_time;
+# endif
CLOCK_TYPE start_time;
CLOCK_TYPE reverse_time;
- CLOCK_TYPE typed_time;
CLOCK_TYPE tree_time;
unsigned long time_diff;
DCL_LOCK_STATE;
@@ -1117,7 +1098,7 @@
"GC_is_valid_displacement produced incorrect result\n");
FAIL;
}
-# if defined(__STDC__) && !defined(MSWIN32) && !defined(MSWINCE)
+# if !defined(MSWIN32) && !defined(MSWINCE)
/* Harder to test under Windows without a gc.h declaration. */
{
size_t i;
@@ -1134,8 +1115,8 @@
# if defined(RS6000) || defined(POWERPC)
if (!TEST_FAIL_COUNT(1)) {
# else
- if (GC_all_interior_pointers && !TEST_FAIL_COUNT(1)
- || !GC_all_interior_pointers && !TEST_FAIL_COUNT(2)) {
+ if ((GC_all_interior_pointers && !TEST_FAIL_COUNT(1))
+ || (!GC_all_interior_pointers && !TEST_FAIL_COUNT(2))) {
# endif
GC_printf("GC_is_valid_displacement produced wrong failure
indication\n");
FAIL;
@@ -1161,7 +1142,6 @@
GC_init_gcj_malloc(0, (void *)fake_gcj_mark_proc);
# endif
/* Make sure that fn arguments are visible to the collector. */
-# ifdef __STDC__
uniq(
GC_malloc(12), GC_malloc(12), GC_malloc(12),
(GC_gcollect(),GC_malloc(12)),
@@ -1174,7 +1154,6 @@
GC_malloc(12), GC_malloc(12), GC_malloc(12),
(GC_gcollect(),GC_malloc(12)),
(void *)0);
-# endif
/* GC_malloc(0) must return NULL or something we can deallocate. */
GC_free(GC_malloc(0));
GC_free(GC_malloc_atomic(0));
@@ -1335,13 +1314,7 @@
#endif
-#ifdef __STDC__
- void warn_proc(char *msg, GC_word p)
-#else
- void warn_proc(msg, p)
- char *msg;
- GC_word p;
-#endif
+void GC_CALLBACK warn_proc(char *msg, GC_word p)
{
GC_printf(msg, (unsigned long)p);
/*FAIL;*/
Index: libgc/build_atomic_ops.sh
===================================================================
RCS file: libgc/build_atomic_ops.sh
diff -N libgc/build_atomic_ops.sh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libgc/build_atomic_ops.sh 28 Oct 2008 20:35:32 -0000 1.1
@@ -0,0 +1,5 @@
+#!/bin/sh
+P=`pwd`/libatomic_ops-install
+cd libatomic_ops-*[0-9]
+./configure --prefix=$P
+$MAKE CC=$CC install
Index: libgc/build_atomic_ops.sh.cygwin
===================================================================
RCS file: libgc/build_atomic_ops.sh.cygwin
diff -N libgc/build_atomic_ops.sh.cygwin
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libgc/build_atomic_ops.sh.cygwin 28 Oct 2008 20:35:32 -0000 1.1
@@ -0,0 +1,14 @@
+#!/bin/sh
+# We install through the temporary directory in case pwd contains spaces,
+# which otherwise breaks the build machinery.
+# This is a gross hack and probably breaks incremental rebuilds
+mkdir libatomic_ops-install
+P=`pwd`
+Q=`mktemp -d`
+ln -s "$P" $Q/dir
+cd $Q/dir/libatomic_ops-*[0-9]
+./configure --prefix=$Q/dir/libatomic_ops-install
+$MAKE CC=$CC install
+cd /
+rm $Q/dir
+rmdir $Q
Index: libgc/configure_atomic_ops.sh
===================================================================
RCS file: libgc/configure_atomic_ops.sh
diff -N libgc/configure_atomic_ops.sh
--- libgc/configure_atomic_ops.sh 31 Jul 2008 19:39:05 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,4 +0,0 @@
-#!/bin/sh
-P=`pwd`/libatomic_ops-install
-cd libatomic_ops-*[0-9]
-./configure --prefix=$P
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog libgc/ChangeLog libgc/Makefile.a...,
Klaus Treichel <=