From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Lavine Newsgroups: gmane.lisp.guile.devel Subject: Re: Non-stack-copying call-with-current-continuation? Date: Thu, 1 Mar 2012 20:25:53 -0500 Message-ID: References: <87ty27eus4.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1330651588 16441 80.91.229.3 (2 Mar 2012 01:26:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 2 Mar 2012 01:26:28 +0000 (UTC) Cc: David Kastrup , guile-devel@gnu.org To: Nala Ginrut Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Mar 02 02:26:26 2012 Return-path: Envelope-to: guile-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 1S3HGI-0002ii-Ui for guile-devel@m.gmane.org; Fri, 02 Mar 2012 02:26:23 +0100 Original-Received: from localhost ([::1]:54812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3HGI-0006Vy-B0 for guile-devel@m.gmane.org; Thu, 01 Mar 2012 20:26:22 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3HGE-0006V3-Pd for guile-devel@gnu.org; Thu, 01 Mar 2012 20:26:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S3HGD-0005Dg-8r for guile-devel@gnu.org; Thu, 01 Mar 2012 20:26:18 -0500 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:54398) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3HFr-0005BR-JI; Thu, 01 Mar 2012 20:25:55 -0500 Original-Received: by iajr24 with SMTP id r24so1945765iaj.0 for ; Thu, 01 Mar 2012 17:25:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=SuRNgt9jVkdePdsK2VEpRKOyamnswZdEtWfPLO2HbtM=; b=nz7Z7XQw87kGXj5ZudIFa+JafULYb+4CI1H88AVrNBJZ2GFjspKAD+q4vqYO9+8WB8 yCoOPUAhQip95CSCaW0Qmf6oVSoKXFsQkM+p11UD6ZCVOlrAjd5g4mIy7OH0ueoYSVNR d8BuY+SDpglshgchq/4BiuEZmsjF46V1mz8ZHAtjvtCW/3fn2JE/yuZXyjNsVxrEg37P kHCjbEeKbtPMP4btcUtlto92sD2rMqe94h2T4MhLe80iSKjVdevFviSdBWEHLNxJduJI TTTwJJXw+3RPs/lAFGAIiGzN2kPBIIEn2uu63dpwAhRmyq1AZOF3WchFojsdsh7mxWKq O/Ig== Original-Received: by 10.50.178.8 with SMTP id cu8mr163093igc.12.1330651553267; Thu, 01 Mar 2012 17:25:53 -0800 (PST) Original-Received: by 10.231.16.199 with HTTP; Thu, 1 Mar 2012 17:25:53 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: rxmd-hRexpIFskN-Qh2eij_adbI X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.169 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:13977 Archived-At: Hello, > IIRC, the stack copying in Guile's continuation implementation is > inevitable. Though it's inefficient, the consideration is to cooperate with > other languages such as C. It's inevitable in the general case, where the continuation might return multiple times. However, in this situation, he knows the continuation will only ever return once, so it is not necessary to copy the stack. This control structure will be the equivalent of setjmp and longjmp in C. Prompts have an optimization where they don't actually copy the stack if it is clear that they can only return once. That is why catch and throw are implemented that way. Noah