From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Davis Herring" Newsgroups: gmane.emacs.devel Subject: Re: please help concerning specpdl Date: Mon, 6 Dec 2010 08:22:30 -0800 (PST) Message-ID: <35942.130.55.118.19.1291652550.squirrel@webmail.lanl.gov> References: Reply-To: herring@lanl.gov NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1291653646 24082 80.91.229.12 (6 Dec 2010 16:40:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 6 Dec 2010 16:40:46 +0000 (UTC) Cc: Emacs Dev To: "Alin Soare" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 06 17:40:41 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PPe7E-0007Rl-Qe for ged-emacs-devel@m.gmane.org; Mon, 06 Dec 2010 17:40:40 +0100 Original-Received: from localhost ([127.0.0.1]:56659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPdqC-00041R-07 for ged-emacs-devel@m.gmane.org; Mon, 06 Dec 2010 11:23:04 -0500 Original-Received: from [140.186.70.92] (port=32966 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPdpj-0003yY-Jz for emacs-devel@gnu.org; Mon, 06 Dec 2010 11:22:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PPdpi-0003E7-Hj for emacs-devel@gnu.org; Mon, 06 Dec 2010 11:22:35 -0500 Original-Received: from proofpoint2.lanl.gov ([204.121.3.26]:54737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PPdpi-0003Do-6n for emacs-devel@gnu.org; Mon, 06 Dec 2010 11:22:34 -0500 Original-Received: from mailrelay1.lanl.gov (mailrelay1.lanl.gov [128.165.4.101]) by proofpoint2.lanl.gov (8.14.3/8.14.3) with ESMTP id oB6HSxoX017000; Mon, 6 Dec 2010 10:28:59 -0700 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mailrelay1.lanl.gov (Postfix) with ESMTP id AC2AF1514CE; Mon, 6 Dec 2010 09:22:30 -0700 (MST) X-NIE-2-Virus-Scanner: amavisd-new at mailrelay1.lanl.gov Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay1.lanl.gov (Postfix) with ESMTP id 94A381514CA; Mon, 6 Dec 2010 09:22:30 -0700 (MST) Original-Received: by webmail1.lanl.gov (Postfix, from userid 48) id 930231CA824F; Mon, 6 Dec 2010 09:22:30 -0700 (MST) Original-Received: from 130.55.118.19 (SquirrelMail authenticated user 196434) by webmail.lanl.gov with HTTP; Mon, 6 Dec 2010 08:22:30 -0800 (PST) In-Reply-To: User-Agent: SquirrelMail/1.4.8-5.el5_4.10.lanl3 X-Priority: 3 (Normal) Importance: Normal X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.2.15, 1.0.148, 0.0.0000 definitions=2010-12-06_11:2010-12-06, 2010-12-06, 1970-01-01 signatures=0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:133455 Archived-At: > count = SPECPDL_INDEX (); > record_unwind_protect > val = Fprogn (args); > return unbind_to (count, val); > Can you explain me the logic of specpdl please ? The specpdl contains information needed to remove variable bindings and provide other services that are guaranteed even in the case of abnormal exit. Abnormal exits operate by calling longjmp(3), so there's no guaranteed chance to perform cleanup in the normal flow of execution. But the function that calls longjmp(3) (`unwind_to_catch') first peruses the specpdl and handles its elements appropriately, so the guaranteed operations happen. The actual unwinding is done by `unbind_to', so if the body exits normally, we just call that to perform the unwinding operations without longjmp(3). So: the count identifies how far to unwind in case of normal exit (in case of abnormal exit, we'll unwind farther anyway, so we don't need `count'). The `record_unwind_protect' registers something to do at unwind-time, and then `unbind_to' performs it unless `unwind_to_catch' does. `val' is passed to `unbind_to' for GC reasons, I believe. Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.