emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master afaf2f4 1/2: Make sure we mark reachable killed buffers during GC


From: Eli Zaretskii
Subject: master afaf2f4 1/2: Make sure we mark reachable killed buffers during GC
Date: Sun, 15 Mar 2020 10:49:38 -0400 (EDT)

branch: master
commit afaf2f465188ab1f438ff3e021260e7c529b1b9d
Author: Pip Cet <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Make sure we mark reachable killed buffers during GC
    
    * src/alloc.c (live_buffer_holding): Add ALL_BUFFERS argument for
    returning killed buffers.
    (mark_maybe_object, mark_maybe_pointer): Use the additional
    argument.  (Bug#39962)
---
 src/alloc.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/alloc.c b/src/alloc.c
index a35b48c..3d1090c 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4597,20 +4597,22 @@ live_vector_p (struct mem_node *m, void *p)
 }
 
 /* If P is a pointer into a live buffer, return the buffer.
-   Otherwise, return nil.  M is a pointer to the mem_block for P.  */
+   Otherwise, return nil.  M is a pointer to the mem_block for P.
+   Also return killed buffers if ALL-BUFFERS is true.  */
 
 static Lisp_Object
-live_buffer_holding (struct mem_node *m, void *p)
+live_buffer_holding (struct mem_node *m, void *p, bool all_buffers)
 {
-  /* P must point into the block, and the buffer
-     must not have been killed.  */
+  /* P must point into the block, and the buffer must not
+     have been killed unless ALL-BUFFERS is true.  */
   if (m->type == MEM_TYPE_BUFFER)
     {
       struct buffer *b = m->start;
       char *cb = m->start;
       char *cp = p;
       ptrdiff_t offset = cp - cb;
-      if (0 <= offset && offset < sizeof *b && !NILP (b->name_))
+      if (0 <= offset && offset < sizeof *b
+         && (all_buffers || !NILP (b->name_)))
        {
          Lisp_Object obj;
          XSETBUFFER (obj, b);
@@ -4623,7 +4625,7 @@ live_buffer_holding (struct mem_node *m, void *p)
 static bool
 live_buffer_p (struct mem_node *m, void *p)
 {
-  return !NILP (live_buffer_holding (m, p));
+  return !NILP (live_buffer_holding (m, p, false));
 }
 
 /* Mark OBJ if we can prove it's a Lisp_Object.  */
@@ -4681,7 +4683,7 @@ mark_maybe_object (Lisp_Object obj)
 
        case Lisp_Vectorlike:
          mark_p = (EQ (obj, live_vector_holding (m, po))
-                   || EQ (obj, live_buffer_holding (m, po)));
+                   || EQ (obj, live_buffer_holding (m, po, true)));
          break;
 
        default:
@@ -4751,7 +4753,7 @@ mark_maybe_pointer (void *p)
          break;
 
        case MEM_TYPE_BUFFER:
-         obj = live_buffer_holding (m, p);
+         obj = live_buffer_holding (m, p, true);
          break;
 
        case MEM_TYPE_CONS:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]