[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 09/27: Always emit return-values
From: |
Andy Wingo |
Subject: |
[Guile-commits] 09/27: Always emit return-values |
Date: |
Wed, 11 Nov 2015 11:39:09 +0000 |
wingo pushed a commit to branch master
in repository guile.
commit 696339a603b08d2b6a8f87482f63ef41358988e7
Author: Andy Wingo <address@hidden>
Date: Wed Oct 28 11:20:00 2015 +0000
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.
---
module/language/cps/compile-bytecode.scm | 10 ----------
module/system/vm/assembler.scm | 4 ++--
module/system/vm/disassembler.scm | 4 ++++
3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/module/language/cps/compile-bytecode.scm
b/module/language/cps/compile-bytecode.scm
index 22af821..1f7c664 100644
--- a/module/language/cps/compile-bytecode.scm
+++ b/module/language/cps/compile-bytecode.scm
@@ -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))))
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm
index d50ab13..c989ec6 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -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))))
diff --git a/module/system/vm/disassembler.scm
b/module/system/vm/disassembler.scm
index 233ba75..5e8b020 100644
--- a/module/system/vm/disassembler.scm
+++ b/module/system/vm/disassembler.scm
@@ -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)
- [Guile-commits] 06/27: return-values opcode resets the frame, (continued)
- [Guile-commits] 06/27: return-values opcode resets the frame, Andy Wingo, 2015/11/11
- [Guile-commits] 20/27: Scalar replacement for f64->scm, Andy Wingo, 2015/11/11
- [Guile-commits] 21/27: Add fadd, fsub, fmul, fdiv instructions, Andy Wingo, 2015/11/11
- [Guile-commits] 23/27: Fix slot representation computation for fadd, fmul, etc, Andy Wingo, 2015/11/11
- [Guile-commits] 19/27: bv-{f32, f64}-{ref, set!} operate on raw f64 values, Andy Wingo, 2015/11/11
- [Guile-commits] 25/27: Better f64 unboxing for loop vars that might flow to $ktail, Andy Wingo, 2015/11/11
- [Guile-commits] 17/27: Add VM ops to pack and unpack raw f64 values., Andy Wingo, 2015/11/11
- [Guile-commits] 03/27: CSE can run on first-order CPS, Andy Wingo, 2015/11/11
- [Guile-commits] 16/27: Stack slots can hold a double, Andy Wingo, 2015/11/11
- [Guile-commits] 12/27: Remove return opcode, Andy Wingo, 2015/11/11
- [Guile-commits] 09/27: Always emit return-values,
Andy Wingo <=
- [Guile-commits] 08/27: Replace return primcalls with $values, Andy Wingo, 2015/11/11
- [Guile-commits] 24/27: The compiler can unbox float64 loop variables, Andy Wingo, 2015/11/11
- [Guile-commits] 26/27: Remove debug printout in specialize-numbers, Andy Wingo, 2015/11/11
- [Guile-commits] 18/27: Type inference distinguishes between untagged and tagged flonums, Andy Wingo, 2015/11/11
- [Guile-commits] 02/27: Revert "Bootstrap build doesn't have to expand CPS optimizations", Andy Wingo, 2015/11/11