[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] branch master updated: Avoid shuffle-down for tail calls

From: Andy Wingo
Subject: [Guile-commits] branch master updated: Avoid shuffle-down for tail calls
Date: Mon, 04 May 2020 16:01:16 -0400

This is an automated email from the git hooks/post-receive script.

wingo pushed a commit to branch master
in repository guile.

The following commit(s) were added to refs/heads/master by this push:
     new 6b2d56c  Avoid shuffle-down for tail calls
6b2d56c is described below

commit 6b2d56ce15c9f6126db6bd7d5951378e05b4303f
Author: Andy Wingo <address@hidden>
AuthorDate: Mon May 4 21:58:10 2020 +0200

    Avoid shuffle-down for tail calls
    * module/language/tree-il/compile-bytecode.scm (compile-closure): We can
      emit the precise move sequence and just do a reset-frame once, so go
      ahead and do that.
 module/language/tree-il/compile-bytecode.scm | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/module/language/tree-il/compile-bytecode.scm 
index 92f6a37..d0e5271 100644
--- a/module/language/tree-il/compile-bytecode.scm
+++ b/module/language/tree-il/compile-bytecode.scm
@@ -1246,10 +1246,13 @@ in the frame with for the lambda-case clause 
          (emit-return-values asm))
         (($ <call> src proc args)
-         (let ((from (stack-height env)))
-           (fold for-push (for-push proc env) args)
-           (emit-reset-frame asm (+ from 1 (length args)))
-           (emit-shuffle-down asm from 0)
+         (let* ((base (stack-height env))
+                (env (fold for-push (for-push proc env) args)))
+           (let lp ((i (length args)) (env env))
+             (when (<= 0 i)
+               (lp (1- i) (env-prev env))
+               (emit-mov asm (+ (env-idx env) base) (env-idx env))))
+           (emit-reset-frame asm (+ 1 (length args)))
            (emit-tail-call asm)))
         (($ <prompt>)       (visit-prompt exp env 'tail))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]