From: hboehm Date: Tue, 22 Jul 2008 00:29:00 +0000 (+0000) Subject: 2008-07-21 Hans Boehm X-Git-Tag: gc7_2alpha2~71 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1867d249698c81214418b2cf9752a987abb7b4f2;p=gc 2008-07-21 Hans Boehm * Makefile.direct, mach_dep.c: Add support for NO_GETCONTEXT. * mach_dep.c: Include signal.h. * gc_priv.h: Factor out INLINE declaration. --- diff --git a/ChangeLog b/ChangeLog index 47e1d3f4..03a3dd58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-07-21 Hans Boehm + * Makefile.direct, mach_dep.c: Add support for NO_GETCONTEXT. + * mach_dep.c: Include signal.h. + * gc_priv.h: Factor out INLINE declaration. + 2008-07-03 Hans Boehm (Really mostly Thiemo Seufer) * include/private/gcconfig.h: Update MIPS/LINUX config. diff --git a/Makefile.direct b/Makefile.direct index 23b0ab36..32112b19 100644 --- a/Makefile.direct +++ b/Makefile.direct @@ -320,6 +320,10 @@ HOSTCFLAGS=$(CFLAGS) # 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. +# -DNO_GETCONTEXT Causes the collector to not assume the existence of +# the getcontext() function on linux-like platforms. This currently +# happens implicitly on Darwin, Hurd, or ARM or MIPS hardware. +# It is explicitly needed for some old versions of FreeBSD. # CXXFLAGS= $(CFLAGS) diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 1d96d87c..88c87f6b 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -75,9 +75,13 @@ typedef char * ptr_t; /* A generic pointer to which we can add */ #if __GNUC__ >= 3 # define EXPECT(expr, outcome) __builtin_expect(expr,outcome) /* Equivalent to (expr), but predict that usually (expr)==outcome. */ -# define INLINE inline #else # define EXPECT(expr, outcome) (expr) +#endif /* __GNUC__ */ + +#if __GNUC__ >= 3 +# define INLINE inline +#else # define INLINE #endif /* __GNUC__ */ diff --git a/mach_dep.c b/mach_dep.c index d828a71b..e961f433 100644 --- a/mach_dep.c +++ b/mach_dep.c @@ -160,9 +160,14 @@ void GC_push_regs() #endif #if !defined(HAVE_PUSH_REGS) && defined(UNIX_LIKE) +# include # include #endif +#if defined(UNIX_LIKE) && !defined(NO_GETCONTEXT) && \ + (defined(DARWIN) || defined(HURD) || defined(ARM32) || defined(MIPS)) +# 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. */ @@ -174,8 +179,7 @@ void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *), # if defined(HAVE_PUSH_REGS) GC_push_regs(); -# elif defined(UNIX_LIKE) && !defined(DARWIN) && !defined(ARM32) && \ - !defined(MIPS) && !defined(HURD) +# elif defined(UNIX_LIKE) && !defined(NO_GETCONTEXT) /* Older versions of Darwin seem to lack getcontext(). */ /* ARM and MIPS Linux often doesn't support a real */ /* getcontext(). */