all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andrea Corallo <acorallo@gnu.org>
To: Pip Cet <pipcet@protonmail.com>
Cc: gerd.moellmann@gmail.com, spd@toadstyle.org,
	Eli Zaretskii <eliz@gnu.org>,
	monnier@iro.umontreal.ca, 74966@debbugs.gnu.org
Subject: bug#74966: 31.0.50; Crash report (using igc on macOS)
Date: Wed, 08 Jan 2025 05:33:09 -0500	[thread overview]
Message-ID: <yp1ikqp4mu2.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <875xmqhj3k.fsf@protonmail.com> (Pip Cet's message of "Tue, 07 Jan 2025 13:03:15 +0000")

Pip Cet <pipcet@protonmail.com> writes:

> "Andrea Corallo" <acorallo@gnu.org> writes:
>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>>>> From: Andrea Corallo <acorallo@gnu.org>
>>>> Cc: Pip Cet <pipcet@protonmail.com>,  monnier@iro.umontreal.ca,
>>>>   gerd.moellmann@gmail.com,  spd@toadstyle.org,  74966@debbugs.gnu.org
>>>> Date: Tue, 31 Dec 2024 05:22:11 -0500
>>>>
>>>> Eli Zaretskii <eliz@gnu.org> writes:
>>>>
>>>> >> > I think a much simpler change is to use the sign bit to distinguish indices
>>>> >> > into the constant vector from indices into the DOC file.
>>>> >>
>>>> >> And use one's-complement, I assume, to guard against some future weird
>>>> >> nativecomp change resulting in the index -0?  :-)
>>>> >>
>>>> >> I really have no strong preference here.
>>>> >
>>>> > And I still want to hear from Andrea.  It's his code, so the solution
>>>> > he prefers gets my vote.
>>>>
>>>> Sorry for behing late here.
>>>>
>>>> I'm for the sign bit, it saves memory (why not), and we can sanity check
>>>> that when the bit is set the function is a non-primitve one and vice
>>>> versa.
>>>
>>> OK, can you post a patch (or even install it)?
>>
>> Will do.  I'll just need some time, I'm catching up with mails after
>> holidays while being sick at the same time.
>
> Sorry to hear it.  Get well soon!

Thanks

