Results 1 - 10
of
12
Compiling polymorphism using intensional type analysis
- In Symposium on Principles of Programming Languages
, 1995
"... The views and conclusions contained in this document are those of the authors and should not be interpreted as ..."
Abstract
-
Cited by 252 (18 self)
- Add to MetaCart
The views and conclusions contained in this document are those of the authors and should not be interpreted as
TIL: A Type-Directed Optimizing Compiler for ML
- IN ACM SIGPLAN CONFERENCE ON PROGRAMMING LANGUAGE DESIGN AND IMPLEMENTATION
, 1995
"... We describe a new compiler for Standard ML called TIL, that is based on four technologies: intensional polymorphism, tag-free garbage collection, conventional functional language optimization, and loop optimization. We use intensional polymorphism and tag-free garbage collection to provide specializ ..."
Abstract
-
Cited by 219 (35 self)
- Add to MetaCart
We describe a new compiler for Standard ML called TIL, that is based on four technologies: intensional polymorphism, tag-free garbage collection, conventional functional language optimization, and loop optimization. We use intensional polymorphism and tag-free garbage collection to provide specialized representations, even though SML is a polymorphic language. We use conventional functional language optimization to reduce the cost of intensional polymorphism, and loop optimization to generate good code for recursive functions. We present an example of TIL compiling an SML function to machine code, and compare the performance of TIL code against that of a widely used compiler, Standard ML of New Jersey.
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
Once Upon a Type
- In Functional Programming Languages and Computer Architecture
, 1995
"... A number of useful optimisations are enabled if we can determine when a value is accessed at most once. We extend the Hindley-Milner type system with uses, yielding a typeinference based program analysis which determines when values are accessed at most once. Our analysis can handle higher-order fun ..."
Abstract
-
Cited by 77 (2 self)
- Add to MetaCart
A number of useful optimisations are enabled if we can determine when a value is accessed at most once. We extend the Hindley-Milner type system with uses, yielding a typeinference based program analysis which determines when values are accessed at most once. Our analysis can handle higher-order functions and data structures, and admits principal types for terms. Unlike previous analyses, we prove our analysis sound with respect to call-by-need reduction. Call-by-name reduction does not provide an accurate model of how often a value is used during lazy evaluation, since it duplicates work which would actually be shared in a real implementation. Our type system can easily be modified to analyse usage in a call-by-value language. 1 Introduction This paper describes a method for determining when a value is used at most once. Our method is based on a simple modification of the Hindley-Milner type system. Each type is labelled to indicate whether the corresponding value is used at most onc...
Tag-free Garbage Collection Using Explicit Type Parameters
- In Proceedings of the 1994 ACM Conference on Lisp and Functional Programming
"... We have constructed a practical tag-free garbage collector based on explicit type parameterization of polymorphic functions, for a dialect of ML. The collector relies on type information derived from an explicitly-typed 2nd-order representation of the program, generated by the compiler as a byproduc ..."
Abstract
-
Cited by 65 (0 self)
- Add to MetaCart
We have constructed a practical tag-free garbage collector based on explicit type parameterization of polymorphic functions, for a dialect of ML. The collector relies on type information derived from an explicitly-typed 2nd-order representation of the program, generated by the compiler as a byproduct of ordinary Hindley-Milner type inference. Runtime type manipulations are performed lazily to minimize execution overhead. We present details of our implementation approach, and preliminary performance measurements suggesting that the overhead of passing type information explicitly can be made acceptably small. 1 Introduction Parametric polymorphic functions, as found in languages such as ML and Haskell, are traditionally compiled into code that executes uniformly regardless of the types of its arguments. This approach requires adopting a uniform data representation for all types. Typically, one pretends that every value fits in a single machine word; values that do not fit must be pointe...
From ML to Ada: Strongly-typed Language Interoperability via Source Translation
, 1993
"... We describe a system that supports source-level integration of ML-like functional language code with ANSI C or Ada83 code. The system works by translating the functional code into type-correct, "vanilla" C or Ada; it offers simple, efficient, type-safe inter-operation between new functional code com ..."
Abstract
-
Cited by 59 (3 self)
- Add to MetaCart
We describe a system that supports source-level integration of ML-like functional language code with ANSI C or Ada83 code. The system works by translating the functional code into type-correct, "vanilla" C or Ada; it offers simple, efficient, type-safe inter-operation between new functional code components and "legacy" third-generationlanguage components. Our translator represents a novel synthesis of techniques including user-parameterized specification of primitive types and operators; removal of polymorphism by code specialization; removal of higher-order functions using closure datatypes and interpretation; and aggressive optimization of the resulting first-order code, which can be viewed as encoding the result of a closure analysis. Programs remain fully typed at every stage of the translation process, using only simple, standard type systems. Target code runs at speeds comparable to the output of current optimizing ML compilers, even though handicapped by a conservative garbage collector.
The implementation of the Gofer functional programming system
, 1994
"... The Gofer system is a functional programming environment for a small, Haskell-like language. Supporting a wide range of different machines, including home computers, the system is widely used, both for teaching and research. This report describes the main ideas and techniques used in the implementat ..."
Abstract
-
Cited by 54 (4 self)
- Add to MetaCart
The Gofer system is a functional programming environment for a small, Haskell-like language. Supporting a wide range of different machines, including home computers, the system is widely used, both for teaching and research. This report describes the main ideas and techniques used in the implementation of Gofer. This information will be particularly useful for work using Gofer as a platform to explore the use of new language features or primitives. It should also be of interest to those curious to see how the general techniques of functional programming language compilation are adapted to a simple, but practical, implementation.
Dictionary-free Overloading by Partial Evaluation
"... One of the most novel features in the functional programming language Haskell is the system of type classes used to support a combination of overloading and polymorphism. Current implementations of type class overloading are based on the use of dictionary values, passed as extra parameters to overlo ..."
Abstract
-
Cited by 33 (1 self)
- Add to MetaCart
One of the most novel features in the functional programming language Haskell is the system of type classes used to support a combination of overloading and polymorphism. Current implementations of type class overloading are based on the use of dictionary values, passed as extra parameters to overloaded functions. Unfortunately, this can have a significant effect on run-time performance, for example, by reducing the effectiveness of important program analyses and optimizations. This paper describes how a simple partial evaluator can be used to avoid the need for dictionary values at run-time by generating specialized versions of overloaded functions. This eliminates the run-time costs of overloading. Furthermore, and somewhat surprisingly given the presence of multiple versions of some functions, for all of the examples that we have tried so far, specialization actually leads to a reduction in the size of compiled programs.
The effectiveness of type-based unboxing
- Boston College, Computer Science Department
, 1997
"... Abstract We compare the efficiency of type-based unboxing strategies with that of simpler, untyped unboxing optimizations, building on our practical experience with the Gallium and Objective Caml compilers. We find the untyped optimizations to perform as well on the best case and significantly bette ..."
Abstract
-
Cited by 32 (1 self)
- Add to MetaCart
Abstract We compare the efficiency of type-based unboxing strategies with that of simpler, untyped unboxing optimizations, building on our practical experience with the Gallium and Objective Caml compilers. We find the untyped optimizations to perform as well on the best case and significantly better in the worst case. 1 Introduction In Pascal or C, the actual types of all data are always known at compile-time, allowing the compilers to base data representation decisions on this typing information, thus supporting efficient memory layout of data structures as well as efficient calling conventions for functions. This is no longer true for languages featuring polymorphism and type abstraction, such as ML: there, the static, compile-time type information does not always determine the actual, run-time type of a data (e.g. when the static type contains type variables or abstract type identifiers).
Unboxed Values and Polymorphic Typing Revisited
- In The Seventh International Conference on Functional Programming Languages and Computer Architecture
, 1995
"... Polymorphic languages require that values passed to polymorphic functions all have a representation of the same size. Any value whose natural representation does not fit this size must be boxed, i.e. represented by a pointer to a heap-allocated record. Major performance gains can be achieved by hand ..."
Abstract
-
Cited by 12 (0 self)
- Add to MetaCart
Polymorphic languages require that values passed to polymorphic functions all have a representation of the same size. Any value whose natural representation does not fit this size must be boxed, i.e. represented by a pointer to a heap-allocated record. Major performance gains can be achieved by handling values in their natural, unboxed representation whenever possible. We show that not only monomorphic functions, but also many polymorphic functions can handle unboxed values if the function calling convention of the underlying implementation satisfies a mild assumption. A representation type system is deøned which describes boxing requirements. A type reconstruction algorithm is given which translates an untyped program into an explicitly typed program where all changes of representation are made explicit. Furthermore, we define an abstract machine which employs the required calling convention and is an adequate operational model for the representation type system.

