I've been hacking on MAKE-ARRAY recently, to compile forms with
:INITIAL-CONTENTS more efficiently (currently :INITIAL-CONTENTS always
forces a full call to MAKE-ARRAY).
However, it has dawned to me that most of what I've been doing could be
(maybe) implemented better in terms of a new optimization framework.
The idea would be to extend defknown (or have a mechanism parallel to
defknown) with information about specific arguments:
(defknown make-array ((or index list)
(:displaced-to (or array null))
array (flushable unsafe))
would be accompanied with:
(defargfold make-array (&rest t))
to indicate that it's safe to constant-fold any argument to make-array (I
hope I'm not mistaken here). Likewise, MAPCAR and MAPLIST would be
(defargfold mapcar (&rest t))
(defargfold maplist (t &rest nil))
Now, my questions:
0) Does this make sense to anyone else? Is my thinking muddled
and this a bad idea, or just not worth the effort?
1) Does something to do effectively the same already exist in SBCL,
and if so, where can I find it?
2) If this makes sense, and nothing to this effect exists does
anyone have a hunch how hard this would be to do, and where
should I start looking at to do this?