## Implementation of the typed call-by-value λ-calculus using a stack of regions (1994)

### Cached

### Download Links

Venue: | In ACM Symposium on Principles of Programming Languages |

Citations: | 64 - 0 self |

### BibTeX

@INPROCEEDINGS{Tofte94implementationof,

author = {Mads Tofte},

title = {Implementation of the typed call-by-value λ-calculus using a stack of regions},

booktitle = {In ACM Symposium on Principles of Programming Languages},

year = {1994},

pages = {188--201},

publisher = {ACM}

}

### Years of Citing Articles

### OpenURL

### Abstract

We present a translation scheme for the polymorphically typed call-by-value λ-calculus. All runtime values, including function closures, are put into regions. The store consists of a stack of regions. Region inference and effect inference are used to infer where regions can be allocated and de-allocated. Recursive functions are handled using a limited form of polymorphic recursion. The translation is proved correct with respect to a store semantics, which models a regionbased run-time system. Experimental results suggest that regions tend to be small, that region allocation is frequent and that overall memory demands are usually modest, even without garbage collection. 1

### Citations

1626 | The Definition of Standard ML
- Milner, Tofte, et al.
- 1990
(Show Context)
Citation Context ...′ 0 → v ′ , s ′ From (43), (45), (53) and (63) we get s, VE ⊢ R ′ (e ′ 1 e′ 2 ) → v′ , s ′ which together with (62) is the desired result. 5 Strengths and weaknesses (61) (62) (63) (64) In Standard ML=-=[24]-=-, recursive functions cannot be used polymorphically within their own declaration. At first sight, our translation rules resemble the Milner/Mycroft calculus[26], in which recursive functions can be u... |

1535 |
A Discipline of Programming
- DIJKSTRA
- 1976
(Show Context)
Citation Context ...small, that region allocation is frequent and that overall memory demands are usually modest, even without garbage collection. 1 Introduction The stack allocation scheme for block-structured languages=-=[9]-=- often gives economical use of memory resources. Part of the reason for this is that the stack discipline is eager to reuse dead memory locations (i.e. locations, whose contents is of no consequence t... |

985 | A Theory of Type Polymorphism in Programming
- Milner
- 1978
(Show Context)
Citation Context ...dicate that our translation scheme holds some promise in this respect. In this paper, we propose a translation scheme for Milner’s call-by-value λ-calculus with recursive functions and polymorphic let=-=[22,7]-=-. The key features of our scheme are: 1. It determines lexically scoped lifetimes for all runtime values, including function closures, base values and records; 2. It is provably safe; 3. It is able to... |

634 | Compiling with Continuations - Appel - 1992 |

383 | ML for the Working Programmer - Paulson - 1996 |

261 | A real-time garbage collector based on the lifetimes of objects
- Lieberman, Hewitt
- 1983
(Show Context)
Citation Context ...the rest of the computation). Every point of allocation is matched by a point of de-allocation and these points can easily be identified in the source program. In heap-based storage management schemes=-=[4,19, 18]-=-, allocation is separate from de-allocation, the latter being handled by garbage collection. This separation is useful when the lifetime of values is not apparent from the source program. Heap-based s... |

251 | Polymorphic effect systems
- Lucassen, Gifford
- 1988
(Show Context)
Citation Context ...ormal region parameters and which may well be local to the body of the recursive function. Such local regions resemble the activation records of the classical stack discipline. We use effect inference=-=[20,21,14]-=- to find out where to wrap letregion ρ in . . . end around an expression. Most work on effect inference uses the word “effect” as a short-hand for “side-effect”. We have no side-effects in our source ... |

244 |
Principal Type Schemes for Functional Programs
- Damas, Milner
- 1984
(Show Context)
Citation Context ...dicate that our translation scheme holds some promise in this respect. In this paper, we propose a translation scheme for Milner’s call-by-value λ-calculus with recursive functions and polymorphic let=-=[22,7]-=-. The key features of our scheme are: 1. It determines lexically scoped lifetimes for all runtime values, including function closures, base values and records; 2. It is provably safe; 3. It is able to... |

218 | List processing in real time on a serial computer
- Baker
- 1978
(Show Context)
Citation Context ...the rest of the computation). Every point of allocation is matched by a point of de-allocation and these points can easily be identified in the source program. In heap-based storage management schemes=-=[4,19, 18]-=-, allocation is separate from de-allocation, the latter being handled by garbage collection. This separation is useful when the lifetime of values is not apparent from the source program. Heap-based s... |

141 | Type inference with polymorphic recursion
- Henglein
- 1993
(Show Context)
Citation Context ...ner/Mycroft calculus[26], in which recursive functions can be used polymorphically within their own body. The type-checking problem for the Milner/Mycroft is equivalent to the semi-unification problem=-=[12,1]-=-, and semi-unification is unfortunately undecidable[17].sfib(15) The computation of the 15th Fibonacci number by the “naïve” method (e.g. [16, page 235]). The computation of fib(n) requires number of ... |

