Subject: bug#78662: closed (Re: bug#78662: feature/igc: [PATCH] Make buffer_local_symbols exact roots)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 01 Jun 2025 09:31:06 +0000

Your bug report

#78662: feature/igc: [PATCH] Make buffer_local_symbols exact roots

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
78662: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78662
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#78662: feature/igc: [PATCH] Make buffer_local_symbols exact roots
From: Pip Cet <[email-masked]>
To: Helmut Eller <[email-masked]>
Cc: [email-masked]
Date: Sun, 01 Jun 2025 09:29:55 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

"Helmut Eller" <[email-masked]> writes:

> Tracing buffer_local_symbols and buffer_defaults exactly as in
> the patch seems to work.

Thanks.  I see no reason why it wouldn't work, and it doesn't crash, so
I've pushed it and am closing the bug.

I did note that buffer_defaults.text changes from NULL to
&buffer_defaults.own_text on the first scan, but this seems harmless to
me.

If these strange objects (no MPS header, these two have a vectorlike
header but buffer_local_flags doesn't, not necessarily lisp-aligned)
cause any trouble, we could always allocate them on the MPS heap, giving
us the very slight benefit of putting some words behind a barrier.

Pip

Subject: feature/igc: [PATCH] Make buffer_local_symbols exact roots
From: Helmut Eller <[email-masked]>
To: [email-masked]
Date: Sun, 01 Jun 2025 10:37:04 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Tracing buffer_local_symbols and buffer_defaults exactly as in
the patch seems to work.

>From f1709d2c66f4cb88af2645f61e761fc50e10384c Mon Sep 17 00:00:00 2001
From: Helmut Eller <[email-masked]>
Date: Sun, 1 Jun 2025 10:29:58 +0200
Subject: [PATCH] Make buffer_defaults and buffer_local_symbols exact roots

* src/igc.c (root_create_buffer): Create exact roots.
(scan_buffer): New helper.
---
 src/igc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/igc.c b/src/igc.c
index 9c3c8e82758..f63b0fe8c88 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -2196,6 +2196,14 @@ fix_buffer (mps_ss_t ss, struct buffer *b)
   return MPS_RES_OK;
 }
 
+static mps_res_t
+scan_buffer (mps_ss_t ss, void *start, void *end, void *closure)
+{
+  igc_assert (PSEUDOVECTOR_TYPE (start) == PVEC_BUFFER);
+  igc_assert ((char *) end - (char *) start == sizeof (struct buffer));
+  return fix_buffer (ss, start);
+}
+
 static mps_res_t
 fix_glyph_pool (mps_ss_t ss, struct glyph_pool *pool)
 {
@@ -2887,8 +2895,7 @@ root_create_lispsym (struct igc *gc)
 static void
 root_create_buffer (struct igc *gc, struct buffer *b)
 {
-  void *start = &b->name_, *end = &b->own_text;
-  root_create_ambig (gc, start, end, "buffer");
+  root_create_exact (gc, b, b + 1, scan_buffer, "buffer");
 }
 
 static void
-- 
2.39.5