* Makefile.direct: Remove comment fragment.
* tests/tests.am: Add smashtest.
* Makefile.in: Regenerate.
* configure.ac: Define GC_USE_DLOPEN_WRAP with redirect-malloc.
* configure: Regenerate.
* pthread_support.c: Fix comment spelling.
* include/private/gcconfig.h: Define USE_PROC_FOR_LIBRARIES with
GC_LINUX_THREADS and REDIRECT_MALLOC.
* tests/smash_test.c: Initial check-in.
* obj_map.c: Print log entry to correct file.
* include/private/thread_local_alloc.h: Add TlsAlloc error check.
+2007-08-03 Hans Boehm <Hans.Boehm@hp.com>
+
+ * Makefile.direct: Remove comment fragment.
+ * tests/tests.am: Add smashtest.
+ * Makefile.in: Regenerate.
+ * configure.ac: Define GC_USE_DLOPEN_WRAP with redirect-malloc.
+ * configure: Regenerate.
+ * pthread_support.c: Fix comment spelling.
+ * include/private/gcconfig.h: Define USE_PROC_FOR_LIBRARIES with
+ GC_LINUX_THREADS and REDIRECT_MALLOC.
+ * tests/smash_test.c: Initial check-in.
+ * obj_map.c: Print log entry to correct file.
+ * include/private/thread_local_alloc.h: Add TlsAlloc error check.
+
2007-07-23 Hans Boehm <Hans.Boehm@hp.com>
* alloc.c (GC_stopped_mark): Call GC_add_current_malloc_heap()
# the GC_debug_ functions, or through the macros that expand to these,
# or by redirecting malloc to GC_debug_malloc_replacement.
# (Also eliminates the field for the requested object size.)
-# occasionally be useful for debugging of client code. Slows down the
-# collector somewhat, but not drastically.
# -DSAVE_CALL_COUNT=<n> Set the number of call frames saved with objects
# allocated through the debugging interface. Affects the amount of
# information generated in leak reports. Only matters on platforms
host_triplet = @host@
target_triplet = @target@
check_PROGRAMS = gctest$(EXEEXT) leaktest$(EXEEXT) middletest$(EXEEXT) \
- $(am__EXEEXT_1) $(am__EXEEXT_2)
+ smashtest$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2)
# C Library: Architecture Dependent
# ---------------------------------
am_middletest_OBJECTS = tests/middle.$(OBJEXT)
middletest_OBJECTS = $(am_middletest_OBJECTS)
middletest_DEPENDENCIES = $(am__DEPENDENCIES_2)
+am_smashtest_OBJECTS = tests/smash_test.$(OBJEXT)
+smashtest_OBJECTS = $(am_smashtest_OBJECTS)
+smashtest_DEPENDENCIES = $(am__DEPENDENCIES_2)
am__test_cpp_SOURCES_DIST = tests/test_cpp.cc
@CPLUSPLUS_TRUE@am_test_cpp_OBJECTS = tests/test_cpp.$(OBJEXT)
test_cpp_OBJECTS = $(am_test_cpp_OBJECTS)
SOURCES = $(libcord_la_SOURCES) $(libgc_la_SOURCES) \
$(EXTRA_libgc_la_SOURCES) $(nodist_libgc_la_SOURCES) \
$(libgccpp_la_SOURCES) $(gctest_SOURCES) $(leaktest_SOURCES) \
- $(middletest_SOURCES) $(test_cpp_SOURCES) \
+ $(middletest_SOURCES) $(smashtest_SOURCES) $(test_cpp_SOURCES) \
$(threadleaktest_SOURCES)
DIST_SOURCES = $(libcord_la_SOURCES) $(am__libgc_la_SOURCES_DIST) \
$(EXTRA_libgc_la_SOURCES) $(am__libgccpp_la_SOURCES_DIST) \
$(gctest_SOURCES) $(leaktest_SOURCES) $(middletest_SOURCES) \
- $(am__test_cpp_SOURCES_DIST) \
+ $(smashtest_SOURCES) $(am__test_cpp_SOURCES_DIST) \
$(am__threadleaktest_SOURCES_DIST)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
include/private/thread_local_alloc.h include/cord.h \
include/ec.h include/javaxfc.h
TESTS = gctest$(EXEEXT) leaktest$(EXEEXT) middletest$(EXEEXT) \
- $(am__append_6) $(am__append_8)
+ smashtest$(EXEEXT) $(am__append_6) $(am__append_8)
pkgconfigdir = $(libdir)/pkgconfig
dist_pkgconfig_DATA = bdw-gc.pc
libgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \
leaktest_LDADD = $(test_ldadd)
middletest_SOURCES = tests/middle.c
middletest_LDADD = $(test_ldadd)
+smashtest_SOURCES = tests/smash_test.c
+smashtest_LDADD = $(test_ldadd)
@THREADS_TRUE@threadleaktest_SOURCES = tests/thread_leak_test.c
@THREADS_TRUE@threadleaktest_LDADD = $(test_ldadd)
@CPLUSPLUS_TRUE@test_cpp_SOURCES = tests/test_cpp.cc
middletest$(EXEEXT): $(middletest_OBJECTS) $(middletest_DEPENDENCIES)
@rm -f middletest$(EXEEXT)
$(LINK) $(middletest_LDFLAGS) $(middletest_OBJECTS) $(middletest_LDADD) $(LIBS)
+tests/smash_test.$(OBJEXT): tests/$(am__dirstamp) \
+ tests/$(DEPDIR)/$(am__dirstamp)
+smashtest$(EXEEXT): $(smashtest_OBJECTS) $(smashtest_DEPENDENCIES)
+ @rm -f smashtest$(EXEEXT)
+ $(LINK) $(smashtest_LDFLAGS) $(smashtest_OBJECTS) $(smashtest_LDADD) $(LIBS)
tests/test_cpp.$(OBJEXT): tests/$(am__dirstamp) \
tests/$(DEPDIR)/$(am__dirstamp)
test_cpp$(EXEEXT): $(test_cpp_OBJECTS) $(test_cpp_DEPENDENCIES)
-rm -f cord/cordxtra.lo
-rm -f tests/leak_test.$(OBJEXT)
-rm -f tests/middle.$(OBJEXT)
+ -rm -f tests/smash_test.$(OBJEXT)
-rm -f tests/test.$(OBJEXT)
-rm -f tests/test_cpp.$(OBJEXT)
-rm -f tests/thread_leak_test.$(OBJEXT)
@AMDEP_TRUE@@am__include@ @am__quote@cord/$(DEPDIR)/cordxtra.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/leak_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/middle.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/smash_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test_cpp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/thread_leak_test.Po@am__quote@
#! /bin/sh
-# From configure.ac Revision: 1.26 .
+# From configure.ac Revision: 1.27 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for gc 7.1alpha1.
#
_ACEOF
fi
+ cat >>confdefs.h <<\_ACEOF
+#define GC_USE_DLOPEN_WRAP 1
+_ACEOF
+
fi
# Check whether --enable-large-config was given.
AC_CONFIG_SRCDIR(gcj_mlc.c)
AC_CANONICAL_TARGET
AC_PREREQ(2.53)
-AC_REVISION($Revision: 1.27 $)
+AC_REVISION($Revision: 1.28 $)
GC_SET_VERSION
AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects nostdinc])
AM_MAINTAINER_MODE
else
AC_DEFINE(REDIRECT_MALLOC, GC_malloc)
fi
+ AC_DEFINE(GC_USE_DLOPEN_WRAP)
fi
AC_ARG_ENABLE(large-config,
/* large. Sometimes we're lucky and the process just dies ... */
/* There seems to be a similar issue with some other memory */
/* allocated by the dynamic loader. */
- /* This can be avoided by either: */
+ /* This should be avoidable by either: */
/* - Defining USE_PROC_FOR_LIBRARIES here. */
/* That performs very poorly, precisely because we end up */
/* scanning cached stacks. */
- /* - Have calloc look at its callers. That is currently what we do.*/
+ /* - Have calloc look at its callers. */
/* In spite of the fact that it is gross and disgusting. */
-/* # define USE_PROC_FOR_LIBRARIES */
+ /* In fact neither seems to suffice, probably in part because */
+ /* even with USE_PROC_FOR_LIBRARIES, we don't scan parts of stack */
+ /* segments that appear to be out of bounds. Thus we actually */
+ /* do both, which seems to yield the best results. */
+
+# define USE_PROC_FOR_LIBRARIES
#endif
# ifndef STACK_GROWS_UP
/* We assume 0 == success, msft does the opposite. */
# define GC_key_create(key, d) \
((d) != 0? (ABORT("Destructor unsupported by TlsAlloc"),0) \
- : (*(key) = TlsAlloc(), 0))
+ : ((*(key) = TlsAlloc()) == TLS_OUT_OF_INDEXES? \
+ (ABORT("Out of tls"), 0): \
+ 0))
# define GC_remove_specific(key) /* No need for cleanup on thread exit. */
/* Need TlsFree on process exit/detach ? */
typedef DWORD GC_key_t;
new_map = (short *)GC_scratch_alloc(MAP_LEN * sizeof(short));
if (new_map == 0) return(FALSE);
if (GC_print_stats)
- GC_printf("Adding block map for size of %u granules (%u bytes)\n",
+ GC_log_printf("Adding block map for size of %u granules (%u bytes)\n",
(unsigned)granules, (unsigned)(GRANULES_TO_BYTES(granules)));
if (granules == 0) {
for (displ = 0; displ < BYTES_TO_GRANULES(HBLKSIZE); displ++) {
# endif /* HANDLE_FORK */
# if defined(INCLUDE_LINUX_THREAD_DESCR)
/* Explicitly register the region including the address */
- /* of a thread local variable. This should included thread */
+ /* of a thread local variable. This should include thread */
/* locals for the main thread, except for those allocated */
/* in response to dlopen calls. */
{
--- /dev/null
+/*
+ * Test that overwrite error detection works reasonably.
+ */
+#define GC_DEBUG
+#include <gc.h>
+#include <stdio.h>
+
+#define COUNT 7000
+#define SIZE 40
+
+char * A[COUNT];
+
+int main ()
+{
+ int i;
+ char *p;
+
+ GC_INIT();
+
+ for (i = 0; i < COUNT; ++i) {
+ A[i] = p = GC_MALLOC(SIZE);
+
+ if (i%3000 == 0) GC_gcollect();
+ if (i%5678 == 0) p[SIZE + i/2000] = 42;
+ }
+ return 0;
+}
+
middletest_SOURCES = tests/middle.c
middletest_LDADD = $(test_ldadd)
+TESTS += smashtest$(EXEEXT)
+check_PROGRAMS += smashtest
+smashtest_SOURCES = tests/smash_test.c
+smashtest_LDADD = $(test_ldadd)
+
#TESTS += tracetest$(EXEEXT)
#check_PROGRAMS += tracetest
#tracetest_SOURCES = tests/trace_test.c