[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, master, updated. release_1-9-6-63-ga5b
From: |
Andy Wingo |
Subject: |
[Guile-commits] GNU Guile branch, master, updated. release_1-9-6-63-ga5bbb22 |
Date: |
Sun, 03 Jan 2010 13:54:06 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=a5bbb22e83fc724650973dab5eb6f3eccbc1f65c
The branch, master has been updated
via a5bbb22e83fc724650973dab5eb6f3eccbc1f65c (commit)
from 87a6a23669dc534df5d3de146e77efd3a2bafb22 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a5bbb22e83fc724650973dab5eb6f3eccbc1f65c
Author: Andy Wingo <address@hidden>
Date: Sun Jan 3 14:49:40 2010 +0100
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.
-----------------------------------------------------------------------
Summary of changes:
doc/ref/vm.texi | 18 ++++++++----------
libguile/vm-i-system.c | 20 ++++++++++----------
module/language/glil/decompile-assembly.scm | 6 +++---
module/language/tree-il/compile-glil.scm | 12 ++++++------
test-suite/tests/tree-il.test | 14 +++++++-------
5 files changed, 34 insertions(+), 36 deletions(-)
diff --git a/doc/ref/vm.texi b/doc/ref/vm.texi
index fe5c1ee..b64c2a6 100644
--- a/doc/ref/vm.texi
+++ b/doc/ref/vm.texi
@@ -1,6 +1,6 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C) 2008,2009
address@hidden 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
address@hidden Instruction goto/args nargs
address@hidden 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
address@hidden Instruction goto/apply nargs
-Like @code{call} and @code{goto/args}, except that the top item on the
address@hidden 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
address@hidden Instruction goto/nargs
-These are like @code{call} and @code{goto/args}, except they take the
address@hidden 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
address@hidden Instruction goto/cc
address@hidden 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.
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c
index a12f465..99c6381 100644
--- a/libguile/vm-i-system.c
+++ b/libguile/vm-i-system.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001,2008,2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001,2008,2009,2010 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -808,11 +808,11 @@ VM_DEFINE_INSTRUCTION (54, call, "call", 1, -1, 1)
goto vm_error_wrong_type_apply;
}
-VM_DEFINE_INSTRUCTION (55, goto_args, "goto/args", 1, -1, 1)
+VM_DEFINE_INSTRUCTION (55, tail_call, "tail-call", 1, -1, 1)
{
register SCM x;
nargs = FETCH ();
- vm_goto_args:
+ vm_tail_call:
x = sp[-nargs];
VM_HANDLE_INTERRUPTS;
@@ -850,7 +850,7 @@ VM_DEFINE_INSTRUCTION (55, goto_args, "goto/args", 1, -1, 1)
if (SCM_STRUCTP (x) && SCM_STRUCT_APPLICABLE_P (x))
{
sp[-nargs] = SCM_STRUCT_PROCEDURE (x);
- goto vm_goto_args;
+ goto vm_tail_call;
}
/*
* Other interpreted or compiled call
@@ -886,13 +886,13 @@ VM_DEFINE_INSTRUCTION (55, goto_args, "goto/args", 1, -1,
1)
goto vm_error_wrong_type_apply;
}
-VM_DEFINE_INSTRUCTION (56, goto_nargs, "goto/nargs", 0, 0, 1)
+VM_DEFINE_INSTRUCTION (56, tail_call_nargs, "tail-call/nargs", 0, 0, 1)
{
SCM x;
POP (x);
nargs = scm_to_int (x);
/* FIXME: should truncate values? */
- goto vm_goto_args;
+ goto vm_tail_call;
}
VM_DEFINE_INSTRUCTION (57, call_nargs, "call/nargs", 0, 0, 1)
@@ -995,7 +995,7 @@ VM_DEFINE_INSTRUCTION (59, apply, "apply", 1, -1, 1)
goto vm_call;
}
-VM_DEFINE_INSTRUCTION (60, goto_apply, "goto/apply", 1, -1, 1)
+VM_DEFINE_INSTRUCTION (60, tail_apply, "tail-apply", 1, -1, 1)
{
int len;
SCM ls;
@@ -1011,7 +1011,7 @@ VM_DEFINE_INSTRUCTION (60, goto_apply, "goto/apply", 1,
-1, 1)
PUSH_LIST (ls, SCM_NULL_OR_NIL_P);
nargs += len - 2;
- goto vm_goto_args;
+ goto vm_tail_call;
}
VM_DEFINE_INSTRUCTION (61, call_cc, "call/cc", 0, 1, 1)
@@ -1051,7 +1051,7 @@ VM_DEFINE_INSTRUCTION (61, call_cc, "call/cc", 0, 1, 1)
}
}
-VM_DEFINE_INSTRUCTION (62, goto_cc, "goto/cc", 0, 1, 1)
+VM_DEFINE_INSTRUCTION (62, tail_call_cc, "tail-call/cc", 0, 1, 1)
{
int first;
SCM proc, cont;
@@ -1065,7 +1065,7 @@ VM_DEFINE_INSTRUCTION (62, goto_cc, "goto/cc", 0, 1, 1)
PUSH (proc);
PUSH (cont);
nargs = 1;
- goto vm_goto_args;
+ goto vm_tail_call;
}
else if (SCM_VALUESP (cont))
{
diff --git a/module/language/glil/decompile-assembly.scm
b/module/language/glil/decompile-assembly.scm
index 9163538..9e3a00b 100644
--- a/module/language/glil/decompile-assembly.scm
+++ b/module/language/glil/decompile-assembly.scm
@@ -1,6 +1,6 @@
;;; Guile VM code converters
-;; Copyright (C) 2001, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -183,9 +183,9 @@
(cons (make-glil-call 'mul 2)
(emit-constants (list-head stack 2) out))
(+ pos 1)))
- ((goto/args ,n)
+ ((tail-call ,n)
(lp (cdr in) (list-tail stack (1+ n))
- (cons (make-glil-call 'goto/args n)
+ (cons (make-glil-call 'tail-call n)
(emit-constants (list-head stack (1+ n)) out))
(+ pos 2)))
(else (error "unsupported decompilation" (car in)))))))))
diff --git a/module/language/tree-il/compile-glil.scm
b/module/language/tree-il/compile-glil.scm
index a79be41..32c5b03 100644
--- a/module/language/tree-il/compile-glil.scm
+++ b/module/language/tree-il/compile-glil.scm
@@ -1,6 +1,6 @@
;;; TREE-IL -> GLIL compiler
-;; Copyright (C) 2001,2008,2009 Free Software Foundation, Inc.
+;; Copyright (C) 2001,2008,2009,2010 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -277,7 +277,7 @@
((tail)
(comp-push proc)
(for-each comp-push args)
- (emit-code src (make-glil-call 'goto/apply (1+ (length
args)))))
+ (emit-code src (make-glil-call 'tail-apply (1+ (length
args)))))
((push)
(emit-code src (make-glil-call 'new-frame 0))
(comp-push proc)
@@ -344,12 +344,12 @@
(comp-push producer)
(emit-code src (make-glil-mv-call 0 MV))
(case context
- ((tail) (emit-code src (make-glil-call 'goto/args 1)))
+ ((tail) (emit-code src (make-glil-call 'tail-call 1)))
(else (emit-code src (make-glil-call 'call 1))
(emit-branch #f 'br POST)))
(emit-label MV)
(case context
- ((tail) (emit-code src (make-glil-call 'goto/nargs 0)))
+ ((tail) (emit-code src (make-glil-call 'tail-call/nargs 0)))
(else (emit-code src (make-glil-call 'call/nargs 0))
(emit-label POST)
(if (eq? context 'drop)
@@ -362,7 +362,7 @@
(case context
((tail)
(comp-push (car args))
- (emit-code src (make-glil-call 'goto/cc 1)))
+ (emit-code src (make-glil-call 'tail-call/cc 1)))
((vals)
(comp-vals
(make-application
@@ -482,7 +482,7 @@
(for-each comp-push args)
(let ((len (length args)))
(case context
- ((tail) (emit-code src (make-glil-call 'goto/args len)))
+ ((tail) (emit-code src (make-glil-call 'tail-call len)))
((push) (emit-code src (make-glil-call 'call len))
(maybe-emit-return))
((vals) (emit-code src (make-glil-mv-call len MVRA))
diff --git a/test-suite/tests/tree-il.test b/test-suite/tests/tree-il.test
index 3fe6865..f7cc75b 100644
--- a/test-suite/tests/tree-il.test
+++ b/test-suite/tests/tree-il.test
@@ -1,7 +1,7 @@
;;;; tree-il.test --- test suite for compiling tree-il -*- scheme -*-
;;;; Andy Wingo <address@hidden> --- May 2009
;;;;
-;;;; Copyright (C) 2009 Free Software Foundation, Inc.
+;;;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -69,7 +69,7 @@
(with-test-prefix "application"
(assert-tree-il->glil
(apply (toplevel foo) (const 1))
- (program () (std-prelude 0 0 #f) (label _) (toplevel ref foo) (const 1)
(call goto/args 1)))
+ (program () (std-prelude 0 0 #f) (label _) (toplevel ref foo) (const 1)
(call tail-call 1)))
(assert-tree-il->glil
(begin (apply (toplevel foo) (const 1)) (void))
(program () (std-prelude 0 0 #f) (label _) (call new-frame 0) (toplevel ref
foo) (const 1) (mv-call 1 ,l1)
@@ -81,7 +81,7 @@
(assert-tree-il->glil
(apply (toplevel foo) (apply (toplevel bar)))
(program () (std-prelude 0 0 #f) (label _) (toplevel ref foo) (call
new-frame 0) (toplevel ref bar) (call call 0)
- (call goto/args 1))))
+ (call tail-call 1))))
(with-test-prefix "conditional"
(assert-tree-il->glil
@@ -457,7 +457,7 @@
(with-test-prefix "apply"
(assert-tree-il->glil
(apply (primitive @apply) (toplevel foo) (toplevel bar))
- (program () (std-prelude 0 0 #f) (label _) (toplevel ref foo) (toplevel ref
bar) (call goto/apply 2)))
+ (program () (std-prelude 0 0 #f) (label _) (toplevel ref foo) (toplevel ref
bar) (call tail-apply 2)))
(assert-tree-il->glil
(begin (apply (primitive @apply) (toplevel foo) (toplevel bar)) (void))
(program () (std-prelude 0 0 #f) (label _)
@@ -471,12 +471,12 @@
(program () (std-prelude 0 0 #f) (label _)
(toplevel ref foo)
(call new-frame 0) (toplevel ref bar) (toplevel ref baz) (call
apply 2)
- (call goto/args 1))))
+ (call tail-call 1))))
(with-test-prefix "call/cc"
(assert-tree-il->glil
(apply (primitive @call-with-current-continuation) (toplevel foo))
- (program () (std-prelude 0 0 #f) (label _) (toplevel ref foo) (call goto/cc
1)))
+ (program () (std-prelude 0 0 #f) (label _) (toplevel ref foo) (call
tail-call/cc 1)))
(assert-tree-il->glil
(begin (apply (primitive @call-with-current-continuation) (toplevel foo))
(void))
(program () (std-prelude 0 0 #f) (label _)
@@ -491,7 +491,7 @@
(program () (std-prelude 0 0 #f) (label _)
(toplevel ref foo)
(toplevel ref bar) (call call/cc 1)
- (call goto/args 1))))
+ (call tail-call 1))))
(with-test-prefix "tree-il-fold"
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, master, updated. release_1-9-6-63-ga5bbb22,
Andy Wingo <=