401cba673bda

Simplify and optimize register allocation just a bit
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 11 Jul 2016 22:33:25 +0000
parents 789aa5540746
children cb3cc671d18d
branches/tags (none)
files src/wam/compiler.lisp

Changes

--- a/src/wam/compiler.lisp	Mon Jul 11 21:38:10 2016 +0000
+++ b/src/wam/compiler.lisp	Mon Jul 11 22:33:25 2016 +0000
@@ -542,7 +542,7 @@
 
 (defstruct allocation-state
   (local-registers (vector) :type (vector t *)) ; todo should this be a (vector symbol) instead?
-  (stack-registers (make-array 1) :type (simple-array symbol (*)))
+  (stack-registers nil :type list)
   (permanent-variables nil :type list)
   (anonymous-variables nil :type list)
   (reserved-variables nil :type list)
@@ -656,15 +656,14 @@
        (local-registers (make-array 64
                           :fill-pointer (or reserved-arity actual-arity)
                           :adjustable t
-                          :initial-element nil))
+                          :initial-element 0))
        ;; We essentially "preallocate" all the permanent variables up front
        ;; because we need them to always be in the same stack registers across
        ;; all the terms of our clause.
        ;;
        ;; The ones that won't get used in this term will end up getting
        ;; flattened away anyway.
-       (stack-registers (make-array (length permanent-variables)
-                          :initial-contents permanent-variables))
+       (stack-registers permanent-variables)
        (allocation-state
          (make-allocation-state
            :local-registers local-registers