diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/alloc.c b/src/alloc.c index 31b0644c285..13043d6d9d7 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -7117,8 +7117,29 @@ die (const char *msg, const char *file, int line) | |||
| 7117 | file, line, msg); | 7117 | file, line, msg); |
| 7118 | terminate_due_to_signal (SIGABRT, INT_MAX); | 7118 | terminate_due_to_signal (SIGABRT, INT_MAX); |
| 7119 | } | 7119 | } |
| 7120 | #endif | 7120 | |
| 7121 | 7121 | /* Stress alloca with inconveniently sized requests and check | |
| 7122 | whether all allocated areas may be used for Lisp_Object. */ | ||
| 7123 | |||
| 7124 | NO_INLINE static void | ||
| 7125 | verify_alloca (void) | ||
| 7126 | { | ||
| 7127 | int i; | ||
| 7128 | enum { ALLOCA_CHECK_MAX = 256 }; | ||
| 7129 | /* Start from size of the smallest Lisp object. */ | ||
| 7130 | for (i = sizeof (struct Lisp_Cons); i <= ALLOCA_CHECK_MAX; i++) | ||
| 7131 | { | ||
| 7132 | char *ptr = alloca (i); | ||
| 7133 | eassert (pointer_valid_for_lisp_object (ptr)); | ||
| 7134 | } | ||
| 7135 | } | ||
| 7136 | |||
| 7137 | #else /* not ENABLE_CHECKING */ | ||
| 7138 | |||
| 7139 | #define verify_alloca() ((void) 0) | ||
| 7140 | |||
| 7141 | #endif /* ENABLE_CHECKING */ | ||
| 7142 | |||
| 7122 | /* Initialization. */ | 7143 | /* Initialization. */ |
| 7123 | 7144 | ||
| 7124 | void | 7145 | void |
| @@ -7128,6 +7149,8 @@ init_alloc_once (void) | |||
| 7128 | purebeg = PUREBEG; | 7149 | purebeg = PUREBEG; |
| 7129 | pure_size = PURESIZE; | 7150 | pure_size = PURESIZE; |
| 7130 | 7151 | ||
| 7152 | verify_alloca (); | ||
| 7153 | |||
| 7131 | #if GC_MARK_STACK || defined GC_MALLOC_CHECK | 7154 | #if GC_MARK_STACK || defined GC_MALLOC_CHECK |
| 7132 | mem_init (); | 7155 | mem_init (); |
| 7133 | Vdead = make_pure_string ("DEAD", 4, 4, 0); | 7156 | Vdead = make_pure_string ("DEAD", 4, 4, 0); |