1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-23 12:00:21 +02:00

Compile variable-ref, variable-set!

* libguile/vm-engine (box-ref, box-set!): Instead of aborting if a box
  isn't a var, call out to vm_error_not_a_variable.  This makes these
  instructions equivalent to variable-ref/variable-set!.
  (vector-set!): Rename from vector-set.

* module/language/cps/compile-rtl.scm (emit-rtl-sequence): Add
  variable-set! case, and adapt vector-set!.

* module/language/cps/primitives.scm (*rtl-instruction-aliases*): Add
  variable-ref / variable-set! aliases to box-ref / box-set!.
This commit is contained in:
Andy Wingo 2013-10-26 15:40:49 +02:00
parent d023ae8679
commit 4f406fea7e
3 changed files with 10 additions and 5 deletions

View file

@ -215,7 +215,9 @@
(($ $primcall 'struct-set! (struct index value))
(emit-struct-set! asm (slot struct) (slot index) (slot value)))
(($ $primcall 'vector-set! (vector index value))
(emit-vector-set asm (slot vector) (slot index) (slot value)))
(emit-vector-set! asm (slot vector) (slot index) (slot value)))
(($ $primcall 'variable-set! (var val))
(emit-box-set! asm (slot var) (slot val)))
(($ $primcall 'set-car! (pair value))
(emit-set-car! asm (slot pair) (slot value)))
(($ $primcall 'set-cdr! (pair value))

View file

@ -39,7 +39,8 @@
(quotient . quo) (remainder . rem)
(modulo . mod)
(define! . define)
(vector-set! . vector-set)))
(variable-ref . box-ref)
(variable-set! . box-set!)))
(define *macro-instruction-arities*
'((cache-current-module! . (0 . 2))