Using program structure to guide optimization in the presence of first-class functions
چکیده
Compilers for functional languages such as Standard ML can do a good job compiling programs, especially programs that perform symbolic computation. However, they often do a poor job on programs in a wide range of real-world application domains, such as systems programming and scientific computing. One reason for this is that these compilers are not sensitive to program structure, that is, recursions (“loops”), the code executed during the evaluation of a recursive function (“loop bodies”), and recursive-function nesting (“loop nesting”). In part, this is because determining the code executed during evaluation of a recursive function and determining recursive-function nesting is difficult when functions are first-class values. The body of a recursive function may simply be a call to an unknown function. Recursivefunction nesting can be difficult to determine because functions may be passed off to be used elsewhere. However, even in situations where the program structure is easy to determine, the traditional emphasis on compiling function calls well instead of compiling recursions well has led to compilers that simply ignore recursions. In my thesis, I propose to demonstrate that it is practical for a realistic compiler to determine the structure of functional programs and to show that compilers for functional languages need to be sensitive to this information to do a good job compiling systems and scientific programs. Furthermore, I will show that being sensitive to program structure improves compilation of symbolic programs as well.