125 |
Fundamental Algorithms, Volume 1 of The Art of Computer Programming
- Knuth
- 1973
(Show Context)
Citation Context ...the rest of the computation). Every point of allocation is matched by a point of de-allocation and these points can easily be identified in the source program. In heap-based storage management schemes=-=[4,19, 18]-=-, allocation is separate from de-allocation, the latter being handled by garbage collection. This separation is useful when the lifetime of values is not apparent from the source program. Heap-based s... |

125 | Polymorphic Type, Region and Effect Inference
- Talpin, Jouvelot
- 1992
(Show Context)
Citation Context ...to delimit regions of memory and delimit their lifetimes goes back to early work on effect systems[6]. Lucassen and Gifford[21] call it effect masking. Lucassen and Gifford[21] and Talpin and Jouvelot=-=[29]-=- prove that effect masking is safe, with respect to a store semantics where regions are not reused. We have found the notion of memory reuse surprisingly subtle, due to, among other things, pointers i... |

110 | Algebraic reconstruction of types and effects
- Jouvelot, Gifford
- 1991
(Show Context)
Citation Context ...ormal region parameters and which may well be local to the body of the recursive function. Such local regions resemble the activation records of the classical stack discipline. We use effect inference=-=[20,21,14]-=- to find out where to wrap letregion ρ in . . . end around an expression. Most work on effect inference uses the word “effect” as a short-hand for “side-effect”. We have no side-effects in our source ... |

98 |
Polymorphic type schemes and recursive definitions
- Mycroft
- 1984
(Show Context)
Citation Context ...sses (61) (62) (63) (64) In Standard ML[24], recursive functions cannot be used polymorphically within their own declaration. At first sight, our translation rules resemble the Milner/Mycroft calculus=-=[26]-=-, in which recursive functions can be used polymorphically within their own body. The type-checking problem for the Milner/Mycroft is equivalent to the semi-unification problem[12,1], and semi-unifica... |

80 |
Co-induction in relational semantics
- Milner, Tofte
- 1991
(Show Context)
Citation Context ... avoid capture. The consistency relation is defined in Figure 3. It is the maximal fixed point of a monotonic operator on sets; properties about consistency can therefore be proved using co-induction =-=[23]-=-. For example, one can prove[30] that consistency is preserved under increasing stores, with respect to decreasing effects: Lemma 4.1 If Consistent(R, µ, v, s1, v ′ )w.r.t.ϕ1 and ϕ2 ⊆ ϕ1 and s1 ⊑ s2 t... |

70 | Functional Programming using Standard ML - Wikstrom - 1987 |

69 | A semantic model of reference counting and its abstraction
- Hudak
- 1986
(Show Context)
Citation Context ... for garbage list cells produced by Quicksort[15, page 575]. We obtain a 100% reclamation rate (but for 1 word) for all garbage produced by Quicksort, without garbage collection (see Section 5). Hudak=-=[13]-=- describes a reference counting scheme for a first-order call-by-value functional language. Reference counting may give more precise use information, than our scheme, as we only distinguish between “n... |

64 |
Lifetime analysis of dynamically allocated objects
- Ruggieri, Murtagh
(Show Context)
Citation Context ...or recursive datatypes. (So far, the only recursive datatype we have dealt with is lists.)sr0 r1 r2 r3 Figure 1: The store is a stack of regions; a region is a box in the picture. Ruggieri and Murtagh=-=[28]-=- propose a stack of regions in conjunction with a traditional heap. Each region is associated with an activation record (this is not necessarily the case in our scheme). They use a combination of inte... |

58 |
Types and effects, towards an integration of functional and imperative programming
- Lucassen
- 1987
(Show Context)
Citation Context ...ormal region parameters and which may well be local to the body of the recursive function. Such local regions resemble the activation records of the classical stack discipline. We use effect inference=-=[20,21,14]-=- to find out where to wrap letregion ρ in . . . end around an expression. Most work on effect inference uses the word “effect” as a short-hand for “side-effect”. We have no side-effects in our source ... |

55 |
Type reconstruction in the presence of polymorphic recursion
- Kfoury, Tiuryn, et al.
- 1993
(Show Context)
Citation Context ...ner/Mycroft calculus[26], in which recursive functions can be used polymorphically within their own body. The type-checking problem for the Milner/Mycroft is equivalent to the semi-unification problem=-=[12,1]-=-, and semi-unification is unfortunately undecidable[17].sfib(15) The computation of the 15th Fibonacci number by the “naïve” method (e.g. [16, page 235]). The computation of fib(n) requires number of ... |

55 |
The undecidability of the semiunification problem
- Kfoury, Tiuryn, et al.
- 1990
(Show Context)
Citation Context ...n be used polymorphically within their own body. The type-checking problem for the Milner/Mycroft is equivalent to the semi-unification problem[12,1], and semi-unification is unfortunately undecidable=-=[17]-=-.sfib(15) The computation of the 15th Fibonacci number by the “naïve” method (e.g. [16, page 235]). The computation of fib(n) requires number of function calls which is exponential in n. sum(100) Here... |

