## Proving the Correctness of Compiler Optimisations Based on Strictness Analysis (1993)

Venue: | in Proceedings 5th int. Symp. on Programming Language Implementation and Logic Programming, LNCS 714 |

Citations: | 4 - 2 self |

### BibTeX

@INPROCEEDINGS{Burn93provingthe,

author = {Geoffrey Burn and Daniel Le Métayer},

title = {Proving the Correctness of Compiler Optimisations Based on Strictness Analysis},

booktitle = {in Proceedings 5th int. Symp. on Programming Language Implementation and Logic Programming, LNCS 714},

year = {1993},

pages = {346--364},

publisher = {Springer Verlag}

}

### OpenURL

### Abstract

. We show that compiler optimisations based on strictness analysis can be expressed formally in the functional framework using continuations. This formal presentation has two benefits: it allows us to give a rigorous correctness proof of the optimised compiler; and it exposes the various optimisations made possible by a strictness analysis. 1 Introduction Realistic compilers for imperative or functional languages include a number of optimisations based on non-trivial global analyses. Proving the correctness of such optimising compilers can be done in three steps: 1. proving the correctness of the original (unoptimised) compiler; 2. proving the correctness of the analysis; and 3. proving the correctness of the modifications of the simple-minded compiler to exploit the results of the analysis. A substantial amount of work has been devoted to steps (1) and (2) but there have been surprisingly few attempts at tackling step (3). In this paper we show how to carry out this third step in the...

### Citations

658 | Systematic design of program analysis frameworks - Cousot, Cousot - 1979 |

632 |
Compiling with Continuations
- Appel
- 1992
(Show Context)
Citation Context ...e first to show that it was beneficial to do this for Scheme programs in his seminal work on the Rabbit compiler [Ste78]. Some of the most efficient implementations of Scheme [KKR + 86, Kra88] and ML =-=[App92]-=- use cps-translation. This experience suggests that it might be worthwhile using cps-translation in compilers for lazy functional languages. The alternative cps-translations we have given in this pape... |

294 | Abstract interpretation and application to logic programs - Cousot, Cousot - 1992 |

271 | Semantics of Programming Languages: Structures and Techniques. Foundations of Computing - Gunter - 1992 |

243 | Abstract Interpretation Frameworks - Cousot, Cousot - 1992 |

220 |
Call-by-name, call-by-value and the -calculus
- Plotkin
- 1975
(Show Context)
Citation Context ...ted to the function. The important point about N [[E]] is that it has at most one redex outside the scope of a lambda, which means that call-by-value and call-by-name coincide for the translated term =-=[Plo75]-=-. Furthermore, this redex is always at the head of the expression [FM91], and the expression can be reduced without dynamic search for the next redex, just like machine code. The rule for application ... |

163 | Reasoning about programs in continuation-passing style
- Sabry, Felleisen
- 1993
(Show Context)
Citation Context ... + 1 E = F (plus 2 7): Applying the translation rules from Figure 3 yields, after reducing "administrative redexes" introduced by the translation process (the interested reader can find in [=-=DF91] and [SF92]-=- techniques for the systematic elimination of administrative redexes): N [[F ]] = c:c F 1 F 1 = c:x:x (m:plus c c m 1) N [[E]] = c:F 1 c (c:(plus c c 2 7)): The application of N [[E]] to some continua... |

127 | The categorical abstract machine - Cousineau, Curien, et al. - 1987 |

