primarly optimizes LETs and pseudo LETs (CALLs with LAMBDAs as their
operators). This is a restricted form of static beta-substitution.
-1. It substitutes bound variables by their values if the expressions for
-the values are sufficiently simple. Currently only the following value
-expressions can be substituted:
- a) LOOKUP forms.
- b) QUOTE forms.
- c) CALLs to a simple magic cookie procedure (currently
- %STACK-CLOSURE-REF and %HEAP-CLOSURE-REF). The essential
- property of such expressions is that they are side-effect
- insensitive and too cheap to pre-compute and bind to a
- name. (%HEAP-CLOSURE-REF is side-effect insensitive because
- %HEAP-CLOSURE-SET! is used only in limited ways to construct
- mutually referring closures).
+1. It substitutes bound variables by their values if the expressions
+ for the values are sufficiently simple. Currently only the
+ following value expressions can be substituted:
+ a) LOOKUP forms.
+ b) QUOTE forms.
+ c) CALLs to a simple magic cookie procedure (currently
+ %STACK-CLOSURE-REF and %HEAP-CLOSURE-REF). The essential
+ property of such expressions is that they are side-effect
+ insensitive and too cheap to pre-compute and bind to a
+ name. (%HEAP-CLOSURE-REF is side-effect insensitive because
+ %HEAP-CLOSURE-SET! is used only in limited ways to construct
+ mutually referring closures).
-The substitution is, of course, careful to avoid name capture.
+ The substitution is, of course, careful to avoid name capture.
2. CALL to a LAMBDA is not quite identical to a LET, because there is
-a continuation to be considered. If the continuation to the CALL is
-%MAKE-STACK-CLOSURE it is handled very specially (see code for
-details).
+ a continuation to be considered. If the continuation to the CALL
+ is %MAKE-STACK-CLOSURE it is handled very specially (see code for
+ details).
-3. There is special handling for calls to explicit heap closures (i.e.
-expressions of the form
- (CALL %INTERNAL-APPLY ...
- (CALL %MAKE-HEAP-CLOSURE '#F (LAMBDA (...) body) ...)
- ...)
-This can be converted to the simpler form
- (CALL (LAMBDA (...) body') ...)
-provided the body has no self-references.
+3. There is special handling for calls to explicit heap closures
+ i.e. expressions of the form
+ (CALL %INTERNAL-APPLY ...
+ (CALL %MAKE-HEAP-CLOSURE '#F (LAMBDA (...) body) ...)
+ ...)
+ This can be converted to the simpler form
+ (CALL (LAMBDA (...) body') ...)
+ provided the body has no self-references.
4. There is special handling for calls to explicit trivial closures,
-similar to that for explicit heap closures. This, too, replaces the
-closure with a LAMBDA expression.
+ similar to that for explicit heap closures. This, too, replaces
+ the closure with a LAMBDA expression.
5. Known operators with sufficiently constrained argument expressions
-are replaced by `simpler' expressions. Most generic arithmetic
-operations are constant-folded. Some are re-written, for example
- (fix:+ (fix:+ 1 x) 2)
-is rewritten to (fix:+ x 3) in two steps.
+ are replaced by `simpler' expressions. Most generic arithmetic
+ operations are constant-folded. Some are re-written, for example
+ (fix:+ (fix:+ 1 x) 2)
+ is rewritten to (fix:+ x 3) in two steps.
+
+6. IF expressions are also constant-folded, and there are a couple of
+ rewrites for improving combinations of IF and NOT.
Operators Introduced:
---------------------