From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Armstrong Newsgroups: gmane.emacs.bugs Subject: 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 Message-ID: <874khh7021.fsf@rfc20.org> References: <87a6ra7ti3.fsf@rfc20.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5490"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 46988@debbugs.gnu.org To: Pip Cet Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 12 00:18:14 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lKUZK-0001Kj-CE for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Mar 2021 00:18:14 +0100 Original-Received: from localhost ([::1]:57722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKUZJ-0000Zs-D6 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Mar 2021 18:18:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKUZ8-0000Ys-3v for bug-gnu-emacs@gnu.org; Thu, 11 Mar 2021 18:18:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43813) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lKUZ7-0007gk-SO for bug-gnu-emacs@gnu.org; Thu, 11 Mar 2021 18:18:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lKUZ7-0001DK-NS for bug-gnu-emacs@gnu.org; Thu, 11 Mar 2021 18:18:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Matt Armstrong Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Mar 2021 23:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46988 X-GNU-PR-Package: emacs Original-Received: via spool by 46988-submit@debbugs.gnu.org id=B46988.16155046454621 (code B ref 46988); Thu, 11 Mar 2021 23:18:01 +0000 Original-Received: (at 46988) by debbugs.gnu.org; 11 Mar 2021 23:17:25 +0000 Original-Received: from localhost ([127.0.0.1]:55359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lKUYW-0001CT-V0 for submit@debbugs.gnu.org; Thu, 11 Mar 2021 18:17:25 -0500 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:47977) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lKUYU-0001CE-I6 for 46988@debbugs.gnu.org; Thu, 11 Mar 2021 18:17:23 -0500 X-Originating-IP: 24.113.169.116 Original-Received: from mdeb (24-113-169-116.wavecable.com [24.113.169.116]) (Authenticated sender: matt@rfc20.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id BB9A51C0004; Thu, 11 Mar 2021 23:17:14 +0000 (UTC) Original-Received: from matt by mdeb with local (Exim 4.94) (envelope-from ) id 1lKUYI-001E3J-St; Thu, 11 Mar 2021 15:17:10 -0800 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:202101 Archived-At: Pip Cet writes: > On Wed, Mar 10, 2021 at 6:28 PM Matt Armstrong 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.