aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2020-05-17 13:23:59 +0100
committerAndrea Corallo2020-05-17 22:37:28 +0100
commitabec255c024938a40fa3c9730f602c0351e5877d (patch)
tree223b70e57e9571beb0975ed8565e4ab4a949e320
parent5daa7a5fd4aced33a2ae016bde5bb37d1d95edf6 (diff)
downloademacs-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.c4
-rw-r--r--src/lisp.h10
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
5027NO_INLINE void 5025NO_INLINE void
5028flush_stack_call_func (void (*func) (void *arg), void *arg) 5026flush_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);
3811extern void alloc_unexec_post (void); 3811extern void alloc_unexec_post (void);
3812extern void mark_maybe_objects (Lisp_Object const *, ptrdiff_t); 3812extern void mark_maybe_objects (Lisp_Object const *, ptrdiff_t);
3813extern void mark_stack (char const *, char const *); 3813extern void mark_stack (char const *, char const *);
3814extern void flush_stack_call_func (void (*func) (void *arg), void *arg); 3814extern void flush_stack_call_func1 (void (*func) (void *arg), void *arg);
3815
3816INLINE void
3817flush_stack_call_func (void (*func) (void *arg), void *arg)
3818{
3819 __builtin_unwind_init ();
3820 flush_stack_call_func1 (func, arg);
3821}
3822
3815extern void garbage_collect (void); 3823extern void garbage_collect (void);
3816extern void maybe_garbage_collect (void); 3824extern void maybe_garbage_collect (void);
3817extern const char *pending_malloc_warning; 3825extern const char *pending_malloc_warning;