GNU bug report logs - #46988
28.0.50; Documenting and verifying assumptions about C code not calling quit or GCing

Previous Next

Package: emacs;

Reported by: Pip Cet <pipcet <at> gmail.com>

Date: Sun, 7 Mar 2021 13:48:01 UTC

Severity: wishlist

Tags: patch

Found in version 28.0.50

Full log


Message #26 received at 46988 <at> debbugs.gnu.org (full text, mbox):

From: Matt Armstrong <matt <at> rfc20.org>
To: Pip Cet <pipcet <at> gmail.com>
Cc: 46988 <at> debbugs.gnu.org
Subject: Re: bug#46988: 28.0.50; Documenting and verifying assumptions about
 C code not calling quit or GCing
Date: Thu, 11 Mar 2021 15:17:10 -0800
Pip Cet <pipcet <at> gmail.com> writes:

> On Wed, Mar 10, 2021 at 6:28 PM Matt Armstrong <matt <at> rfc20.org> wrote:
>> Why a linked list/stack implementation?  How about a global count var
>> that is incremented, decremented, and asserted zero?
>
> Emacs' specpdl implementation is independent of, and probably
> predates, the widespread availability of C exceptions. In fact, as it
> is written today, C exceptions will not work in Emacs C code (neither
> will C++ exceptions), because Emacs uses setjmp / longjmp instead, and
> unwinds the stack by itself. Since I was too lazy to fix it to use
> compatible unwinding routines on supported platforms, I simply created
> a linked list on the stack, unwinding it in unwind_to_catch.
>
>> You wrote that this impl depends on the stack direction, but I can't
>> figure out why.  If it is indeed the case, add a comment explaining
>> this?
>
> The unwind_to_catch code checks how far up the stack it has to go by
> comparing the stack pointer to the address of a local variable. You're
> absolutely right about the comment.

Ah, makes perfect sense.  Thanks for this and your other responses.




This bug report was last modified 178 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.