mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 12:20:20 +02:00
allow primcall ops to push 0 values
* libguile/objcodes.c (OBJCODE_COOKIE): Bump the objcode cookie. We'll be doing this on incompatible changes until 2.0. * libguile/vm-i-scheme.c (set_car, set_cdr, slot_set): These instructions don't have natural return values -- so declare them that way, that they push 0 values. * module/language/tree-il/compile-glil.scm (flatten): When compiling primitive calls, check `(instruction-pushes op)' to see how many values that instruction will push, and do something appropriate, instead of just assuming that all primcall ops push 1 value.
This commit is contained in:
parent
a84673a68b
commit
60ed31d28b
3 changed files with 34 additions and 16 deletions
|
@ -22,6 +22,7 @@
|
|||
#:use-module (system base syntax)
|
||||
#:use-module (ice-9 receive)
|
||||
#:use-module (language glil)
|
||||
#:use-module (system vm instruction)
|
||||
#:use-module (language tree-il)
|
||||
#:use-module (language tree-il optimize)
|
||||
#:use-module (language tree-il analyze)
|
||||
|
@ -305,10 +306,20 @@
|
|||
=> (lambda (op)
|
||||
(for-each comp-push args)
|
||||
(emit-code src (make-glil-call op (length args)))
|
||||
(case context
|
||||
((tail) (emit-code #f (make-glil-call 'return 1)))
|
||||
((drop) (emit-code #f (make-glil-call 'drop 1))))))
|
||||
|
||||
(case (instruction-pushes op)
|
||||
((0)
|
||||
(case context
|
||||
((tail) (emit-code #f (make-glil-void))
|
||||
(emit-code #f (make-glil-call 'return 1)))
|
||||
((push vals) (emit-code #f (make-glil-void)))))
|
||||
((1)
|
||||
(case context
|
||||
((tail) (emit-code #f (make-glil-call 'return 1)))
|
||||
((drop) (emit-code #f (make-glil-call 'drop 1)))))
|
||||
(else
|
||||
(error "bad primitive op: too many pushes"
|
||||
op (instruction-pushes op))))))
|
||||
|
||||
(else
|
||||
(comp-push proc)
|
||||
(for-each comp-push args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue