Subject: bug#36649: 27.0.50; pure space and pdumper

From: Pip Cet <[email-masked]>
Date: Sun, 21 Jul 2019 14:36:41 +0000

On Sun, Jul 21, 2019 at 1:44 PM Robert Pluim <[email-masked]> wrote:
> >>>>> On Sun, 21 Jul 2019 12:53:21 +0000, Pip Cet <[email-masked]> said:
>     Pip> I think we should do (1) for now, since it simplifies the code enough
>     Pip> to introduce immutable objects "soon"; but until that time, we waste
>     Pip> more space on duplicate objects that we no longer know to be
>     Pip> immutable, so cannot merge.
>
>     Pip> I'm attaching a first patch that removes pure space, pinned symbols,
>     Pip> pinned objects, but keeps Fpurecopy (for hash consing), and doesn't
>     Pip> touch the Lisp codebase.
>
> This doesnʼt build for me on macOS. After adjusting the parameters to
> the call to make_hash_table in image.c, it crashes when dumping:

Thanks for testing! Indeed, I'd only verified it builds here.

My first guess is there's a symbol in the obarray which used to be
pinned, but is now collected before it is interned.

Can you try with the attached patch relative to the one I'd sent
before, and see what the output is?
From 45e8f7bdbba43f627b39957366b70dcbdc6575a8 Mon Sep 17 00:00:00 2001
From: Pip Cet <[email-masked]>
Date: Sun, 21 Jul 2019 14:35:04 +0000
Subject: [PATCH] debugging changes

---
 src/alloc.c | 3 ++-
 src/image.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/alloc.c b/src/alloc.c
index df8b1caf4e..1b55ad8cab 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6428,6 +6428,7 @@ sweep_symbols (void)
         {
           if (!sym->u.s.gcmarkbit)
             {
+	      fprintf (stderr, "freeing symbol %s\n", SDATA (sym->u.s.name));
               if (sym->u.s.redirect == SYMBOL_LOCALIZED)
 		{
                   xfree (SYMBOL_BLV (sym));
@@ -6519,12 +6520,12 @@ sweep_buffers (void)
 static void
 gc_sweep (void)
 {
+  sweep_symbols ();
   sweep_strings ();
   check_string_bytes (!noninteractive);
   sweep_conses ();
   sweep_floats ();
   sweep_intervals ();
-  sweep_symbols ();
   sweep_buffers ();
   sweep_vectors ();
   pdumper_clear_marks ();
diff --git a/src/image.c b/src/image.c
index 355c849491..b21dff34d4 100644
--- a/src/image.c
+++ b/src/image.c
@@ -4596,7 +4596,7 @@ xpm_make_color_table_h (void (**put_func) (Lisp_Object, const char *, int,
   *get_func = xpm_get_color_table_h;
   return make_hash_table (hashtest_equal, DEFAULT_HASH_SIZE,
 			  DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD,
-			  Qnil, false);
+			  Qnil);
 }
 
 static void
-- 
2.22.0