[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 6b3fb29: ; src/alloc.c: Add a GC reg spill mechanism and Bug#4135
From: |
Andrea Corallo |
Subject: |
master 6b3fb29: ; src/alloc.c: Add a GC reg spill mechanism and Bug#41357 related commentary. |
Date: |
Wed, 20 May 2020 06:33:37 -0400 (EDT) |
branch: master
commit 6b3fb29ede140c79a4146fb2056306632e3bd511
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>
; src/alloc.c: Add a GC reg spill mechanism and Bug#41357 related
commentary.
---
src/alloc.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index b7ebaa6..d5a6d91 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4998,8 +4998,9 @@ mark_stack (char const *bottom, char const *end)
#endif
}
-/* This is a trampoline function that flushes registers to the stack,
- and then calls FUNC. ARG is passed through to FUNC verbatim.
+/* flush_stack_call_func is the trampoline function that flushes
+ registers to the stack, and then calls FUNC. ARG is passed through
+ to FUNC verbatim.
This function must be called whenever Emacs is about to release the
global interpreter lock. This lets the garbage collector easily
@@ -5007,7 +5008,20 @@ mark_stack (char const *bottom, char const *end)
Lisp.
It is invalid to run any Lisp code or to allocate any GC memory
- from FUNC. */
+ from FUNC.
+
+ Note: all register spilling is done in flush_stack_call_func before
+ flush_stack_call_func1 is activated.
+
+ flush_stack_call_func1 is responsible for identifying the stack
+ address range to be scanned. It *must* be carefully kept as
+ noinline to make sure that registers has been spilled before it is
+ called, otherwise given __builtin_frame_address (0) typically
+ returns the frame pointer (base pointer) and not the stack pointer
+ [1] GC will miss to scan callee-saved registers content
+ (Bug#41357).
+
+ [1] <https://gcc.gnu.org/onlinedocs/gcc/Return-Address.html>. */
NO_INLINE void
flush_stack_call_func1 (void (*func) (void *arg), void *arg)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 6b3fb29: ; src/alloc.c: Add a GC reg spill mechanism and Bug#41357 related commentary.,
Andrea Corallo <=