From 9c41931d19448fb92a58133c854384b785b3e39f Mon Sep 17 00:00:00 2001 From: Stephen Adams Date: Thu, 7 Mar 1996 15:39:50 +0000 Subject: [PATCH] Added note about IF & NOT --- .../compiler/documentation/midend/cleanup.txt | 63 ++++++++++--------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/v8/src/compiler/documentation/midend/cleanup.txt b/v8/src/compiler/documentation/midend/cleanup.txt index cbf645bab..7918f0eaa 100644 --- a/v8/src/compiler/documentation/midend/cleanup.txt +++ b/v8/src/compiler/documentation/midend/cleanup.txt @@ -7,44 +7,47 @@ CLEANUP is a general optimization phase, called several times. It 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: --------------------- -- 2.25.1