1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 08:40:19 +02:00

rename goto/args and friends to tail-call, tail-apply, etc

* libguile/vm-i-system.c (tail-call, tail-call/nargs, tail-apply)
  (tail-call/cc): Rename these back to tail-* from goto/*. We should
  reserve the rename-then-goto name for when you actually do a rename
  and goto, not when you shuffle the stack.

* doc/ref/vm.texi:
* module/language/glil/decompile-assembly.scm:
* module/language/tree-il/compile-glil.scm:
* test-suite/tests/tree-il.test: Adapt all callers and documentation.
This commit is contained in:
Andy Wingo 2010-01-03 14:49:40 +01:00
parent 87a6a23669
commit a5bbb22e83
5 changed files with 34 additions and 36 deletions

View file

@ -1,6 +1,6 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
@c Copyright (C) 2008,2009
@c Copyright (C) 2008,2009,2010
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -678,14 +678,12 @@ and arguments off the stack, and push the result of calling
@code{scm_apply}.
@end deffn
@deffn Instruction goto/args nargs
@deffn Instruction tail-call nargs
Like @code{call}, but reusing the current continuation. This
instruction implements tail calls as required by RnRS.
For compiled procedures, that means that @code{goto/args} simply
For compiled procedures, that means that @code{tail-call} simply
shuffles down the procedure and arguments to the current stack frame.
The @code{goto/*} instruction family is named as it is because tail
calls are equivalent to @code{goto}, along with relabeled variables.
For non-VM procedures, the result is the same, but the current VM
invocation remains on the C stack. True tail calls are not currently
@ -693,16 +691,16 @@ possible between compiled and non-compiled procedures.
@end deffn
@deffn Instruction apply nargs
@deffnx Instruction goto/apply nargs
Like @code{call} and @code{goto/args}, except that the top item on the
@deffnx Instruction tail-apply nargs
Like @code{call} and @code{tail-call}, except that the top item on the
stack must be a list. The elements of that list are then pushed on the
stack and treated as additional arguments, replacing the list itself,
then the procedure is invoked as usual.
@end deffn
@deffn Instruction call/nargs
@deffnx Instruction goto/nargs
These are like @code{call} and @code{goto/args}, except they take the
@deffnx Instruction tail-call/nargs
These are like @code{call} and @code{tail-call}, except they take the
number of arguments from the stack instead of the instruction stream.
These instructions are used in the implementation of multiple value
returns, where the actual number of values is pushed on the stack.
@ -767,7 +765,7 @@ Signals an error if there is an insufficient number of values.
@end deffn
@deffn Instruction call/cc
@deffnx Instruction goto/cc
@deffnx Instruction tail-call/cc
Capture the current continuation, and then call (or tail-call) the
procedure on the top of the stack, with the continuation as the
argument.