From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: Dynamic modules: MODULE_HANDLE_SIGNALS etc. Date: Mon, 21 Dec 2015 20:09:43 -0800 Organization: UCLA Computer Science Department Message-ID: <5678CD07.8080209@cs.ucla.edu> References: <83mvu1x6t3.fsf@gnu.org> <565779CD.80405@cs.ucla.edu> <83io4nuc68.fsf@gnu.org> <83r3iht93x.fsf@gnu.org> <838u4psznr.fsf@gnu.org> <56772054.8010401@cs.ucla.edu> <83zix4scgf.fsf@gnu.org> <5677DBC9.6030307@cs.ucla.edu> <83io3rst2r.fsf@gnu.org> <567841A6.4090408@cs.ucla.edu> <567844B9.2050308@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1450757420 18092 80.91.229.3 (22 Dec 2015 04:10:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Dec 2015 04:10:20 +0000 (UTC) Cc: aurelien.aptel+emacs@gmail.com, p.stephani2@gmail.com, tzz@lifelogs.com, emacs-devel@gnu.org To: Daniel Colascione , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 22 05:10:10 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aBEH0-0006CU-F8 for ged-emacs-devel@m.gmane.org; Tue, 22 Dec 2015 05:10:06 +0100 Original-Received: from localhost ([::1]:48619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBEGz-0003i5-G0 for ged-emacs-devel@m.gmane.org; Mon, 21 Dec 2015 23:10:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBEGm-0003i0-Jj for emacs-devel@gnu.org; Mon, 21 Dec 2015 23:09:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBEGl-0000WU-SP for emacs-devel@gnu.org; Mon, 21 Dec 2015 23:09:52 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:35393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBEGg-0000St-9K; Mon, 21 Dec 2015 23:09:46 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0285A16066A; Mon, 21 Dec 2015 20:09:45 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 6l6TqCnIeabn; Mon, 21 Dec 2015 20:09:44 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 3A52C160D02; Mon, 21 Dec 2015 20:09:44 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id eomCuE_6FqxN; Mon, 21 Dec 2015 20:09:44 -0800 (PST) Original-Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 0F84016066A; Mon, 21 Dec 2015 20:09:44 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 In-Reply-To: <567844B9.2050308@dancol.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:196638 Archived-At: Daniel Colascione wrote: > we should treat OOM exactly like other sorts of error. Perhaps we should, but currently stack overflow is not treated that way. > OS signals should go through the usual Emacs event loop, right? I'm not sure what you mean, but let's put it this way: stack overflow can occur while in the low-level handler for an OS signal. And even if stack overflow does not occur, if the user types C-g three times when inhibit-quit is nil, the OS signal won't go through the Emacs event loop; instead, Emacs will invoke (signal 'quit nil). Perhaps what we need to do is to have stack overflow invoke (signal 'stack-overflow nil), or something like that. It's a bit tricky, though, as one needs some stack space to call 'signal'. > The standard requires runtimes reserve enough memory to throw > std::bad_alloc. All Emacs has to do is make sure control flow reaches > the C++ level. How does this actually work, when combined with Emacs's C-level stack overflow checking? Won't one get in the way of the other? > When we say that we want C++ > exceptions to work, the Emacs-relevant meaning is that Emacs should > return always use conventional local returns, not longjmp, so that the > stack unwinding facilities of other languages (e.g., C++) work properly. Clearly we're not doing that, at least for stack overflow and 3x C-g, and perhaps for other cases (I haven't investigated thoroughly). > Both the Python and Java extension APIs implement high-level exceptions > with low-level state exactly the way we're talking about here, and the > result has been generally usable. I wonder how they deal with stack overflow, and/or with OS signals.