1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-17 23:52:24 +02:00

RTL VM: receive-values has allow-extra? flag

* libguile/vm-engine.c (receive-values): Add an ALLOW-EXTRA? flag in
  unused bits of the third word.  Without it, receive-values will check
  for the exact number of incoming values.

* libguile/vm.c (vm_error_wrong_number_of_values): New error case.

* module/language/cps/compile-rtl.scm (emit-rtl-sequence): Adapt to add
  the ALLOW-EXTRA? flag.
This commit is contained in:
Andy Wingo 2013-10-14 16:09:43 +02:00
parent c6cd692f08
commit 82f4bac420
3 changed files with 23 additions and 7 deletions

View file

@ -273,7 +273,10 @@
(match args
(()
(emit-call asm proc-slot (+ nargs 1))
(emit-receive-values asm proc-slot nreq)
;; FIXME: Only allow more values if there is a rest arg.
;; Express values truncation by the presence of an
;; unused rest arg instead of implicitly.
(emit-receive-values asm proc-slot #t nreq)
(when rest?
(emit-bind-rest asm (+ proc-slot 1 nreq)))
(for-each (match-lambda