peval: simpler and more precise treatment of mutability
authorAndy Wingo <wingo@pobox.com>
Fri, 23 Sep 2011 10:43:04 +0000 (12:43 +0200)
committerAndy Wingo <wingo@pobox.com>
Sun, 25 Sep 2011 00:54:45 +0000 (02:54 +0200)
commit02ebea537fa805c615df44c4228db6a44d74c4b3
tree89a18ba8721e40d074f8bb7940e4b1e14bc38c90
parentcf82943f9f075248d803b31e19ddb8e933ad35ba
peval: simpler and more precise treatment of mutability

* module/language/tree-il/optimize.scm (peval): The old approach of
  optimistically producing constants and then de-constifying them at
  their uses was not only cumbersome but incorrect: it both failed to
  preserve identity in some cases and failed to retain immutable
  constant values.  Instead, now we only produce constants if they
  really are constant and immutable.  The constant folder has to have a
  few more algebraic cases to be as effective as it was, to destructure
  (car (cons _ _)) appropriately.  On the plus side, now constructors
  and deconstructors can handle impure cases more generally.

* test-suite/tests/tree-il.test ("partial evaluation"): Add constructor
  and destructuring tests.  Adapt other tests to new expectations.
module/language/tree-il/optimize.scm
test-suite/tests/tree-il.test