| Andrew W. Appel and Trevor T. Y. Jim. Optimizing closure environment representations. Technical Report 168, Dept. of Computer Science, Princeton University, Princeton, NJ, 1988. |
....2.3.3) because local variable bindings are live until the function exits its scope, which may be after their last use. Flat closures do satisfy the SSC rule, but they require that variables be copied many times from one closure to another. Many of the closure strategies described by Appel and Jim [AJ88] and most stack frame implementations also violate SSC, since dead variables remain in the frame until a function returns. CHAPTER 4. SPACE EFFICIENT CLOSURE REPRESENTATIONS 65 Obeying SSC can require extra copying of pointer values from an old closure that contains them (but also contains ....
.... Lias compiler [Roz84] used closure analysis to choose specialized representations for different kinds of closures; Kranz s Orbit compiler [KKR 86, Kra87] uses six different closure allocation strategies for different kinds of functions; Appel and Jim investigated closure sharing strategies [AJ88] and proposed many alternative closure representations. Unfortunately, all these closure analysis techniques violate the safe for space complexity rule due to unsafe closure sharing. The closure conversion algorithm described in this chapter combines all of these analyses (except stack ....
Andrew W. Appel and Trevor Jim. Optimizing Closure Environment Representations. Technical Report 168, Dept. of Computer Science, Princeton University, Princeton, NJ, 1988.
.... the machine code pointer in p[0] This means that the free variables (the rest of the closure) may have an arbitrary arrangement, known only to the function that builds the closure (add, in this case) and the function that executes it (add1, in this case) Closures can be structured in many ways[7], and can even point to other closures for access to free variables (i.e. they can have static links, in Algol terminology) Clearly, closures are represented a lot like records. A closure has several fields, each of which is either a machine code pointer or a free variable. The machine code ....
....may contain literal strings and floating point constants. These are embedded within string objects amongst the machine code functions. For example, fun show(b) if b then true else false could almost have the representation shown in figure 8. The function show returns a pointer descriptor [7] e000 fals true s h o w [5] show true false Figure 8: String literals, oversimplified . to true or false; this pointer points into the middle of the large string object at one of the embedded strings. Because the embedded string is preceded by a back pointer descriptor, the garbage collector ....
Andrew W. Appel and Trevor T. Y. Jim. Optimizing closure environment representations. Technical Report 168, Dept. of Computer Science, Princeton University, Princeton, NJ, 1988.
....variable bindings will stay on the stack until they exit their scope, so may remain live even after their last use. Flat closures do satisfy the SSC rule, but they require that variables be copied many times from one closure to another. Many of the closure strategies described by Appel and Jim [3] violate the rule. Most stack frame implementations also violate SSC, since dead variables remain in the frame until a function returns. This can be avoided by associating a descriptor with each return address, showing which variables are live; but this complicates the garbage collector [7, 8] ....
....by, many other research results. Closure analysis: Steele [33] used continuation closures instead of stack frames; Rozas [30] and Kranz [25, 26] used closure analysis to choose specialized representations for different kinds of closures; Appel and Jim investigated closure sharing strategies [3]. We combine all of these analyses (except stack allocation) and more. Tail calls: Hanson [20] showed the complexity of implementing tail calls correctly and efficiently on a conventional stack. Closure passing style: Lambda notation has often been used to represent the results of closure ....
Andrew W. Appel and Trevor Jim. Optimizing closure environment representations. Technical Report 168, Dept. of Computer Science, Princeton University, Princeton, NJ, 1988.
.... the machine code pointer in p[0] This means that the free variables (the rest of the closure) may have an arbitrary arrangement, known only to the function that builds the closure (add, in this case) and the function that executes it (add1, in this case) Closures can be structured in many ways[7], and can even point to other closures for access to free variables (i.e. they can have static links, in Algol terminology) Clearly, closures are represented a lot like records. A closure has several fields, each of which is either a machine code pointer or a free variable. The machine code ....
....For example, fun show(b) if b then true else false could almost have the representation shown in figure 11. The function show returns . desc show s h o w [5] true true [7] false fals e000 Figure 8: String literals, oversimplified a pointer to true or false; this pointer points into the middle of the large string object at one of the embedded strings. Because the embedded string is preceded by a back pointer descriptor, ....
Andrew W. Appel and Trevor T. Y. Jim. Optimizing closure environment representations. Technical Report 168, Dept. of Computer Science, Princeton University, 1988.
....its argument list; function f escapes, and requires a closure record. See the appendix for a larger example written in a more readable notation. In more complicated examples, involving many variables from differing scopes, there can be a number of possible closure representations for a function. [8] One simple strategy is to use a flat closure containing all the free variables. At the other extreme, a number of closure records already exist when a new closure must be created, and a pointer or link to one can provide access to several of the necessary variables. Combinations of the two allow ....
Andrew W. Appel and Trevor Jim, "Optimizing closure environment representations," CS-TR-168-88, Princeton University, 1988.
.... a single pointer to the enclosing scope can be used instead of all the free variables from that scope) but costlier to access (getting a free variable requires traversing a linked list) In fact, we investigated many di#erent representational tricks on the spectrum between flat and linked closures[6], including tricks where we use the same closure record for several di#erent functions with several di#erent code pointers[5, 4] In a traditional compiler, these tricks make a significant di#erence. But in the CPS representation, it appears that the pattern of functions and variable access ....
Andrew W. Appel and Trevor T. Y. Jim. Optimizing closure environment representations. Technical Report 168, Dept. of Computer Science, Princeton University, 1988.
Online articles have much greater impact More about CiteSeer.IST Add search form to your site Submit documents Feedback
CiteSeer.IST - Copyright Penn State and NEC