mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 03:30:27 +02:00
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.
This commit is contained in:
parent
f0a9e537a0
commit
6b2d56ce15
1 changed files with 7 additions and 4 deletions
|
@ -1246,10 +1246,13 @@ in the frame with for the lambda-case clause @var{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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue