From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.bugs,gmane.lisp.guile.devel Subject: Re: exit & dynamic wind Date: Wed, 30 Mar 2011 22:54:24 +0100 Message-ID: <8762r0ff5b.fsf@ossau.uklinux.net> References: <87fwqc3r1h.fsf@ossau.uklinux.net> <87mxkcfojs.fsf@ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1301522085 12454 80.91.229.12 (30 Mar 2011 21:54:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 30 Mar 2011 21:54:45 +0000 (UTC) Cc: bug-guile@gnu.org, Ian Price , guile-devel To: Andy Wingo Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Wed Mar 30 23:54:39 2011 Return-path: Envelope-to: guile-bugs@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 1Q53LZ-0004Wc-M9 for guile-bugs@m.gmane.org; Wed, 30 Mar 2011 23:54:37 +0200 Original-Received: from localhost ([127.0.0.1]:58581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q53LZ-0006jD-24 for guile-bugs@m.gmane.org; Wed, 30 Mar 2011 17:54:37 -0400 Original-Received: from [140.186.70.92] (port=47036 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q53LS-0006iv-Vq for bug-guile@gnu.org; Wed, 30 Mar 2011 17:54:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q53LR-0004JF-1t for bug-guile@gnu.org; Wed, 30 Mar 2011 17:54:30 -0400 Original-Received: from mail3.uklinux.net ([80.84.72.33]:37076) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q53LQ-0004Il-Qs; Wed, 30 Mar 2011 17:54:29 -0400 Original-Received: from arudy (unknown [78.145.31.253]) by mail3.uklinux.net (Postfix) with ESMTP id 51C7D1F66A1; Wed, 30 Mar 2011 22:54:27 +0100 (BST) Original-Received: from neil-laptop (unknown [192.168.11.4]) by arudy (Postfix) with ESMTP id A985838013; Wed, 30 Mar 2011 22:54:25 +0100 (BST) In-Reply-To: (Andy Wingo's message of "Wed, 30 Mar 2011 23:25:39 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 80.84.72.33 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:5396 gmane.lisp.guile.devel:12100 Archived-At: Andy Wingo writes: > As for explanations... Catch and throw are implemented using fluids and > prompt and abort. (A discussion of that is here: > http://wingolog.org/archives/2010/02/14/sidelong-glimpses .) An abort > can pass arguments to the prompt's abort handler. It does so by pushing > those values and a number-of-values marker onto the Scheme stack, after > the Scheme and dynamic stacks are unwound to the prompt. The prompt > then needs to pop off those values and pass them to the handler. > > It so happens that this values-then-number-of-values convention is the > same convention as is used for multiple-value returns -- so for compiled > code what happens is that the compiler inlines the handler, and the VM > just does a multiple-value bind on the values from the stack. (See > truncate-values in the VM instruction docs.) > > That's what happens when `prompt' is compiled, as it is in eval.scm. > But before eval.scm is compiled, we use eval.c, which also has to have > support for prompt and abort; but it's necessarily a different > mechanism. This commit fixed a bug in that mechanism: that instead of > looking for the number-of-values marker (the exact integer that it was > expecting) from the VM's stack, as unwound by the abort, i.e. SCM_VM_DATA (vm), I presume > it was looking > for it at the VM's stack-pointer as seen when the prompt was created > -- i.e. SCM_PROMPT_REGISTERS (prompt) > which necessarily is below any values returned to the prompt's abort > handler. > > We didn't see this issue before because compiling eval.scm did not cause > a `throw'. Interesting, no? But since I changed the implementation of > ensure-writable-dir to one that probably throws, we see this error. > > Any other error that caused a `throw' to a `catch' to occur before > eval.scm was compiled probably caused this error in the past. I don't > know if we had any reports of it; I wouldn't be surprised. In any case, > a tricky bug, and a good one to have fixed. > > We do have prompt and abort tests for the VM implementation. We don't > run them with the boot evaluator, because we can't, not after eval.scm > is compiled -- and anyway, now compilation causes throws at times, so > we'll pick up these issues from users if it comes back. > > Hope that explains things :) It certainly does, thank you! Neil