Static array support

Raymond Toy toy.raymond at gmail.com
Mon Nov 30 16:04:49 CET 2009


Using an idea from Carl and some code from Lynn Quam that he sent many
years ago, I have checked in support for static arrays.  These look like
Lisp arrays in just about every way except that GC will not move them. 
GC will clean them up if they become garbage.  This is done be creating
the array storage by malloc'ing space.

To create a static array, use make-array with :allocation :static.

Limitations:

    * Since arrays are malloc'ed, the size and number of static arrays
      is limited to the size of the C heap, which is relatively small.
    * You are currently prevented from using adjust-array to change the
      size of the array.  (If the array grows, new malloc'ed space would
      be needed, and then the address would change, so this is disabled.)
    * Only certain unboxed element types are allowed: strings; 8, 16,
      and 32 bit integers (signed and unsigned); single and double
      floats; and complex single and double floats.
    * You cannot dump a static array.  Well, you can, but the reloaded
      array is no longer static.  No warning or error is currently issued.
    * You cannot make a displaced, static array.
    * You cannot make an adjustable static array.


The interface and implementation are still open.  Suggestions welcome on
the appropriate interface and behavior.  The next snapshot will have
this feature.

Ray




More information about the cmucl-imp mailing list