Abstract

In this paper, we present a method for optimizing the allocation of closures in memory. This method is based on escape analysis, an application of abstraction interpretation to higher order functional languages. Escape analysis determines, at compile time, if any arguments to a function have a greater lifetime than the function call itself. Such arguments, especially if they are closures, must be allocated in the heap rather than in the stack. In most implementations, however, stack allocation of closures is preferable due to the lower cost of allocation and reclamation. Therefore, we use escape analysis to determine when arguments can be stack allocated safely. In the past, first order escape analysis has been used in optimizing LISP compilers, and has been described in various data-flow analysis frameworks for a language with complex types. The analysis described here, being higher order, provides more accurate escape information, although for a very simple higher order functional language.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call