Results 1 -
4 of
4
The semantics of Scheme control-flow analysis
- School of Computer Science, Pittsburgh
, 1991
"... This is a follow-on to my 1988 PLDI paper, “Control-Flow Analysis in Scheme”[9]. I usethe methodof abstractsemantic interpretations to explicate the control-flow analysis technique presented in that paper. I begin with a denotational semantics for CPS Scheme. I then present an alternate semantics th ..."
Abstract
-
Cited by 53 (3 self)
- Add to MetaCart
This is a follow-on to my 1988 PLDI paper, “Control-Flow Analysis in Scheme”[9]. I usethe methodof abstractsemantic interpretations to explicate the control-flow analysis technique presented in that paper. I begin with a denotational semantics for CPS Scheme. I then present an alternate semantics that precisely expresses the controlflow analysis problem. I abstract this semantics in a natural way, arriving at two different semantic interpretations giving approximate solutions to the flow analysis problem, each computable at compile time. The development of the final abstract semantics provides a clear, formal description of the analysis technique presented in “Control-Flow Analysis in Scheme.” 1
Super-fi: Copy, constant, and lambda propagation in Scheme. Working note #3
, 1990
"... This is an informal note intended for limited distribution. The text will reappear in my dissertation; it appears here for interested parties who don’t want to wait. The explication of the technique is a rough sketch, and assumes you are familiar with my paper “Data-Flow Analysis and Type Recovery i ..."
Abstract
-
Cited by 2 (1 self)
- Add to MetaCart
This is an informal note intended for limited distribution. The text will reappear in my dissertation; it appears here for interested parties who don’t want to wait. The explication of the technique is a rough sketch, and assumes you are familiar with my paper “Data-Flow Analysis and Type Recovery in Scheme.” 1 Copy propagation Copy propagation is a standard code improvement technique that is based on data-flow analysis. It is, for example, treated in chapter 10 of the Dragon book. Copy propagation essentially is removing variables that are just redundant copies of other variables. That is, if a reference x+3 to a variable x has only defs of the form x: = y,andy is unchanged along intervening control paths, then we can substitute y for its copy x: y+3. If we can do this with all the references to x, then we can remove the assignment to x completely. In Scheme, copy propagation is handled in some cases by simple-substitution. We can substitute y for x in: (let ((x y))
paper "Data-Flow Analysis and Type Recovery in Scheme." 1 Copy propagation
"... letrec ((lp ( (ans m c) (if (= m 0) (c ans) (lp (* ans m) (- m 1) c))))) (lp 1 n k))) The loop's continuation c is always bound to the procedure's continuation k, and is redundantly passed around the loop until it is invoked on loop termination. Applying copy propagation (and one round of useles ..."
Abstract
- Add to MetaCart
letrec ((lp ( (ans m c) (if (= m 0) (c ans) (lp (* ans m) (- m 1) c))))) (lp 1 n k))) The loop's continuation c is always bound to the procedure's continuation k, and is redundantly passed around the loop until it is invoked on loop termination. Applying copy propagation (and one round of useless-variable elimination to clean up afterwards) removes the iteration variable c entirely: (define (fact n k) (letrec ((lp ( (ans m) (if (= m 0) (k ans) (lp (* ans m) (- m 1)))))) (lp 1 n))) This sort of situation crops up all the time in CPS-expanded loops. The general form of Scheme copy propagation, then, is: For a given variable v, find all lexically inferior variables that are always bound to the value of v, and replace their references with references to v. With this definition, Scheme copy propagation acts as a sort of "super-fi" substitution rule. (If we allow side-effects to variables, this can disallow some possible substitutions. 2 If, on the other hand, we use an interm
Carnegie Mellon School of Computer Science
"... he novelty here is doing it all in the CPS intermediate representation. I adapted the code fragment we are working with from a real quicksort utility written in T with the Yale loop macro. The procedure (pick-median! v start end) picks the median of v[start], v[end], and v[(start+end)/2], swaps it ..."
Abstract
- Add to MetaCart
he novelty here is doing it all in the CPS intermediate representation. I adapted the code fragment we are working with from a real quicksort utility written in T with the Yale loop macro. The procedure (pick-median! v start end) picks the median of v[start], v[end], and v[(start+end)/2], swaps it into v[start], and returns it as pick-median!'s value. This would be an integrated procedure. The partition code looks like this: (define (quicksort-partition v start end) (loop (initial (value (pick-median! v start end)) (l start) (r (+ 1 end))) ;; Skip past left and right elts on the correct side of the partition. (next (l (loop (incr l in l) (while (! (vref v l) value)) (result l))) (r (loop (decr r in r) (while (! value (vref v r))) (result r)))) (while (! l r)) ;; Swap v[l] and v[r]. (do (set (vref v l) (swap (vref v r) (vref v l)))) ;; Swap v[start] and v[r], and return r. (after (set (vref v start) (swap (vref v r) (vref v start)))) (result r))) Consider the meat of the loop, expanded

