Skip to content
  • Nikodemus Siivola's avatar
    1.0.28.51: better MAKE-ARRAY transforms · e840f481
    Nikodemus Siivola authored
     * Add a source transform for MAKE-ARRAY that declaims LIST and VECTOR
       as NOTINLINE, so the the MAKE-ARRAY deftransforms are able to pick
       them apart (for DIMENSIONS and :INITIAL-CONTENTS.)
    
     * INITIALIZE-VECTOR is a new magic function with a IR2-CONVERT
       transform. It's purpose is to allow open coding :INITIAL-CONTENTS
       initialization without inhibiting stack allocation.
    
     * Turns out that making stack allocation decisions during locall
       analysis is not enough since optimization iterates: if a transform
       occurs and introduces new LVARs that would be good for DX after
       the locall analysis has run for the combination, the new LVARs
       will not get their share of stacky goodness. Therefore, after
       a transform propagate DX information to the new functional
       explicitly (see MAYBE-PROPAGATE-DYNAMIC-EXTENT.)
    
     * The new logic is in TRANSFORM-MAKE-ARRAY-VECTOR, which handles
       all the cases of vector allocation with a known element type:
    
       ** :INITIAL-CONTENTS (LIST ...), (VECTOR ...) and (BACKQ-LIST ...)
          are picked apart when the length matches the vector length,
          and their arguments are spliced into the call.
    
          Constant :INITIAL-CONTENTS is picked apart as well.
    
          Initialization is done using INITIALIZE-VECTOR.
    
       ** Otherwise :INITIAL-CONTENTS is splatted in place using
          REPLACE after we have checked that the length matches.
    
       ** :INITIAL-ELEMENT not EQL to the default element uses
          FILL.
    
       ** Otherwise the default initialization is fine.
    
       Some additional hair here, since MAYBE-PROPAGATE-DYNAMIC-EXTENT
       cannot deal with OPTIONAL-DISPATCH functionals. So to ensure we get
       full benefit of it, make sure the lambdas we transform to have only
       required arguments -- courtesy of new ELIMINATE-KEYWORD-ARGUMENT
       utility. (Note: it might be worth it to do something like this for
       many cases automatically, to reduce the number of lambdas the
       compiler generates. For inline lambdas we could do the whole &key
       handling _before_ the lambda is converted...)
    
     * Identify the case of (LIST N) as dimensions as being a vector,
       and delegate to TRANSFORM-MAKE-ARRAY-VECTOR.
    
     * More efficient allocation of simple multidimensional arrays in
       the presence of :INITIAL-CONTENTS (still slow, though) and
       :INITIAL-ELEMENT (not bad.)
    
     * Fix the source transform for VECTOR so that it too can stack
       allocate.
    
     * Updates tests and docs.
    e840f481