104 | Unboxed values as first class citizens in a nonstrict functional language
- Jones, Launchbury
- 1991
(Show Context)
Citation Context ...valuated) argument is being passed in a closure in the heap (i.e. whether or not it is `boxed'); important information for a compiler-writer. This appears to be a natural alternative to that given in =-=[JL91]-=- for expressing the boxed/unboxed distinction. In the translation rules, we state what properties must hold in order to use particular rules. Safe approximations to these properties can be determined ... |

100 | Lambda Calculus Schemata
- Fischer
- 1972
(Show Context)
Citation Context ...n differs slightly from the usual presentation of the cps-translation [Rey74, Plo75]: the continuation is passed as the first argument to a function rather than as the second argument (as was done in =-=[Fis72]-=-). This change is motivated by the subsequent steps of the compiler. We stress that the work of this paper is independent of this change of argument order, but has been presented in this way so that o... |

99 | Economic Analysis of - Radtke, Davis - 2000 |

93 | Abstract Interpretation and Optimising Transformations for Applicative Programs - Mycroft - 1981 |

93 |
Rabbit: A compiler for Scheme
- Jr
- 1978
(Show Context)
Citation Context ...yle as an early stage in a compiler is of more than theoretical interest. Steele was the first to show that it was beneficial to do this for Scheme programs in his seminal work on the Rabbit compiler =-=[Ste78]-=-. Some of the most efficient implementations of Scheme [KKR + 86, Kra88] and ML [App92] use cps-translation. This experience suggests that it might be worthwhile using cps-translation in compilers for... |

82 | Representing control: A study of the CPS transformation
- Danvy, Filinski
- 1992
(Show Context)
Citation Context ...cy: F = x:x + 1 E = F (plus 2 7): Applying the translation rules from Figure 3 yields, after reducing "administrative redexes" introduced by the translation process (the interested reader ca=-=n find in [DF91]-=- and [SF92] techniques for the systematic elimination of administrative redexes): N [[F ]] = c:c F 1 F 1 = c:x:x (m:plus c c m 1) N [[E]] = c:F 1 c (c:(plus c c 2 7)): The application of N [[E]] to so... |

70 | S.: Strictness analysis for higher-order functions - Burn, Hankin, et al. - 1986 |

57 | Strictness Analysis: a New Perspective Based on Type Inference - Kuo, Mishra - 1989 |

54 | Strictness analysis on non-flat domains (by abstract interpretation - Wadler - 1987 |

52 | Deriving target code as a representation of continuation semantics - Wand - 1982 |

47 | On the relation between direct and continuation semantics - Reynolds - 1974 |

46 |
Lazy Functional Languages: Abstract Interpretation and Compilation
- Burn
- 1991
(Show Context)
Citation Context ...ion entails that evaluated values are systematically passed unboxed. As in [Les88], only simple strictness information is considered. A less thoroughgoing attempt at this problem is also presented in =-=[Bur91b]-=-, which shows that the operational model underlying the transformation given in Figure 6 is correct. It also shows how to use this information in compiling code for an abstract machine, but the correc... |

40 | Advice on structuring compilers and proving them correct - Morris - 1973 |

40 | Two-level semantics and abstract interpretation - Nielson - 1989 |

37 |
Compilation of functional languages by program transformation
- Fradet, Métayer
- 1991
(Show Context)
Citation Context ...s, which use strictness information to generate better code, and are proven to preserve the semantics of programs. Any of these can then replace the cps-translation phase in the compiler described in =-=[FM91]-=-, so that we can demonstrate an optimising compiler which has been proved correct. We start by showing how simple strictness information can be used to change evaluation order (Section 2.1). This is t... |

31 | Abstract Interpretation in Logical Form - Jensen - 1992 |

29 | Two-level semantics and code generation - Nielson, Nielson - 1988 |

26 | CPS transformation after strictness analysis
- Danvy, Hatcliff
- 1993
(Show Context)
Citation Context ...Also their methods deal with local transformations where strictness-based optimisations involve global modifications of the program. The works that are closest in spirit to this paper are [Les88] and =-=[DH92]-=-. The first states a correctness property of an optimisation based on strictness analysis in the context of combinator graph reduction on a version of the Gmachine. The result however is limited to si... |

26 |
Program transformations in a denotational setting
- Nielson
- 1985
(Show Context)
Citation Context ...imisations relying on a global analysis. The latter are more difficult to validate because they involve context-dependent transformations. The only papers addressing this issue, to our knowledge, are =-=[Nie85]-=- and [Ger75]. The second paper is concerned with partial correctness and relies on program annotations and theorem-proving methods. The first paper considers a simple imperative language and a collect... |

26 | More on advice on structuring compilers and proving them correct - Thatcher, Wagner, et al. - 1981 |

25 | Abstract Interpretation of Functional Languages: From Theory to Practice - Hunt - 1991 |

19 | Disjunctive strictness analysis - Jensen |

18 | Strictness analysis and denotational abstract interpretation - Nielson - 1988 |

16 | Strictness logic and polymorphic invariance - Benton - 1992 |

15 | Using projection analysis in compiling lazy functional programs
- Burn
- 1990
(Show Context)
Citation Context ...mers in [Bur91b, Section 5.3]). Projection-based analyses can also give information of the form: "this argument cannot be evaluated yet, but if it is ever evaluated, then do so much evaluation of=-= it" [Bur90]-=-. Again we should be able to modify the rule for application to accommodate this. Instead of using T 0 f?S oe g [[E 2 ]] in the case that the argument expression cannot be evaluated, this can be chang... |

14 | Reasoning about simple and exhaustive demand in higher-- order lazy languages - Leung, Mishra - 1991 |

13 |
Combinator Graph Reduction: A Congruence and its Applications. D.Phil thesis
- LESTER
- 1989
(Show Context)
Citation Context ...misations). Also their methods deal with local transformations where strictness-based optimisations involve global modifications of the program. The works that are closest in spirit to this paper are =-=[Les88]-=- and [DH92]. The first states a correctness property of an optimisation based on strictness analysis in the context of combinator graph reduction on a version of the Gmachine. The result however is li... |

13 | A constructive approach to compiler correctness - Mosses - 1980 |

12 | ORBIT - an optimising compiler for Scheme - Kranz - 1988 |

11 | The evaluation transformer model of reduction and its correctness
- Burn
- 1991
(Show Context)
Citation Context ...ch approximate some term fails to terminate, then it should fail to terminate for the term itself. Scott-closed sets capture denotationally the two properties that we require of an evaluation context =-=[Bur91a]-=-. Definition7. (Scott-closed set) A set S is Scott-closed of a domain D if 1. it is down-closed, that is, if 8d 2 D such that 9s 2 S such that d v s, then d 2 S; and 2. if X ` S and X is directed, the... |

11 |
L Correctness-preserving program transformations Conf
- GERHART
- 1975
(Show Context)
Citation Context ...elying on a global analysis. The latter are more difficult to validate because they involve context-dependent transformations. The only papers addressing this issue, to our knowledge, are [Nie85] and =-=[Ger75]-=-. The second paper is concerned with partial correctness and relies on program annotations and theorem-proving methods. The first paper considers a simple imperative language and a collecting semantic... |

9 | The tensor product in wadler’s analysis of list - Nielson, Nielson - 1994 |

8 | Using domain algebras to prove the correctness of a compiler - Dybjer - 1986 |

7 | The G-machine as a representation of stack semantics - Lester - 1987 |

5 | Context information for lazy code generation - Nielson, Nielson - 1990 |

4 | State-transition machines for lambda-calculus expressions - Schmidt - 2007 |

3 |
Continuation semantics in the typed lambda-calculus
- Meyer, Wand
- 1985
(Show Context)
Citation Context ...f evaluating an expression of type U [[oe]] into an answer. Meyer and Wand first showed that the type of the cps-translation of an expression could be derived from the type of the original expression =-=[MW85]-=-. Let us take a small example to illustrate this transformation and expose the potential sources of inefficiency: F = x:x + 1 E = F (plus 2 7): Applying the translation rules from Figure 3 yields, aft... |