>> If someone is motivate to
>> jump on the task before me feel free.
>
> Here's a patch (IIRC, C doesn't require ~x = -x - 1, so I used
> the more explicit notation to avoid compiler warnings).
>
> commit 9654100f0ecc312b14ba56bf2e13691168342cf9 (HEAD -> signbit)
> Author: Pip Cet <pipcet@protonmail.com>
> Date:   Tue Jan 7 12:52:16 2025 +0000
>
>     Fix store_function_docstring for native subrs (Bug#74966)
>     
>     * src/comp.c (native_function_doc):
>     (make_subr): Use one's complement of doc index.
>     * src/doc.c (store_function_docstring): Add assertion.
>     * src/lisp.h (struct Lisp_Subr): Document 'doc' sign bit.
>
> diff --git a/src/comp.c b/src/comp.c
> index 70a9a64a714..b96fae4ae95 100644
> --- a/src/comp.c
> +++ b/src/comp.c
> @@ -5488,7 +5488,10 @@ native_function_doc (Lisp_Object function)
>    if (!VECTORP (cu->data_fdoc_v))
>      xsignal2 (Qnative_lisp_file_inconsistent, cu->file,
>  	      build_string ("missing documentation vector"));
> -  return AREF (cu->data_fdoc_v, XSUBR (function)->doc);
> +  EMACS_INT doc = XSUBR (function)->doc;
> +  if (doc < 0)
> +    return AREF (cu->data_fdoc_v, -doc - 1);
> +  return make_fixnum (doc);
>  }
>  
>  static Lisp_Object
> @@ -5529,7 +5532,8 @@ make_subr (Lisp_Object symbol_name, Lisp_Object minarg, Lisp_Object maxarg,
>    x->s.symbol_name = xstrdup (SSDATA (symbol_name));
>    x->s.intspec.native = intspec;
>    x->s.command_modes = command_modes;
> -  x->s.doc = XFIXNUM (doc_idx);
> +  x->s.doc = -XFIXNUM (doc_idx) - 1;
> +  eassert (x->s.doc < 0);
>  #ifdef HAVE_NATIVE_COMP
>    x->s.native_comp_u = comp_u;
>    x->s.native_c_name = xstrdup (SSDATA (c_name));
> diff --git a/src/doc.c b/src/doc.c
> index 88be9121dab..04afe50d3dd 100644
> --- a/src/doc.c
> +++ b/src/doc.c
> @@ -479,7 +479,10 @@ store_function_docstring (Lisp_Object obj, EMACS_INT offset)
>      fun = XCDR (fun);
>    /* Lisp_Subrs have a slot for it.  */
>    if (SUBRP (fun))
> -    XSUBR (fun)->doc = offset;
> +    {
> +      XSUBR (fun)->doc = offset;
> +      eassert (XSUBR (fun)->doc >= 0);
> +    }
>    else if (CLOSUREP (fun))
>      {
>        /* This bytecode object must have a slot for the docstring, since
> diff --git a/src/lisp.h b/src/lisp.h
> index 339ff5e83b0..0979fedd846 100644
> --- a/src/lisp.h
> +++ b/src/lisp.h
> @@ -2228,6 +2228,9 @@ CHAR_TABLE_SET (Lisp_Object ct, int idx, Lisp_Object val)
>        Lisp_Object native;
>      } intspec;
>      Lisp_Object command_modes;
> +    /* positive values: offset into etc/DOC.  Negative values: one's
> +       complement of index into the native comp unit's constant
> +       vector.  */
>      EMACS_INT doc;
>  #ifdef HAVE_NATIVE_COMP
>      Lisp_Object native_comp_u;

LGTM thanks





  reply	other threads:[~2025-01-08 10:33 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-19  9:17 bug#74966: 31.0.50; Crash report (using igc on macOS) Sean Devlin
     [not found] ` <handler.74966.B.173459989517154.ack@debbugs.gnu.org>
2024-12-19  9:21   ` bug#74966: Acknowledgement (31.0.50; Crash report (using igc on macOS)) Sean Devlin
2024-12-19 10:28     ` Gerd Möllmann
2024-12-19 11:05       ` Sean Devlin
2024-12-19 11:30         ` Gerd Möllmann
2024-12-19 10:25 ` bug#74966: 31.0.50; Crash report (using igc on macOS) Gerd Möllmann
2024-12-19 11:57   ` Sean Devlin
2024-12-19 11:48 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-19 11:54   ` Sean Devlin
2024-12-19 14:02   ` Gerd Möllmann
2024-12-19 14:07     ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-19 14:44       ` Gerd Möllmann
2024-12-19 15:25         ` Gerd Möllmann
2024-12-19 19:21           ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-19 19:46             ` Gerd Möllmann
2024-12-20  7:00               ` Gerd Möllmann
2024-12-20  7:11                 ` Gerd Möllmann
2024-12-20  7:30                   ` Gerd Möllmann
2024-12-20  7:38                     ` Gerd Möllmann
2024-12-20  7:44                     ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-20  8:12                     ` Eli Zaretskii
2024-12-20  8:21                       ` Gerd Möllmann
2024-12-20  8:35                         ` Eli Zaretskii
2024-12-20  8:43                           ` Gerd Möllmann
2024-12-20  8:57                             ` Gerd Möllmann
2024-12-20 16:17                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-20 16:20                                 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-21 14:26                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-21 14:57                                     ` Gerd Möllmann
2024-12-21 15:18                                     ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-21 16:15                                       ` Eli Zaretskii
2024-12-31 10:22                                         ` Andrea Corallo
2024-12-31 13:28                                           ` Eli Zaretskii
2024-12-31 14:32                                             ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-06 20:38                                             ` Andrea Corallo
2025-01-07 13:03                                               ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-08 10:33                                                 ` Andrea Corallo [this message]
2025-01-08 12:47                                                   ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-20 16:40                                 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-20 17:17                                   ` Gerd Möllmann
2024-12-20 19:40                                   ` Eli Zaretskii
2024-12-20 20:50                                     ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-20 21:07                                       ` Gerd Möllmann
2024-12-21  7:09                                         ` Eli Zaretskii
2024-12-21  7:12                                           ` Gerd Möllmann
2024-12-21  6:47                                       ` Eli Zaretskii
2024-12-21  7:08                                         ` Gerd Möllmann
2024-12-21  7:51                                           ` Eli Zaretskii
2024-12-21  8:07                                             ` Gerd Möllmann
2024-12-21 10:09                                               ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-21 10:31                                                 ` Gerd Möllmann
2024-12-21 12:28                                                 ` Eli Zaretskii
2024-12-21 13:26                                                   ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-21 14:12                                                   ` Gerd Möllmann
2024-12-21 16:07                                                     ` Eli Zaretskii
2024-12-21 17:35                                                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-21 18:15                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-20  8:04                 ` Eli Zaretskii
2024-12-20  6:34             ` Eli Zaretskii
2024-12-19 15:31         ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-19 15:42           ` Gerd Möllmann

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=yp1ikqp4mu2.fsf@fencepost.gnu.org \
    --to=acorallo@gnu.org \
    --cc=74966@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=pipcet@protonmail.com \
    --cc=spd@toadstyle.org \
    /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.