From 44a3b48838fdfeb8b0bfce884edf0a83561d2742 Mon Sep 17 00:00:00 2001 From: hboehm Date: Tue, 29 Jan 2008 19:24:58 +0000 Subject: [PATCH] 2008-01-29 Hans Boehm (with help from Manuel Serrano) * mark.c (GC_push_next_marked): correct comment. * Makefile.direct: document NO_PROC_STAT. * include/private/gcconfig.h: Accomodate NO_PROC_STAT. --- ChangeLog | 6 ++++++ Makefile.direct | 2 ++ include/private/gcconfig.h | 14 +++++++++++++- mark.c | 3 ++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f25ec6d..026d0521 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-01-29 Hans Boehm (with help from Manuel Serrano) + + * mark.c (GC_push_next_marked): correct comment. + * Makefile.direct: document NO_PROC_STAT. + * include/private/gcconfig.h: Accomodate NO_PROC_STAT. + 2008-01-10 Hans Boehm * include/gc_version.h, configure.ac, doc/README: diff --git a/Makefile.direct b/Makefile.direct index d9c5af1a..765217f8 100644 --- a/Makefile.direct +++ b/Makefile.direct @@ -318,6 +318,8 @@ HOSTCFLAGS=$(CFLAGS) # 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. +# -DNO_PROC_STAT Causes the collector to avoid relying on Linux' +# /proc/self/stat. # CXXFLAGS= $(CFLAGS) diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index 86b86a77..3a0f4523 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -558,7 +558,9 @@ * If STACKBOTTOM is defined, then it's value will be used directly as the * stack base. If LINUX_STACKBOTTOM is defined, then it will be determined * with a method appropriate for most Linux systems. Currently we look - * first for __libc_stack_end, and if that fails read it from /proc. + * first for __libc_stack_end (currently only id USE_LIBC_PRIVATES is + * defined), and if that fails read it from /proc. (If USE_LIBC_PRIVATES + * is not defined and NO_PROC_STAT is defined, we revert to HEURISTIC2.) * If either of the last two macros are defined, then STACKBOTTOM is computed * during collector startup using one of the following two heuristics: * HEURISTIC1: Take an address inside GC_init's frame, and round it up to @@ -1982,6 +1984,16 @@ # endif # endif +#if defined(LINUX_STACKBOTTOM) && defined(NO_PROC_STAT) \ + && !defined(USE_LIBC_PRIVATES) + /* This combination will fail, since we have no way to get */ + /* the stack base. Use HEURISTIC2 instead. */ +# undef LINUX_STACKBOTTOM +# define HEURISTIC2 + /* This may still fail on some architectures like IA64. */ + /* We tried ... */ +#endif + #if defined(LINUX) && defined(USE_MMAP) /* The kernel may do a somewhat better job merging mappings etc. */ /* with anonymous mappings. */ diff --git a/mark.c b/mark.c index 3e5c46d1..a82b7f06 100644 --- a/mark.c +++ b/mark.c @@ -1798,7 +1798,8 @@ GC_bool GC_block_was_dirty(struct hblk *h, hdr *hhdr) } #endif /* SMALL_CONFIG */ -/* Similar to GC_push_next_marked, but return address of next block */ +/* Similar to GC_push_marked, but skip over unallocated blocks */ +/* and return address of next plausible block. */ struct hblk * GC_push_next_marked(struct hblk *h) { hdr * hhdr = HDR(h); -- 2.40.0