mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Always emit return-values
* module/language/cps/compile-bytecode.scm (compile-function): Remove special cases for nullary and unary returns; instead always use return-values and rely on hinting to try to place values in the right slot already. * module/system/vm/assembler.scm (emit-init-constants): Use return-values. * module/system/vm/disassembler.scm (code-annotation): Add annotation for return-values.
This commit is contained in:
parent
2f08838cd6
commit
696339a603
3 changed files with 6 additions and 12 deletions
|
@ -122,16 +122,6 @@
|
|||
((src . dst) (emit-mov asm (from-sp dst) (from-sp src))))
|
||||
(lookup-parallel-moves label allocation))
|
||||
(emit-tail-call-label asm (1+ (length args)) k))
|
||||
(($ $values ())
|
||||
(emit-return-values asm 1))
|
||||
(($ $values (arg))
|
||||
(if (maybe-slot arg)
|
||||
(emit-return asm (from-sp (slot arg)))
|
||||
(begin
|
||||
(when (< frame-size 2)
|
||||
(emit-alloc-frame asm 2))
|
||||
(emit-load-constant asm (from-sp 1) (constant arg))
|
||||
(emit-return asm (from-sp 1)))))
|
||||
(($ $values args)
|
||||
(for-each (match-lambda
|
||||
((src . dst) (emit-mov asm (from-sp dst) (from-sp src))))
|
||||
|
|
|
@ -1243,8 +1243,8 @@ a procedure to do that and return its label. Otherwise return
|
|||
`((begin-program ,label ())
|
||||
(assert-nargs-ee/locals 1 1)
|
||||
,@(reverse inits)
|
||||
(load-constant 1 ,*unspecified*)
|
||||
(return 1)
|
||||
(load-constant 0 ,*unspecified*)
|
||||
(return-values 2)
|
||||
(end-program)))
|
||||
label))))
|
||||
|
||||
|
|
|
@ -224,6 +224,10 @@ address of that offset."
|
|||
(list "~a slot~:p" nlocals))
|
||||
(('reset-frame nlocals)
|
||||
(list "~a slot~:p" nlocals))
|
||||
(('return-values nlocals)
|
||||
(if (zero? nlocals)
|
||||
(list "all values")
|
||||
(list "~a value~:p" (1- nlocals))))
|
||||
(('bind-rest dst)
|
||||
(list "~a slot~:p" (1+ dst)))
|
||||
(('tail-call nargs proc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue