diff options
| author | Andrea Corallo | 2020-05-17 13:23:59 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2020-05-17 22:37:28 +0100 |
| commit | abec255c024938a40fa3c9730f602c0351e5877d (patch) | |
| tree | 223b70e57e9571beb0975ed8565e4ab4a949e320 | |
| parent | 5daa7a5fd4aced33a2ae016bde5bb37d1d95edf6 (diff) | |
| download | emacs-abec255c024938a40fa3c9730f602c0351e5877d.tar.gz emacs-abec255c024938a40fa3c9730f602c0351e5877d.zip | |
* Fix Garbage Collector for missing calle-saved regs content (Bug#41357)
* src/alloc.c (SET_STACK_TOP_ADDRESS): Do not call
__builtin_unwind_init.
(flush_stack_call_func1): Rename from 'flush_stack_call_func'.
(flush_stack_call_func): New function to spill all registers
before calling 'flush_stack_call_func1'. This to make sure the
top of the stack identified includes those registers.
| -rw-r--r-- | src/alloc.c | 4 | ||||
| -rw-r--r-- | src/lisp.h | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/alloc.c b/src/alloc.c index cc9ba8dbf50..ebc55857ea0 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -4944,12 +4944,10 @@ typedef union | |||
| 4944 | #ifdef HAVE___BUILTIN_UNWIND_INIT | 4944 | #ifdef HAVE___BUILTIN_UNWIND_INIT |
| 4945 | # define SET_STACK_TOP_ADDRESS(p) \ | 4945 | # define SET_STACK_TOP_ADDRESS(p) \ |
| 4946 | stacktop_sentry sentry; \ | 4946 | stacktop_sentry sentry; \ |
| 4947 | __builtin_unwind_init (); \ | ||
| 4948 | *(p) = NEAR_STACK_TOP (&sentry) | 4947 | *(p) = NEAR_STACK_TOP (&sentry) |
| 4949 | #else | 4948 | #else |
| 4950 | # define SET_STACK_TOP_ADDRESS(p) \ | 4949 | # define SET_STACK_TOP_ADDRESS(p) \ |
| 4951 | stacktop_sentry sentry; \ | 4950 | stacktop_sentry sentry; \ |
| 4952 | __builtin_unwind_init (); \ | ||
| 4953 | test_setjmp (); \ | 4951 | test_setjmp (); \ |
| 4954 | sys_setjmp (sentry.j); \ | 4952 | sys_setjmp (sentry.j); \ |
| 4955 | *(p) = NEAR_STACK_TOP (&sentry + (stack_bottom < &sentry.c)) | 4953 | *(p) = NEAR_STACK_TOP (&sentry + (stack_bottom < &sentry.c)) |
| @@ -5025,7 +5023,7 @@ mark_stack (char const *bottom, char const *end) | |||
| 5025 | from FUNC. */ | 5023 | from FUNC. */ |
| 5026 | 5024 | ||
| 5027 | NO_INLINE void | 5025 | NO_INLINE void |
| 5028 | flush_stack_call_func (void (*func) (void *arg), void *arg) | 5026 | flush_stack_call_func1 (void (*func) (void *arg), void *arg) |
| 5029 | { | 5027 | { |
| 5030 | void *end; | 5028 | void *end; |
| 5031 | struct thread_state *self = current_thread; | 5029 | struct thread_state *self = current_thread; |
diff --git a/src/lisp.h b/src/lisp.h index a55fa32950d..ad7d67ae695 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3811,7 +3811,15 @@ extern void alloc_unexec_pre (void); | |||
| 3811 | extern void alloc_unexec_post (void); | 3811 | extern void alloc_unexec_post (void); |
| 3812 | extern void mark_maybe_objects (Lisp_Object const *, ptrdiff_t); | 3812 | extern void mark_maybe_objects (Lisp_Object const *, ptrdiff_t); |
| 3813 | extern void mark_stack (char const *, char const *); | 3813 | extern void mark_stack (char const *, char const *); |
| 3814 | extern void flush_stack_call_func (void (*func) (void *arg), void *arg); | 3814 | extern void flush_stack_call_func1 (void (*func) (void *arg), void *arg); |
| 3815 | |||
| 3816 | INLINE void | ||
| 3817 | flush_stack_call_func (void (*func) (void *arg), void *arg) | ||
| 3818 | { | ||
| 3819 | __builtin_unwind_init (); | ||
| 3820 | flush_stack_call_func1 (func, arg); | ||
| 3821 | } | ||
| 3822 | |||
| 3815 | extern void garbage_collect (void); | 3823 | extern void garbage_collect (void); |
| 3816 | extern void maybe_garbage_collect (void); | 3824 | extern void maybe_garbage_collect (void); |
| 3817 | extern const char *pending_malloc_warning; | 3825 | extern const char *pending_malloc_warning; |