Mercurial > emacs
comparison src/alloc.c @ 43160:630c8b6deafd
(mark_stack): Don't assume sizeof (Lisp_Object) is 4.
| author | Andreas Schwab <schwab@suse.de> |
|---|---|
| date | Thu, 07 Feb 2002 11:05:08 +0000 |
| parents | 0ab7a9a5666c |
| children | 8a549ab185a2 |
comparison
equal
deleted
inserted
replaced
| 43159:c69608fb5b19 | 43160:630c8b6deafd |
|---|---|
| 1 /* Storage allocation and gc for GNU Emacs Lisp interpreter. | 1 /* Storage allocation and gc for GNU Emacs Lisp interpreter. |
| 2 Copyright (C) 1985, 86, 88, 93, 94, 95, 97, 98, 1999, 2000, 2001 | 2 Copyright (C) 1985, 86, 88, 93, 94, 95, 97, 98, 1999, 2000, 2001, 2002 |
| 3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of GNU Emacs. | 5 This file is part of GNU Emacs. |
| 6 | 6 |
| 7 GNU Emacs is free software; you can redistribute it and/or modify | 7 GNU Emacs is free software; you can redistribute it and/or modify |
| 3732 equally on the stack. */ | 3732 equally on the stack. */ |
| 3733 | 3733 |
| 3734 static void | 3734 static void |
| 3735 mark_stack () | 3735 mark_stack () |
| 3736 { | 3736 { |
| 3737 int i; | |
| 3737 jmp_buf j; | 3738 jmp_buf j; |
| 3738 volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; | 3739 volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; |
| 3739 void *end; | 3740 void *end; |
| 3740 | 3741 |
| 3741 /* This trick flushes the register windows so that all the state of | 3742 /* This trick flushes the register windows so that all the state of |
| 3767 #endif /* not GC_SAVE_REGISTERS_ON_STACK */ | 3768 #endif /* not GC_SAVE_REGISTERS_ON_STACK */ |
| 3768 | 3769 |
| 3769 /* This assumes that the stack is a contiguous region in memory. If | 3770 /* This assumes that the stack is a contiguous region in memory. If |
| 3770 that's not the case, something has to be done here to iterate | 3771 that's not the case, something has to be done here to iterate |
| 3771 over the stack segments. */ | 3772 over the stack segments. */ |
| 3772 #if GC_LISP_OBJECT_ALIGNMENT == 1 | 3773 #ifndef GC_LISP_OBJECT_ALIGNMENT |
| 3773 mark_memory (stack_base, end); | 3774 #define GC_LISP_OBJECT_ALIGNMENT sizeof (Lisp_Object) |
| 3774 mark_memory ((char *) stack_base + 1, end); | |
| 3775 mark_memory ((char *) stack_base + 2, end); | |
| 3776 mark_memory ((char *) stack_base + 3, end); | |
| 3777 #elif GC_LISP_OBJECT_ALIGNMENT == 2 | |
| 3778 mark_memory (stack_base, end); | |
| 3779 mark_memory ((char *) stack_base + 2, end); | |
| 3780 #else | |
| 3781 mark_memory (stack_base, end); | |
| 3782 #endif | 3775 #endif |
| 3776 for (i = 0; i < sizeof (Lisp_Object) / GC_LISP_OBJECT_ALIGNMENT; i++) | |
| 3777 mark_memory ((char *) stack_base + i, end); | |
| 3783 | 3778 |
| 3784 #if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS | 3779 #if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS |
| 3785 check_gcpros (); | 3780 check_gcpros (); |
| 3786 #endif | 3781 #endif |
| 3787 } | 3782 } |
