Commit [e8011f] Maximize Restore History

1.0.48.25: automatic &rest to &more conversion

lp#504575

Automatically convert

(values-list rest-arg)
to
(%more-arg-values more-context 0 more-count)

when possible, making functions such as

(defun foo (f1 f2 &rest args)
(apply f1 args)
(apply f2 args))

non-consing.

The conversion is done iff:

* The rest arg is never assigned to.

* The rest arg only appears in VALUES-LIST (incl. APPLY)
calls.

* Those calls are all in either the same lambda that
allocates the rest-list, or one that has been declared
dynamic extent. (Conservative guess re. escaping.)

The way this works is as follows:

1. When we convert a lambda with a non-ignored &rest argument, as add
more-context and more-count arguments to the function, and
stick their lambda-vars into arg-info-default of the &rest arg.

2. When we source-transform a values-list form, we check if its argument is
a &rest argument for which context and count are available. If so, we
source-transform into

(%values-list-or-context list context count)

3. When we are optimizing, a deftransform fires for the form above. It
checks if all the necessary conditions hold and converts into either
%more-arg-values or values-list.

The reason for this roundabout way of doing things lies in locall analysis:
unless the extra context and count argument are used nontrivially when it
runs, they get deleted -- and we don't know if we want them or not until the
entire function has been converted. Absent a convenient pass between
conversion and locall analysis, we must therefore do things in two stages.

Nikodemus Siivola Nikodemus Siivola 2011-05-25

changed doc/manual/efficiency.texinfo
changed src/code/debug-int.lisp
changed src/code/debug.lisp
changed src/compiler/debug-dump.lisp
changed src/compiler/fndb.lisp
changed src/compiler/ir1tran-lambda.lisp
changed src/compiler/locall.lisp
changed src/compiler/node.lisp
changed src/compiler/srctran.lisp
changed tests/debug.impure.lisp
changed tests/dynamic-extent.impure.lisp
changed NEWS
changed version.lisp-expr
doc/manual/efficiency.texinfo Diff Switch to side-by-side view
Loading...
src/code/debug-int.lisp Diff Switch to side-by-side view
Loading...
src/code/debug.lisp Diff Switch to side-by-side view
Loading...
src/compiler/debug-dump.lisp Diff Switch to side-by-side view
Loading...
src/compiler/fndb.lisp Diff Switch to side-by-side view
Loading...
src/compiler/ir1tran-lambda.lisp Diff Switch to side-by-side view
Loading...
src/compiler/locall.lisp Diff Switch to side-by-side view
Loading...
src/compiler/node.lisp Diff Switch to side-by-side view
Loading...
src/compiler/srctran.lisp Diff Switch to side-by-side view
Loading...
tests/debug.impure.lisp Diff Switch to side-by-side view
Loading...
tests/dynamic-extent.impure.lisp Diff Switch to side-by-side view
Loading...
NEWS Diff Switch to side-by-side view
Loading...
version.lisp-expr Diff Switch to side-by-side view
Loading...