49 |
Using key object opportunism to collect old objects
- Hayes
- 1991
(Show Context)
Citation Context ... Current address: European Computer-Industry Research Center (ECRC GmbH), Arabella Straße 17, D-81925 München; email: jp@ecrc.de tion collects young objects when the allocation space is used up. Hayes=-=[11]-=- discusses how to reclaim large, old objects. Garbage collection can be very fast. Indeed, there is a much quoted argument that the amortized cost of copying garbage collection tends to zero, as memor... |

46 |
Proof of translation in natural semantics
- Despeyroux
- 1986
(Show Context)
Citation Context ...o the effect that consistency is preserved: if E and VE are consistent in store s and e translates to e ′ and E ⊢ e → v then there exists a store s ′ and a value v ′ such that s, VE ⊢ e ′ → v ′ , s ′ =-=[25,8]-=-. However, no matter how we tried to define the notion of consistency, we were unable to prove such a preservation theorem.sDefinition The relation Consistent is the largest relation satisfying: • Con... |

42 |
Advice on Structuring Compilers and Prove them Correct
- Morris
- 1973
(Show Context)
Citation Context ...o the effect that consistency is preserved: if E and VE are consistent in store s and e translates to e ′ and E ⊢ e → v then there exists a store s ′ and a value v ′ such that s, VE ⊢ e ′ → v ′ , s ′ =-=[25,8]-=-. However, no matter how we tried to define the notion of consistency, we were unable to prove such a preservation theorem.sDefinition The relation Consistent is the largest relation satisfying: • Con... |

39 |
Fx-87 reference manual
- Giord, Jouvelot, et al.
- 1987
(Show Context)
Citation Context ... relative to an underlying region-based store model. The idea that effect inference makes it possible to delimit regions of memory and delimit their lifetimes goes back to early work on effect systems=-=[6]-=-. Lucassen and Gifford[21] call it effect masking. Lucassen and Gifford[21] and Talpin and Jouvelot[29] prove that effect masking is safe, with respect to a store semantics where regions are not reuse... |

32 |
Safety considerations for storage allocation optimizations
- CHASE
- 1988
(Show Context)
Citation Context ...h our scheme has in common with the classical stack discipline: creating a large argument for a function which only uses it for a small part of its activation leads to waste of memory (see also Chase =-=[5]-=-). inline(100) uses only Θ(N) space, as the storage mode analysis discovers that updates are possible. Garbage collection If one wants to combine region allocation with garbage collection, dangling po... |

26 | A Theory of Stack Allocation in Polymorphically Typed Languages
- Tofte, Talpin
- 1993
(Show Context)
Citation Context ...d weaknesses of the translation and give experimental results. Due to space limitations, most proofs have been omitted. Detailed proofs (and an inference algorithm) are available in a technical report=-=[30]-=-. 2 Source and target languages 2.1 Source language We assume a denumerably infinite set Var of variables. Each variable is either an ordinary variable, x, or a letrec variable, f. The grammar for the... |

12 |
Theoretical and Practical Aspects of Type and Effect Inference
- Talpin
- 1993
(Show Context)
Citation Context ...back to early work on effect systems[6]. Lucassen and Gifford[21] call it effect masking; they prove that effect masking is sound with respect to a store semantics where regions are not reused. Talpin=-=[29]-=- and Talpin and Jouvelot[30] present a polymorphic effect system with effect masking and prove that it is sound, with respect to a store semantics where regions are not reused. We have found the notio... |

8 |
Transformations and reduction strategies for typed lambda expressions
- Georgeff
- 1984
(Show Context)
Citation Context ...for a first-order call-by-value functional language. Reference counting may give more precise use information, than our scheme, as we only distinguish between “no use” and “perhaps some use.” Georgeff=-=[10]-=- describes a implementation scheme for typed lambda expressions in so-called simple form together with a transformation of expressions into simple form. The transformation can result in an increase in... |

5 |
Unify and conquer (garbage collection, updating, aliasing, ...) in functional languages
- Baker
- 1990
(Show Context)
Citation Context ... Hence regions are allocated and de-allocated in a stack-like manner. The device we use for grouping values according to regions is unification of region variables, using essentially the idea of Baker=-=[3]-=-, namely that two valueproducing expressions e1 and e2 should be given the same “at ρ” annotation, if and only if type checking, directly or indirectly, unifies the type of e1 and e2. Baker does not p... |

2 |
Katsuro Inoue and Hikaru Yagi. Analysis of functional programs to detect runtime garbage cells
- Seki
- 1988
(Show Context)
Citation Context ...regions to put values in. We use a type-inference based analysis. They consider updates, which we do not. However, we deal with polymorphism and higher-order functions, which they do not. Inoue et al.=-=[15]-=- present an interesting technique for compile-time analysis of runtime garbage cells in lists. Their method inserts pairs of HOLD and RECLAIMη instructions in the target language. HOLD holds on to a p... |