callees reserve their own local vars

* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.
* libguile/vm-i-system.c (reserve-locals): New instruction, to reserve
  space for local vars. Other ops renumbered.

* module/language/tree-il/compile-glil.scm (flatten-lambda): Emit
  reserve-locals instructions as necessary.

* test-suite/tests/tree-il.test: Update to expect reserve-locals as
  appropriate.
This commit is contained in:
Andy Wingo 2009-09-27 19:50:06 -04:00
commit 55d9bc947e
3 changed files with 52 additions and 35 deletions

View file

@ -194,6 +194,9 @@
(emit-code #f (make-glil-source (lambda-src x))))
;; check arity, potentially consing a rest list
(emit-code #f (make-glil-arity nargs nrest #f))
;; reserve space for locals, if necessary
(if (not (zero? nlocs))
(emit-code #f (make-glil-call 'reserve-locals nlocs)))
;; write bindings info
(if (not (null? ids))
(emit-bindings #f ids vars allocation x emit-code))