From: Stephen Adams Date: Mon, 4 Mar 1996 04:52:25 +0000 (+0000) Subject: Update. X-Git-Tag: 20090517-FFI~5677 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=95a8e984ddc185c2c6d1746cce44a939a972bea0;p=mit-scheme.git Update. --- diff --git a/v8/src/compiler/documentation/midend/cleanup.txt b/v8/src/compiler/documentation/midend/cleanup.txt index 74bef4a74..cbf645bab 100644 --- a/v8/src/compiler/documentation/midend/cleanup.txt +++ b/v8/src/compiler/documentation/midend/cleanup.txt @@ -7,17 +7,19 @@ 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 eliminates unused bound variables and substitutes bound -variables by their values if the expressions for the values are -sufficiently simple. Currently only the following value expressions -can be substituted: +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 - %VECTOR-INDEX, %STACK-CLOSURE-REF and %HEAP-CLOSURE-REF) in - which all of the operands trivial (QUOTE or LOOKUP forms, or - calls to trivial operators (%VECTOR-INDEX) with quoted operands) - and there is at most one LOOKUP argument. + %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. 2. CALL to a LAMBDA is not quite identical to a LET, because there is @@ -28,16 +30,22 @@ 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 ... (LAMBDA (...) body)) + (CALL %MAKE-HEAP-CLOSURE '#F (LAMBDA (...) body) ...) ...) This can be converted to the simpler form - (CALL (LAMBDA (...') body')) -if the body has no self-references. + (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. +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. + Operators Introduced: --------------------- none @@ -50,14 +58,13 @@ Special forms excluded: Special forms introduced: ------------------------- - none +none Magic Cookies handled specially: -------------------------------- %HEAP-CLOSURE-REF for optimization 3 and as part of the restriction on optimization 1. -%VECTOR-INDEX and %STACK-CLOSURE-REF as part of the restriction on - optimization 1. +%STACK-CLOSURE-REF as part of the restriction on optimization 1. %INTERNAL-APPLY for optimizations 3 and 4. %MAKE-HEAP-CLOSURE for optimization 3. %MAKE-TRIVIAL-CLOSURE for optimization 4. @@ -65,4 +72,7 @@ Magic Cookies handled specially: Guarantees on Output: --------------------- - No unused bindings. +1. No empty binding forms like (LET () e) +2. No `chained' bindings of the form (LET ((x y)) ...) + +[Original guarantee: `No unused bindings' is not true.]