summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-11-30 22:16:59 +0100
committerAndy Wingo <wingo@pobox.com>2009-12-01 21:00:26 +0100
commit1d30393fbfac4b80dc9f3a5c8289ba4b55b345bb (patch)
tree1ab6aaa155010af4c7d01ba22b37fa0a13cf81c5
parent156d6fa1b5f44d9af0c0e5f6ba9275f4b450c19e (diff)
downloadguile-1d30393fbfac4b80dc9f3a5c8289ba4b55b345bb.tar.gz
wire through the existing vm ops for variable-ref and variable-set!
* module/language/tree-il/compile-glil.scm (*primcall-ops*): Compile variable-ref and variable-set instructions specially. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add cases for variable-ref and variable-set!. The latter is a little tricky, because the args are switched for the VM op, and we can't really change that easily.
-rw-r--r--module/language/tree-il/compile-glil.scm3
-rw-r--r--module/language/tree-il/primitives.scm6
2 files changed, 9 insertions, 0 deletions
diff --git a/module/language/tree-il/compile-glil.scm b/module/language/tree-il/compile-glil.scm
index 1781c4629..bef4ac7f0 100644
--- a/module/language/tree-il/compile-glil.scm
+++ b/module/language/tree-il/compile-glil.scm
@@ -112,6 +112,9 @@
((@slot-set! . 3) . slot-set)
((vector-ref . 2) . vector-ref)
((vector-set! . 3) . vector-set)
+ ((variable-ref . 1) . variable-ref)
+ ;; nb, *not* variable-set! -- the args are switched
+ ((variable-set . 2) . variable-set)
;; hack for javascript
((return . 1) return)
diff --git a/module/language/tree-il/primitives.scm b/module/language/tree-il/primitives.scm
index 50a002da6..07d4a5561 100644
--- a/module/language/tree-il/primitives.scm
+++ b/module/language/tree-il/primitives.scm
@@ -53,6 +53,8 @@
cdaaar cdaadr cdadar cdaddr cddaar cddadr cdddar cddddr
vector-ref vector-set!
+ variable-ref variable-set!
+ ;; args of variable-set are switched; it needs special help
bytevector-u8-ref bytevector-u8-set!
bytevector-s8-ref bytevector-s8-set!
@@ -291,3 +293,7 @@
(@call-with-current-continuation proc))
(define-primitive-expander values (x) x)
+
+;; swap args
+(define-primitive-expander variable-set! (var val)
+ (variable-set val var))