aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorAndreas Schwab2011-01-05 14:09:07 +0100
committerAndreas Schwab2011-01-05 14:09:07 +0100
commit2018939f5da2c3171825ea1699cea4ff4f52b71c (patch)
tree27343ad94a64c306e8c6778ebda4cfaded5572da /src/alloc.c
parent96f129d50f65d1ced19c417aeda7f2755344228c (diff)
downloademacs-2018939f5da2c3171825ea1699cea4ff4f52b71c.tar.gz
emacs-2018939f5da2c3171825ea1699cea4ff4f52b71c.zip
Use __builtin_unwind_init if available
* configure.in: Check for __builtin_unwind_init. * src/alloc.c (mark_stack): Use __builtin_unwind_init if available.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/alloc.c b/src/alloc.c
index e754e2f6aa2..089a7766ca4 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1,6 +1,6 @@
1/* Storage allocation and gc for GNU Emacs Lisp interpreter. 1/* Storage allocation and gc for GNU Emacs Lisp interpreter.
2 Copyright (C) 1985, 1986, 1988, 1993, 1994, 1995, 1997, 1998, 1999, 2 Copyright (C) 1985, 1986, 1988, 1993, 1994, 1995, 1997, 1998, 1999,
3 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 3 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
@@ -4222,7 +4222,7 @@ Please mail the result to <emacs-devel@gnu.org>.\n\
4222 can prove that. */ 4222 can prove that. */
4223 4223
4224static void 4224static void
4225test_setjmp () 4225test_setjmp (void)
4226{ 4226{
4227 char buf[10]; 4227 char buf[10];
4228 register int x; 4228 register int x;
@@ -4270,7 +4270,7 @@ test_setjmp ()
4270/* Abort if anything GCPRO'd doesn't survive the GC. */ 4270/* Abort if anything GCPRO'd doesn't survive the GC. */
4271 4271
4272static void 4272static void
4273check_gcpros () 4273check_gcpros (void)
4274{ 4274{
4275 struct gcpro *p; 4275 struct gcpro *p;
4276 int i; 4276 int i;
@@ -4286,7 +4286,7 @@ check_gcpros ()
4286#elif GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES 4286#elif GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
4287 4287
4288static void 4288static void
4289dump_zombies () 4289dump_zombies (void)
4290{ 4290{
4291 int i; 4291 int i;
4292 4292
@@ -4321,6 +4321,11 @@ dump_zombies ()
4321 have to be true! It must be verified for each system, possibly 4321 have to be true! It must be verified for each system, possibly
4322 by taking a look at the source code of setjmp. 4322 by taking a look at the source code of setjmp.
4323 4323
4324 If __builtin_unwind_init is available (defined by GCC >= 2.8) we
4325 can use it as a machine independent method to store all registers
4326 to the stack. In this case the macros described in the previous
4327 two paragraphs are not used.
4328
4324 Stack Layout 4329 Stack Layout
4325 4330
4326 Architectures differ in the way their processor stack is organized. 4331 Architectures differ in the way their processor stack is organized.
@@ -4359,6 +4364,13 @@ mark_stack (void)
4359 volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; 4364 volatile int stack_grows_down_p = (char *) &j > (char *) stack_base;
4360 void *end; 4365 void *end;
4361 4366
4367#ifdef HAVE___BUILTIN_UNWIND_INIT
4368 /* Force callee-saved registers and register windows onto the stack.
4369 This is the preferred method if available, obviating the need for
4370 machine dependent methods. */
4371 __builtin_unwind_init ();
4372 end = &end;
4373#else /* not HAVE___BUILTIN_UNWIND_INIT */
4362 /* This trick flushes the register windows so that all the state of 4374 /* This trick flushes the register windows so that all the state of
4363 the process is contained in the stack. */ 4375 the process is contained in the stack. */
4364 /* Fixme: Code in the Boehm GC suggests flushing (with `flushrs') is 4376 /* Fixme: Code in the Boehm GC suggests flushing (with `flushrs') is
@@ -4394,6 +4406,7 @@ mark_stack (void)
4394 setjmp (j.j); 4406 setjmp (j.j);
4395 end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j; 4407 end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j;
4396#endif /* not GC_SAVE_REGISTERS_ON_STACK */ 4408#endif /* not GC_SAVE_REGISTERS_ON_STACK */
4409#endif /* not HAVE___BUILTIN_UNWIND_INIT */
4397 4410
4398 /* This assumes that the stack is a contiguous region in memory. If 4411 /* This assumes that the stack is a contiguous region in memory. If
4399 that's not the case, something has to be done here to iterate 4412 that's not the case, something has to be done here to iterate