Mercurial > emacs
diff src/alloc.c @ 112125:4dbda0e7c8bf
Use __builtin_unwind_init if available
* configure.in: Check for __builtin_unwind_init.
* src/alloc.c (mark_stack): Use __builtin_unwind_init if available.
author | Andreas Schwab <schwab@linux-m68k.org> |
---|---|
date | Wed, 05 Jan 2011 14:09:07 +0100 |
parents | a5a188ddc758 |
children | ef719132ddfa 7df2e30d72ec |
line wrap: on
line diff
--- a/src/alloc.c Tue Jan 04 23:11:57 2011 -0800 +++ b/src/alloc.c Wed Jan 05 14:09:07 2011 +0100 @@ -1,6 +1,6 @@ /* Storage allocation and gc for GNU Emacs Lisp interpreter. Copyright (C) 1985, 1986, 1988, 1993, 1994, 1995, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -4222,7 +4222,7 @@ can prove that. */ static void -test_setjmp () +test_setjmp (void) { char buf[10]; register int x; @@ -4270,7 +4270,7 @@ /* Abort if anything GCPRO'd doesn't survive the GC. */ static void -check_gcpros () +check_gcpros (void) { struct gcpro *p; int i; @@ -4286,7 +4286,7 @@ #elif GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES static void -dump_zombies () +dump_zombies (void) { int i; @@ -4321,6 +4321,11 @@ have to be true! It must be verified for each system, possibly by taking a look at the source code of setjmp. + If __builtin_unwind_init is available (defined by GCC >= 2.8) we + can use it as a machine independent method to store all registers + to the stack. In this case the macros described in the previous + two paragraphs are not used. + Stack Layout Architectures differ in the way their processor stack is organized. @@ -4359,6 +4364,13 @@ volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; void *end; +#ifdef HAVE___BUILTIN_UNWIND_INIT + /* Force callee-saved registers and register windows onto the stack. + This is the preferred method if available, obviating the need for + machine dependent methods. */ + __builtin_unwind_init (); + end = &end; +#else /* not HAVE___BUILTIN_UNWIND_INIT */ /* This trick flushes the register windows so that all the state of the process is contained in the stack. */ /* Fixme: Code in the Boehm GC suggests flushing (with `flushrs') is @@ -4394,6 +4406,7 @@ setjmp (j.j); end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j; #endif /* not GC_SAVE_REGISTERS_ON_STACK */ +#endif /* not HAVE___BUILTIN_UNWIND_INIT */ /* This assumes that the stack is a contiguous region in memory. If that's not the case, something has to be done here to iterate