From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marco Maggi Newsgroups: gmane.lisp.guile.user Subject: [OT] Re: Question on mutability of argument lists Date: Thu, 20 Mar 2014 11:06:18 +0100 Message-ID: <87zjklgp5x.fsf_-_@governatore.luna> References: <874n2unmvo.fsf@governatore.luna> <87txauouru.fsf@yeeloong.lan> Reply-To: marco.maggi-ipsu@poste.it NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: Quoted-Printable X-Trace: ger.gmane.org 1395309935 19710 80.91.229.3 (20 Mar 2014 10:05:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Mar 2014 10:05:35 +0000 (UTC) Cc: guile-user@gnu.org To: nisse@lysator.liu.se (Niels =?iso-8859-15?Q?M=F6ller?=) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Mar 20 11:05:44 2014 Return-path: Envelope-to: guile-user@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 1WQZr1-0003oS-Cb for guile-user@m.gmane.org; Thu, 20 Mar 2014 11:05:39 +0100 Original-Received: from localhost ([::1]:46125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQZr0-0006sB-QR for guile-user@m.gmane.org; Thu, 20 Mar 2014 06:05:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQZqg-0006f2-GG for guile-user@gnu.org; Thu, 20 Mar 2014 06:05:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQZqZ-0002Y6-6Z for guile-user@gnu.org; Thu, 20 Mar 2014 06:05:18 -0400 Original-Received: from relay-pt1.poste.it ([62.241.4.164]:47459) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQZqY-0002XO-Vr for guile-user@gnu.org; Thu, 20 Mar 2014 06:05:11 -0400 Original-Received: from governatore.luna (93.144.53.107) by relay-pt1.poste.it (8.5.142) (authenticated as marco.maggi-ipsu@poste.it) id 532A2FCF00026D13; Thu, 20 Mar 2014 11:05:07 +0100 Original-Sender: marco.maggi-ipsu@poste.it In-Reply-To: ("Niels =?iso-8859-15?Q?M=F6ller=22's?= message of "Wed, 19 Mar 2014 20:56:58 +0100") Original-Lines: 49 X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 62.241.4.164 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:11141 Archived-At: Niels M=F6ller wrote: > And somthing similar could be done even if the calling convention is th= e > "natural" one, that the caller conses the arguments onto a list as they > are evaluated, and passes that list to the implementation of the > procedure. The function prologue in the callee would then extract > arguments from that list, and only in the case that the function is > defined with a rest argument, the prologue calls list-copy. And the > compiler could even omit that list-copy in cases where it can infer tha= t > the list cannot be subject to any mutations. Yes. In some sense the caller would use the arguments list as "Scheme stack". > (It's long time since I played with lisp/scheme implementation, but the= n > I considered a calling convention where each procedure (and > continuation) would have two entry points, one with a single argument > passed in a register, and a second entry point where a pointer to an > argument list is passed in that register. The first entry point would b= e > used in the common case that there's a single argument or a single > return value. While the second entry point would be used when the numbe= r > of arguments is different from 1. Depending on number of arguments > accepted, one or the other of the entry points may point directly to > code raising an error). Mh... I have very few functions accepting a single argument. How would one implement continuations when a function argument is in a register (rather than on the Scheme stack, however implemented)? In a complex way I presume. Something similar can be done for return values[1]; in Vicare every function call site has 2 return points: one for single return value; the other for 0, 2, more return values. One return point goes on with the computation, the other raises an exception. If the callee returns a single value: it just does a RET to the address that was pushed on the stack by CALL. If it returns multiple values: it computes the other return point address which is at a fixed offset from the single-value return point. It is complex to setup this thing... [1] Ashley and Dybvig. "An Efficient Implementation of Multiple Return Values in Scheme". Proceedings of the 1994 ACM Conference on Lisp and Functional Programming, 140-149, Orlando, June 1994. --=20 "Now feel the funk blast!" Rage Against the Machine - "Calm like a bomb"