From: hboehm Date: Thu, 28 Jun 2007 21:23:45 +0000 (+0000) Subject: 2007-06-28 Hans Boehm X-Git-Tag: gc7_0~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=03946ca31b518c05cd3b0a02fc2ccab658dee4d2;p=gc 2007-06-28 Hans Boehm * Makefile.am: Use -no-undefined for libgc. * Makefile.in: Regenerate. * Makefile.direct: Document USE_PROC_FOR_LIBRARIES. * dyn_load.c (GC_register_map_entries): Rename prot_buf to prot consistently. * misc.c: Fix some WARN calls. Move GC_is_initialized setting and GC_thr_init() call. * os_dep.c: Consistently use WARN where appropriate. * thread_local_alloc.c: Revert change to GC_WIN32_THREADS test. Instead remove inappropriate pthread.h include. * doc/README.linux: Remove some anachronisms. * libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/powerpc.h (AO_load_acquire): Add 64-bit version. --- diff --git a/ChangeLog b/ChangeLog index 48653254..9069d6a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2007-06-28 Hans Boehm + + * Makefile.am: Use -no-undefined for libgc. + * Makefile.in: Regenerate. + * Makefile.direct: Document USE_PROC_FOR_LIBRARIES. + * dyn_load.c (GC_register_map_entries): Rename prot_buf to prot + consistently. + * misc.c: Fix some WARN calls. Move GC_is_initialized setting and + GC_thr_init() call. + * os_dep.c: Consistently use WARN where appropriate. + * thread_local_alloc.c: Revert change to GC_WIN32_THREADS test. Instead + remove inappropriate pthread.h include. + * doc/README.linux: Remove some anachronisms. + 2007-06-23 Hans Boehm * alloc.c: Also use GC_check_tls on non-Linux systems. diff --git a/Makefile.am b/Makefile.am index 23ab2602..e632864d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -83,8 +83,7 @@ endif # linuxthread semaphore functions get linked: libgc_la_LIBADD = @addobjs@ $(THREADDLLIBS) $(UNWINDLIBS) libgc_la_DEPENDENCIES = @addobjs@ -libgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:3:0 -# -no-undefined doesn't work here, since we get a reference to __tls_get_addr. +libgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:3:0 -no-undefined EXTRA_libgc_la_SOURCES = alpha_mach_dep.S \ mips_sgi_mach_dep.s mips_ultrix_mach_dep.s \ diff --git a/Makefile.direct b/Makefile.direct index 64f26f61..40195a56 100644 --- a/Makefile.direct +++ b/Makefile.direct @@ -312,6 +312,13 @@ HOSTCFLAGS=$(CFLAGS) # stack bounds in the same way as other pthread ports, without trying to # walk the frames onthe stack. This is recommended only as a fallback # for applications that don't support proper stack unwinding. +# -DUSE_PROC_FOR_LIBRARIES Causes the Linux collector to treat writable +# memory mappings (as reported by /proc) as roots, if it doesn't have +# otherinformation about them. It no longer traverses dynamic loader +# data structures to find dynamic library static data. This may be +# required for applications that store pointers in mmapped segments without +# informaing the collector. But it typically performs poorly, especially +# since it will scan inactive but cached NPTL thread stacks completely. # CXXFLAGS= $(CFLAGS) diff --git a/Makefile.in b/Makefile.in index ff03b065..f4dbe12d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -508,8 +508,7 @@ libgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \ # linuxthread semaphore functions get linked: libgc_la_LIBADD = @addobjs@ $(THREADDLLIBS) $(UNWINDLIBS) libgc_la_DEPENDENCIES = @addobjs@ -libgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:3:0 -# -no-undefined doesn't work here, since we get a reference to __tls_get_addr. +libgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:3:0 -no-undefined EXTRA_libgc_la_SOURCES = alpha_mach_dep.S \ mips_sgi_mach_dep.s mips_ultrix_mach_dep.s \ rs6000_mach_dep.s sparc_mach_dep.S sparc_netbsd_mach_dep.s \ diff --git a/doc/README.linux b/doc/README.linux index 99f4bbcd..3c501814 100644 --- a/doc/README.linux +++ b/doc/README.linux @@ -55,17 +55,16 @@ To use threads, you need to abide by the following requirements: conditions, this may cause unexpected heap growth. 5) The combination of GC_LINUX_THREADS, REDIRECT_MALLOC, and incremental - collection fails in seemingly random places. This hasn't been tracked - down yet, but is perhaps not completely astonishing. The thread package - uses malloc, and thus can presumably get SIGSEGVs while inside the - package. There is no real guarantee that signals are handled properly - at that point. + collection is probably not fully reliable, though it now seems to work + in simple cases. 6) Thread local storage may not be viewed as part of the root set by the collector. This probably depends on the linuxthreads version. For the time being, any collectable memory referenced by thread local storage should also be referenced from elsewhere, or be allocated as uncollectable. - (This is really a bug that should be fixed somehow.) + (This is really a bug that should be fixed somehow. The current GC + version probably gets things right if there are not too many tls locations + and if dlopen is not used.) M68K LINUX: diff --git a/dyn_load.c b/dyn_load.c index 7094fcaf..7deb2ccf 100644 --- a/dyn_load.c +++ b/dyn_load.c @@ -241,7 +241,7 @@ char *GC_get_maps(void); word GC_register_map_entries(char *maps) { - char *prot_buf; + char *prot; char *buf_ptr = maps; int count; ptr_t start, end; diff --git a/misc.c b/misc.c index a26f95e0..37e50933 100644 --- a/misc.c +++ b/misc.c @@ -576,7 +576,7 @@ void GC_init_inner() long addr = strtoul(addr_string, NULL, 16); # endif if (addr < 0x1000) - WARN("Unlikely trace address: 0x%lx", (unsigned long)addr); + WARN("Unlikely trace address: 0x%lx\n", (GC_word)addr); GC_trace_addr = (ptr_t)addr; # endif } @@ -621,7 +621,7 @@ void GC_init_inner() GC_init_win32(); # endif # if defined(USE_PROC_FOR_LIBRARIES) && defined(GC_LINUX_THREADS) - WARN("USE_PROC_FOR_LIBRARIES + GC_LINUX_THREADS performs poorly.", 0); + WARN("USE_PROC_FOR_LIBRARIES + GC_LINUX_THREADS performs poorly.\n", 0); /* If thread stacks are cached, they tend to be scanned in */ /* entirety as part of the root set. This wil grow them to */ /* maximum size, and is generally not desirable. */ @@ -632,10 +632,6 @@ void GC_init_inner() # if (defined(NETBSD) || defined(OPENBSD)) && defined(__ELF__) GC_init_netbsd_elf(); # endif -# if defined(GC_PTHREADS) || defined(GC_SOLARIS_THREADS) \ - || defined(GC_WIN32_THREADS) - GC_thr_init(); -# endif # if !defined(THREADS) || defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) \ || defined(GC_SOLARIS_THREADS) if (GC_stackbottom == 0) { @@ -646,7 +642,7 @@ void GC_init_inner() } else { # if (defined(LINUX) || defined(HPUX)) && defined(IA64) if (GC_register_stackbottom == 0) { - WARN("GC_register_stackbottom should be set with GC_stackbottom", 0); + WARN("GC_register_stackbottom should be set with GC_stackbottom\n", 0); /* The following may fail, since we may rely on */ /* alignment properties that may not hold with a user set */ /* GC_stackbottom. */ @@ -736,11 +732,14 @@ void GC_init_inner() } PCR_IL_Unlock(); GC_pcr_install(); +# endif + GC_is_initialized = TRUE; +# if defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) + GC_thr_init(); # endif COND_DUMP; /* Get black list set up and/or incremental GC started */ if (!GC_dont_precollect || GC_incremental) GC_gcollect_inner(); - GC_is_initialized = TRUE; # ifdef STUBBORN_ALLOC GC_stubborn_init(); # endif diff --git a/os_dep.c b/os_dep.c index a1293f10..9ddba06c 100644 --- a/os_dep.c +++ b/os_dep.c @@ -3687,7 +3687,7 @@ static void GC_darwin_sigbus(int num, siginfo_t *sip, void *context) ABORT("Got more than 8 SIGBUSs in a row!"); } else { GC_sigbus_count++; - GC_err_printf("GC: WARNING: Ignoring SIGBUS.\n"); + WARN("Ignoring SIGBUS.\n", 0); } } #endif /* BROKEN_EXCEPTION_HANDLING */ @@ -3704,8 +3704,8 @@ void GC_dirty_init(void) GC_log_printf("Inititalizing mach/darwin mprotect virtual dirty bit " "implementation\n"); # ifdef BROKEN_EXCEPTION_HANDLING - GC_err_printf("GC: WARNING: Enabling workarounds for various darwin " - "exception handling bugs.\n"); + WARN("Enabling workarounds for various darwin " + "exception handling bugs.\n", 0); # endif GC_dirty_maintained = TRUE; if (GC_page_size % HBLKSIZE != 0) { @@ -3921,8 +3921,7 @@ catch_exception_raise(mach_port_t exception_port, mach_port_t thread, } if(++last_fault_count < 32) { if(last_fault_count == 1) - GC_err_printf("GC: WARNING: Ignoring KERN_PROTECTION_FAILURE" - "at %p\n", addr); + WARN("Ignoring KERN_PROTECTION_FAILURE at %lx\n", (GC_word)addr); return KERN_SUCCESS; } diff --git a/thread_local_alloc.c b/thread_local_alloc.c index 843700fe..f747b355 100644 --- a/thread_local_alloc.c +++ b/thread_local_alloc.c @@ -130,8 +130,7 @@ void GC_destroy_thread_local(GC_tlfs p) extern char * GC_lookup_thread(pthread_t id); #endif -#if defined(GC_ASSERTIONS) && !defined(GC_WIN32_THREADS) -# include +#if defined(GC_ASSERTIONS) && defined(GC_WIN32_THREADS) extern char * GC_lookup_thread(int id); #endif