fix peval to preserve effects when folding (values) forms
authorAndy Wingo <wingo@pobox.com>
Mon, 19 Dec 2011 14:51:54 +0000 (15:51 +0100)
committerAndy Wingo <wingo@pobox.com>
Mon, 19 Dec 2011 14:52:05 +0000 (15:52 +0100)
commit7cbadbc43d4a03c0fdd23dda54f4b3f887204e17
tree4ba7db2a6995e6bc1545dcf83d885826ea3c95c5
parentfa8110f2412c260d69db10739357ea593eb9eefe
fix peval to preserve effects when folding (values) forms

* module/language/tree-il/peval.scm (singly-valued-expression?): New
  helper.
  (truncate-values): Use the helper.
  (make-operand): Minor refactor.
  (set-operand-residual-value!): Try to undo the effects of (values
  FOO), if the continuation will check itself for the correct number of
  values.
  (peval): Fold helpers into fold-constant.  Add a constant-expression?
  case for (values FOO).  Add a new context: "values", for contexts in
  which multiple values are allowed, either because of being in a tail
  context relative to a function, or because of let-values.  "value" is
  now for single values.  Don't visit operands for "values", as their
  binding form truncates to one value.  Add a case to fold (values ...)
  forms.  Fix folding of (lambda), to process the cases in values
  context instead of tail context (which could have been "value", which
  would cause the procedure to truncate).
module/language/tree-il/peval.scm