all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Helmut Eller <eller.helmut@gmail.com>
To: "Gerd Möllmann" <gerd.moellmann@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,  Emacs Devel <emacs-devel@gnu.org>
Subject: Re: MPS prstack
Date: Wed, 22 May 2024 18:27:37 +0200	[thread overview]
Message-ID: <874jap95hi.fsf@gmail.com> (raw)
In-Reply-To: <87o790qsgm.fsf@gmail.com> (Helmut Eller's message of "Mon, 20 May 2024 19:54:49 +0200")

[-- Attachment #1: Type: text/plain, Size: 365 bytes --]

On Mon, May 20 2024, Helmut Eller wrote:

> In print.c, there is a global variable prstack that is not yet scanned.
> This causes a crash for comp-tests but this example triggers the same
> problem:

There is another one: ppstack.  I wasn't able to create a small test
case for this but ppstack is needed when print-circle=t.  The native
compiler uses that a lot.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-ppstack-an-exact-root.patch --]
[-- Type: text/x-diff, Size: 1634 bytes --]

From 61943bbd287efaa8ebf9994be1d536d82456072e Mon Sep 17 00:00:00 2001
From: Helmut Eller <eller.helmut@gmail.com>
Date: Wed, 22 May 2024 15:03:41 +0200
Subject: [PATCH] Make ppstack an exact root

* src/print.c (grow_pp_stack): Use igc_xpalloc_exact.
(scan_ppstack): New.
---
 src/print.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/src/print.c b/src/print.c
index f043da92c1f..c87597be899 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1326,12 +1326,44 @@ #define PRINT_CIRCLE_CANDIDATE_P(obj)			   \
 
 static struct print_pp_stack ppstack = {NULL, 0, 0};
 
+static igc_scan_result_t
+scan_ppstack (struct igc_opaque *op, void *start, void *end,
+	      igc_scan_cell_t scan1)
+{
+  eassert (start == (void *)ppstack.stack);
+  eassert (end == (void *)(ppstack.stack + ppstack.size));
+  struct print_pp_entry *p = start;
+  struct print_pp_entry *q = p + ppstack.sp;
+  for (; p < q; p++)
+    {
+      igc_scan_result_t err = 0;
+      if (p->n == 0)
+	{
+	  if (err = scan1 (op, &p->u.value), err != 0)
+	    return err;
+	}
+      else
+	{
+	  eassert (p->n > 0);
+	  for (size_t i = 0; i < p->n; i++)
+	    if (err = scan1 (op, &p->u.values[i]), err != 0)
+	      return err;
+	}
+    }
+  return 0;
+}
+
 NO_INLINE static void
 grow_pp_stack (void)
 {
   struct print_pp_stack *ps = &ppstack;
   eassert (ps->sp == ps->size);
+#ifdef HAVE_MPS
+  ps->stack = igc_xpalloc_exact (ps->stack, &ps->size, 1, -1,
+				 sizeof *ps->stack, scan_ppstack);
+#else
   ps->stack = xpalloc (ps->stack, &ps->size, 1, -1, sizeof *ps->stack);
+#endif
   eassert (ps->sp < ps->size);
 }
 
-- 
2.39.2


  parent reply	other threads:[~2024-05-22 16:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20 17:54 MPS prstack Helmut Eller
2024-05-20 18:21 ` Gerd Möllmann
2024-05-20 18:32   ` Helmut Eller
2024-05-21  3:30     ` Gerd Möllmann
2024-05-22 16:27 ` Helmut Eller [this message]
2024-05-22 17:55   ` Gerd Möllmann
2024-05-24 14:17   ` Helmut Eller
2024-05-24 14:27     ` Gerd Möllmann
2024-05-25 13:45       ` Gerd Möllmann
2024-05-27  7:27         ` Helmut Eller
2024-05-27  8:43           ` Gerd Möllmann
2024-05-27  9:15             ` Helmut Eller
2024-05-27  9:47               ` Gerd Möllmann
2024-05-27 11:45               ` Eli Zaretskii
2024-05-27 12:39                 ` Helmut Eller
2024-05-27 13:12                   ` Eli Zaretskii
2024-05-27 14:15                     ` Helmut Eller
2024-05-27 14:37                       ` Mattias Engdegård
2024-05-27 14:54                         ` Helmut Eller
2024-05-27 14:43                       ` Po Lu
2024-05-27 15:08                         ` Helmut Eller
2024-05-27 11:34           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874jap95hi.fsf@gmail.com \
    --to=eller.helmut@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.