fix compilation of functions with more than 255 local variables.
authorAndy Wingo <wingo@pobox.com>
Wed, 20 Feb 2013 15:02:30 +0000 (16:02 +0100)
committerAndy Wingo <wingo@pobox.com>
Wed, 20 Feb 2013 15:02:30 +0000 (16:02 +0100)
* module/language/glil/compile-assembly.scm (glil->assembly): Fix case
  where there are more than 255 local variables.  Whoops!

module/language/glil/compile-assembly.scm

index 767fda3..4633485 100644 (file)
                 (else (error "what" op)))
               (let ((a (quotient index 256))
                     (b (modulo index 256)))
-                `((,(case op
-                      ((ref)
-                       (if boxed?
-                           `((long-local-ref ,a ,b)
-                             (variable-ref))
-                           `((long-local-ref ,a ,b))))
-                      ((set)
-                       (if boxed?
-                           `((long-local-ref ,a ,b)
-                             (variable-set))
-                           `((long-local-set ,a ,b))))
-                      ((box)
-                       `((make-variable)
-                         (variable-set)
-                         (long-local-set ,a ,b)))
-                      ((empty-box)
-                       `((make-variable)
-                         (long-local-set ,a ,b)))
-                      ((fix)
-                       `((fix-closure ,a ,b)))
-                      ((bound?)
-                       (if boxed?
-                           `((long-local-ref ,a ,b)
-                             (variable-bound?))
-                           `((long-local-bound? ,a ,b))))
-                      (else (error "what" op)))
-                   ,index))))
+                (case op
+                  ((ref)
+                   (if boxed?
+                       `((long-local-ref ,a ,b)
+                         (variable-ref))
+                       `((long-local-ref ,a ,b))))
+                  ((set)
+                   (if boxed?
+                       `((long-local-ref ,a ,b)
+                         (variable-set))
+                       `((long-local-set ,a ,b))))
+                  ((box)
+                   `((make-variable)
+                     (variable-set)
+                     (long-local-set ,a ,b)))
+                  ((empty-box)
+                   `((make-variable)
+                     (long-local-set ,a ,b)))
+                  ((fix)
+                   `((fix-closure ,a ,b)))
+                  ((bound?)
+                   (if boxed?
+                       `((long-local-ref ,a ,b)
+                         (variable-bound?))
+                       `((long-local-bound? ,a ,b))))
+                  (else (error "what" op)))))
           `((,(case op
                 ((ref) (if boxed? 'free-boxed-ref 'free-ref))
                 ((set) (if boxed? 'free-boxed-set (error "what." glil)))