diff options
author | hboehm <hboehm> | 2007-08-04 05:59:28 +0000 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2011-07-26 21:06:41 +0400 |
commit | 6db625e8a2a7d5d8b4faf8747b5688cd64f3949e (patch) | |
tree | 3f134e0ad5908487eafbfebf768b949d0ee9c468 | |
parent | 03fd483a45856f6a1ea12544b19c51fa9a57a6d5 (diff) | |
download | bdwgc-6db625e8a2a7d5d8b4faf8747b5688cd64f3949e.tar.gz |
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.
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | Makefile.direct | 2 | ||||
-rw-r--r-- | Makefile.in | 20 | ||||
-rwxr-xr-x | configure | 6 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | include/private/gcconfig.h | 11 | ||||
-rw-r--r-- | include/private/thread_local_alloc.h | 4 | ||||
-rw-r--r-- | obj_map.c | 2 | ||||
-rw-r--r-- | pthread_support.c | 2 | ||||
-rw-r--r-- | tests/smash_test.c | 28 | ||||
-rw-r--r-- | tests/tests.am | 5 |
11 files changed, 83 insertions, 14 deletions
@@ -1,3 +1,17 @@ +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() diff --git a/Makefile.direct b/Makefile.direct index 3d611aa7..e84959cc 100644 --- a/Makefile.direct +++ b/Makefile.direct @@ -214,8 +214,6 @@ HOSTCFLAGS=$(CFLAGS) # 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 diff --git a/Makefile.in b/Makefile.in index f4dbe12d..e07d04dd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -96,7 +96,7 @@ build_triplet = @build@ 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 # --------------------------------- @@ -191,6 +191,9 @@ leaktest_DEPENDENCIES = $(am__DEPENDENCIES_2) 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) @@ -227,12 +230,12 @@ CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ 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 \ @@ -491,7 +494,7 @@ dist_noinst_HEADERS = version.h include/private/gc_hdrs.h \ 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 \ @@ -555,6 +558,8 @@ leaktest_SOURCES = tests/leak_test.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 @@ -709,6 +714,11 @@ tests/middle.$(OBJEXT): tests/$(am__dirstamp) \ 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) @@ -732,6 +742,7 @@ mostlyclean-compile: -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) @@ -778,6 +789,7 @@ distclean-compile: @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@ @@ -1,5 +1,5 @@ #! /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. # @@ -21540,6 +21540,10 @@ _ACEOF _ACEOF fi + cat >>confdefs.h <<\_ACEOF +#define GC_USE_DLOPEN_WRAP 1 +_ACEOF + fi # Check whether --enable-large-config was given. diff --git a/configure.ac b/configure.ac index 7ef69b53..ebe3dea7 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ AC_INIT(gc,7.1alpha1,Hans.Boehm@hp.com) 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 @@ -527,6 +527,7 @@ if test "${enable_redirect_malloc}" = yes; then else AC_DEFINE(REDIRECT_MALLOC, GC_malloc) fi + AC_DEFINE(GC_USE_DLOPEN_WRAP) fi AC_ARG_ENABLE(large-config, diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index 20f35bc3..a41da409 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -1995,13 +1995,18 @@ /* 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 diff --git a/include/private/thread_local_alloc.h b/include/private/thread_local_alloc.h index 4c2c5362..90a246a0 100644 --- a/include/private/thread_local_alloc.h +++ b/include/private/thread_local_alloc.h @@ -109,7 +109,9 @@ typedef struct thread_local_freelists { /* 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; @@ -60,7 +60,7 @@ GC_bool GC_add_map_entry(size_t granules) 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++) { diff --git a/pthread_support.c b/pthread_support.c index 955eea2d..df8e4b21 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -728,7 +728,7 @@ void GC_thr_init(void) # 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. */ { diff --git a/tests/smash_test.c b/tests/smash_test.c new file mode 100644 index 00000000..b94af907 --- /dev/null +++ b/tests/smash_test.c @@ -0,0 +1,28 @@ +/* + * 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; +} + diff --git a/tests/tests.am b/tests/tests.am index aedac1fa..d649d178 100644 --- a/tests/tests.am +++ b/tests/tests.am @@ -36,6 +36,11 @@ check_PROGRAMS += middletest 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 |