2 research outputs found

    Selective Thunkification

    No full text
    . Recently, Amtoft presented an analysis and transformation for mapping typed call-by-name programs to call-by-value equivalents. Here, we present a comparable analysis and transformation for untyped programs using dataflow analysis. In the general case, the transformation generates thunks for call site operands of a call-by-name program. Using strictness information derived as part of a larger flow analysis, we can determine that some operands are necessarily evaluated under call-byname, so the transformation does not need to generate thunks for them. The dataflow analysis is formulated as the solution to a set of constraints. We show that any solution to the constraints is sound, and that any such solution justifies the resulting transformation. 1 Introduction In [1], Amtoft presented a strictness analysis for typed programs, and based on that analysis, developed an algorithm to transform call-by-name programs into call-by-value equivalents. The algorithm was correct in that the tra..

    Correct Higher-Order Program Transformations

    No full text
    We present a method for proving the correctness of compiler optimizations for higher-order programming languages. Programs are annotated with propositions derived as the solutions to dataflow constraints formulated as local consistency conditions for each parse tree node. We can prove that any such solution yields sound annotations, that is, the propositions are true. Each compiler optimization is presented as a source-to-source transformation. Using the annotations and additional constraint information, we can prove that the optimization is correct with respect to some criterion. The correctness criterion is similar for each transformation. The particular optimizations we exhibit are selective and lightweight closure conversion (constructing source-level closures for procedures, with two variations), Ultra-fi (a generalization of copy propagation to higher-order languages), and selective thunkification (transforming call-by-name programs into callby -value equivalents). iii Acknowle..
    corecore