Results 1 - 10
of
13
Compiling with Types
, 1995
"... Compilers for monomorphic languages, such as C and Pascal, take advantage of types to determine data representations, alignment, calling conventions, and register selection. However, these languages lack important features including polymorphism, abstract datatypes, and garbage collection. In contr ..."
Abstract
-
Cited by 97 (14 self)
- Add to MetaCart
Compilers for monomorphic languages, such as C and Pascal, take advantage of types to determine data representations, alignment, calling conventions, and register selection. However, these languages lack important features including polymorphism, abstract datatypes, and garbage collection. In contrast, modern programming languages such as Standard ML (SML), provide all of these features, but existing implementations fail to take full advantage of types. The result is that performance of SML code is quite bad when compared to C. In this thesis, I provide a general framework, called type-directed compilation, that allows compiler writers to take advantage of types at all stages in compilation. In the framework, types are used not only to determine efficient representations and calling conventions, but also to prove the correctness of the compiler. A key property of typedirected compilation is that all but the lowest levels of the compiler use typed intermediate languages. An advantage of this approach is that it provides a means for automatically checking the integrity of the resulting code. An important
Abstract Models of Memory Management
, 1995
"... Most specifications of garbage collectors concentrate on the low-level algorithmic details of how to find and preserve accessible objects. Often, they focus on bit-level manipulations such as "scanning stack frames," "marking objects," "tagging data," etc. While these details are important in some c ..."
Abstract
-
Cited by 89 (16 self)
- Add to MetaCart
Most specifications of garbage collectors concentrate on the low-level algorithmic details of how to find and preserve accessible objects. Often, they focus on bit-level manipulations such as "scanning stack frames," "marking objects," "tagging data," etc. While these details are important in some contexts, they often obscure the more fundamental aspects of memory management: what objects are garbage and why? We develop a series of calculi that are just low-level enough that we can express allocation and garbage collection, yet are sufficiently abstract that we may formally prove the correctness of various memory management strategies. By making the heap of a program syntactically apparent, we can specify memory actions as rewriting rules that allocate values on the heap and automatically dereference pointers to such objects when needed. This formulation permits the specification of garbage collection as a relation that removes portions of the heap without affecting the outcome of the evaluation. Our high-level approach allows us to specify in a compact manner a wide variety of memory management techniques, including standard trace-based garbage collection (i.e., the family of copying and mark/sweep collection algorithms), generational collection, and type-based, tag-free collection. Furthermore, since the definition of garbage is based on the semantics of the underlying language instead of the conservative approximation of inaccessibility, we are able to specify and prove the idea that type inference can be used to collect some objects that are accessible but never used.
Semantics of memory management for polymorphic languages
- In 1st Workshop on Higher Order Operational Techniques in Semantics, A. Gordon and A. Pitts, Eds. Publications of the Newton Institute
, 1997
"... The views and conclusions contained in this document arethose of the authors and should not be interpreted as representing o cial policies, either expressed or implied, of the Advanced We present a static and dynamic semantics for an abstract machine that evaluates expressions of a polymorphic progr ..."
Abstract
-
Cited by 40 (8 self)
- Add to MetaCart
The views and conclusions contained in this document arethose of the authors and should not be interpreted as representing o cial policies, either expressed or implied, of the Advanced We present a static and dynamic semantics for an abstract machine that evaluates expressions of a polymorphic programming language. Unlike traditional semantics, our abstract machine exposes many important issues of memory management, such as value sharing and control representation. We prove the soundness of the static semantics with respect to the dynamic semantics using traditional techniques. We then show how these same techniques may be used to establish the soundness of various memory management strategies, including type-based, tag-free garbage collection� tail-call elimination � and environment strengthening. Keywords: management Type theory and operational semantics are remarkably e ective tools for programming
Region Analysis and the Polymorphic Lambda Calculus
- In Proc. of the 14th Annual IEEE Symposium on Logic in Computer Science
, 1999
"... We show how to translate the region calculus of Tofte and Talpin, a typed lambda calculus that can statically delimit the lifetimes of objects, into an extension of the polymorphic lambda calculus called F # . We give a denotational semantics of F # , and use it to give a simple and abstract proof o ..."
Abstract
-
Cited by 28 (0 self)
- Add to MetaCart
We show how to translate the region calculus of Tofte and Talpin, a typed lambda calculus that can statically delimit the lifetimes of objects, into an extension of the polymorphic lambda calculus called F # . We give a denotational semantics of F # , and use it to give a simple and abstract proof of the correctness of memory deallocation. 1 Introduction Implementations of modern programming languages divide dynamically allocated memory into two parts. The stack is used for data that has a simple last-in, first-out lifetime determined by block structure; the other part (often called the heap) is used for data whose lifetime extends beyond the scope of program blocks. The heap is periodically "garbage collected" to reclaim memory that is no longer needed. Tofte and Talpin's region calculus [23] attempts to unify these two styles of memory management. The region calculus divides memory into regions, and provides a local scoping mechanism for those regions. Every value created by the pro...
Type-Based Useless Variable Elimination
, 1999
"... We show a type-based method for useless variable elimination, i.e., transformation that eliminates variables whose values contribute nothing to the final outcome of a computation, and prove its correctness. The algorithm is a surprisingly simple extension of the usual type reconstruction algorithm. ..."
Abstract
-
Cited by 18 (4 self)
- Add to MetaCart
We show a type-based method for useless variable elimination, i.e., transformation that eliminates variables whose values contribute nothing to the final outcome of a computation, and prove its correctness. The algorithm is a surprisingly simple extension of the usual type reconstruction algorithm. Our method seems more attractive than Wand and Siveroni's 0CFA-based method in many respects. First, it is efficient: it runs in time almost linear in the size of an input expression for a simply-typed -calculus, while the 0CFA-based method may require a cubic time. Second, our transformation can be shown to be optimal among those that preserve well-typedness, both for the simply-typed language and for an ML-style polymorphically-typed language. On the other hand, the 0CFA-based method is not optimal for the polymophically-typed language. ANY OTHER IDENTIFYING INFORMATION OF THIS REPORT Summary has been submitted for publication. Up-to-date version of this report will be available through ...
Simple Garbage-Collector-Safety
- In 1996 SIGPLAN Conference on Programming Language Design and Implementation
, 1996
"... A conservative garbage collector can typically be used with conventionally compiled programs written in C or C++. But two safety issues must be considered. First, the source code must not hide pointers from the garbage collector. This primarily requires stricter adherence to existing restrictions in ..."
Abstract
-
Cited by 13 (2 self)
- Add to MetaCart
A conservative garbage collector can typically be used with conventionally compiled programs written in C or C++. But two safety issues must be considered. First, the source code must not hide pointers from the garbage collector. This primarily requires stricter adherence to existing restrictions in the language definition. Second, we must ensure that the compiler will not perform transformations that invalidate this requirement. We argue that the same technique can be used to address both issues. We present an algorithm for annotating source or intermediate code to either check the validity of pointer arithmetic in the source, or to guarantee that under minimal, clearly defined assumptions about the compiler, the optimizer cannot "disguise" pointers. We discuss an implementation based on a preprocessor for the GNU C compiler (gcc), and give some measurements of program slowdown.
A Demand-Driven Set-Based Analysis
- In Proceedings of the ACM Symposium on Principles of Programming Languages
, 1997
"... In this paper we present an analysis technique for isolating dead code in higher-order functional programs. First, we formalize what it means for a program fragment to contribute to the value returned by the program. Next, we provide a purely declarative specification of a subset of terms which cons ..."
Abstract
-
Cited by 13 (1 self)
- Add to MetaCart
In this paper we present an analysis technique for isolating dead code in higher-order functional programs. First, we formalize what it means for a program fragment to contribute to the value returned by the program. Next, we provide a purely declarative specification of a subset of terms which constitute dead code. This is done by a refinement of the set-based semantics technique, developed by Nevin Heintze, by the introduction of a concept of demand. We then develop a demand-driven set-based analysis to compute dead code specified by the declarative specification. The demand-driven set-based analysis developed in this paper is polynomial time, in the size of the input program. 1 Introduction Elimination of dead code is a standard optimisation performed by modern compilers for imperative languages. But compilers for higher-order programming languages perform only extremely naive kinds of dead code elimination. The principal benefit associated with the elimination of dead code in fir...
Garbage Collection Based on a Linear Type System
, 2000
"... We propose a type-directed garbage collection (GC) scheme for a programming language with static memory management based on a linear type system. Linear type systems, which can guarantee certain values (called linear values) to be used only once during program execution, are useful for memory man ..."
Abstract
-
Cited by 8 (2 self)
- Add to MetaCart
We propose a type-directed garbage collection (GC) scheme for a programming language with static memory management based on a linear type system. Linear type systems, which can guarantee certain values (called linear values) to be used only once during program execution, are useful for memory management: memory space for linear values can be reclaimed immediately after they are used. However, conventional pointer-tracing GC does not work under such a memory management scheme: if the memory space for used linear values is still reachable through pointers, dangling pointers are created. This problem is solved by exploiting static type information during garbage collection in a way similar to tag-free GC. Type information in our linear type system represents not only the shapes of heap objects but also how many times the heap objects are accessed in the rest of computation. Using such type information at GC-time, our GC can avoid tracing dangling pointers; in addition, our GC can...
Dynamic Slicing In Higher-Order Programming Languages
, 1997
"... Dynamic slicing is a technique for isolating segments of a program that (potentially) contribute to the value computed at a point of interest. Dynamic slicing for restricted first-order imperative languages has been extensively studied in literature. In contrast, little research has been done with r ..."
Abstract
-
Cited by 7 (0 self)
- Add to MetaCart
Dynamic slicing is a technique for isolating segments of a program that (potentially) contribute to the value computed at a point of interest. Dynamic slicing for restricted first-order imperative languages has been extensively studied in literature. In contrast, little research has been done with regard to the slicing of higher-order programs. Most first-order imperative programming languages are statement-based while most higher-order programming languages are expression-based. Unlike first-order programs, higher-order programs have no simple concept of static control flow: control flow depends on the binding of formal parameters to actuals. Because of these differences, formalising a definition of slicing for higher-order programs involves some novel concepts. The aim of the work, presented here, is to extract `executable' slices of higher-order programs solely from the execution trace. In the absence of assignments, i.e. in purely functional programs, dynamic slices satisfying ver...

