## A Usage Analysis With Bounded Usage Polymorphism and Subtyping (2000)

Venue: | In Proceedings of the 12th International Workshop on Implementation of Functional Languages, number AIB-00-7 in Aachener Informatik Berichte |

Citations: | 14 - 3 self |

### BibTeX

@INPROCEEDINGS{Gustavsson00ausage,

author = {Jörgen Gustavsson and Josef Svenningsson},

title = {A Usage Analysis With Bounded Usage Polymorphism and Subtyping},

booktitle = {In Proceedings of the 12th International Workshop on Implementation of Functional Languages, number AIB-00-7 in Aachener Informatik Berichte},

year = {2000},

pages = {140--157}

}

### OpenURL

### Abstract

Previously proposed usage analyses have proved not to scale up well for large programs. In this paper we present a powerful and accurate type based analysis designed to scale up for large programs. The key features of the type system are usage subtyping and bounded usage polymorphism. Bounded polymorphism can lead to huge constraint sets and to express constraints compactly we introduce a new expressive form of constraints which allows constraints to be represented compactly through calls to constraint abstractions. 1 Introduction In the implementation of a lazy functional language sharing of evaluation is performed by updating. For example, the (unoptimised) evaluation of (x:x + x) (1 + 2) proceeds as follows. First, a closure for 1 + 2 is built in the heap and a reference to the closure is passed to the abstraction. Second, to evaluate x + x the value of x is required. Thus the closure is fetched from the heap and evaluated. Third, the closure is updated with the result so that w...

### Citations

204 | Implementing lazy functional languages on stock hardware: the spineless tagless G-machine
- Jones
- 1992
(Show Context)
Citation Context ...chine [Ses97] as the semantic basis of our work. The machine can be thought of as modelling lower-level abstract machines based on so called update markers, such as the TIM [FW87] and the STG-machine =-=[PJ92]-=-. A correspondence between Sestoft's machine and Launchbury's natural semantics for lazy evaluation [Lau93] has been shown in [Ses97]. For the purpose of the abstract machine we extend the set of term... |

196 | A natural semantics for lazy evaluation
- Launchbury
- 1993
(Show Context)
Citation Context ...stract machines based on so called update markers, such as the TIM [FW87] and the STG-machine [PJ92]. A correspondence between Sestoft's machine and Launchbury's natural semantics for lazy evaluation =-=[Lau93]-=- has been shown in [Ses97]. For the purpose of the abstract machine we extend the set of terms to include expressions of the form add n e, which represents an intermediate step in the computation of n... |

87 | Once upon a type
- Turner, Wadler, et al.
- 1995
(Show Context)
Citation Context ...98] Wansbrough and Peyton Jones give an overview of the design space for how to treat data structures. We choose the most aggressive approach which corresponds to the hard-wired treatment of lists in =-=[TWM95]-=-. -- Our system is based on subsumption between usage types. The use of subtyping in usage analysis goes back to Fax'en [Fax95]. -- We have a three-level type language which incorporates separate noti... |

71 | Deriving a lazy abstract machine
- Sestoft
- 1997
(Show Context)
Citation Context ... as well as the analysis presented in this paper. The syntactic restriction is by now rather standard, see for example [PJPS96,Lau93,Ses97,GS99]. 2.2 Semantics We will take Sestoft's abstract machine =-=[Ses97]-=- as the semantic basis of our work. The machine can be thought of as modelling lower-level abstract machines based on so called update markers, such as the TIM [FW87] and the STG-machine [PJ92]. A cor... |

56 | Let-floating: moving bindings to give faster programs - Jones, Partain, et al. - 1996 |

49 | Analysis and efficient implementation of functional programs - Sestoft - 1991 |

43 | Improvement in a lazy context: An operational theory for call-by-need - Moran, Sands - 1999 |

41 | Once upon a polymorphic type
- Wansbrough, Jones
- 1999
(Show Context)
Citation Context ... extending the best ideas from previous work. The salient features of the type system are these: -- Our system has full-blown bounded usage polymorphism and supports usage polymorhic recursion. -- In =-=[WPJ98]-=- Wansbrough and Peyton Jones give an overview of the design space for how to treat data structures. We choose the most aggressive approach which corresponds to the hard-wired treatment of lists in [TW... |

39 |
Flow analysis of typed higher-order programs
- Mossin
- 1997
(Show Context)
Citation Context ...lyses. Having all these features is not very useful unless there is an efficient inference algorithm for the type system. Here bounded polymorphism presents a problem. See for example Mossin's thesis =-=[Mos97]-=- for an account of the problems with bounded flow polymorphism in type based flow analyses. The core of the problem is that the quantified variables in a type schema may be constrained by a huge amoun... |

29 |
A Simple, Lazy Abstract Machine to Execute Supercombinators
- TIM
- 1987
(Show Context)
Citation Context ... take Sestoft's abstract machine [Ses97] as the semantic basis of our work. The machine can be thought of as modelling lower-level abstract machines based on so called update markers, such as the TIM =-=[FW87]-=- and the STG-machine [PJ92]. A correspondence between Sestoft's machine and Launchbury's natural semantics for lazy evaluation [Lau93] has been shown in [Ses97]. For the purpose of the abstract machin... |

20 | Optimizing lazy functional programs using flow inference
- Faxén
- 1995
(Show Context)
Citation Context ...ssive approach which corresponds to the hard-wired treatment of lists in [TWM95]. -- Our system is based on subsumption between usage types. The use of subtyping in usage analysis goes back to Fax'en =-=[Fax95]-=-. -- We have a three-level type language which incorporates separate notions of usage of closures and usage of values which gives increased precision. To separate the usage of closures and values is a... |

20 | A foundation for space-safe transformations of call-by-need programs
- Gustavsson, Sands
- 1999
(Show Context)
Citation Context ... so that the garbage collector does not follow them -- and there is a cost associated with that. Secondly, usage annotations can be used to guide certain program transformations. Gustavsson and Sands =-=[GS99] have show-=-n that the stronger criterion can guarantee that these transformations are time and space safe, but with the weaker "used at most once" criterion the transformations can lead to an asymptoti... |

16 | The GRIN project: A highly optimising back end for lazy functional languages - Boquist, Johnsson - 1996 |

16 | Update Avoidance Analysis by Abstract Interpretation - Marlow - 1992 |

14 | Types for 0, 1 or many uses
- Mogensen
- 1997
(Show Context)
Citation Context ... of a list is used more than once then so is typically the elements of the list as well and if that is not the case it is difficult to detect it. Thus type based usage analyses (with the exception of =-=[Mog97]-=-) conservatively assumes that if the the spine of the list is used more than once then so is the elements. This manifests itself by a constraint between the usage of the spine and the elements. Howeve... |

13 | Analysing, Transforming and Compiling Lazy Functional Programs
- Faxén
- 1997
(Show Context)
Citation Context ...ustavsson [Gus98] and Wansbrough and Peyton Jones [WPJ99]. The analysis which seems to be closest in expressive power to ours is an analysis by Fax'en based on an undecidable type based flow analysis =-=[Fax97]-=-. Due to the undecidable nature of the analysis his inference algorithm is not complete with respect to the type system. The algorithm is parametrised by a notion of finite name supply and the larger ... |

13 | A Type Based Sharing Analysis for Update Avoidance and Optimisation. Licentiate thesis
- Gustavsson
- 1999
(Show Context)
Citation Context ...o abstract machine configurations and then proving a subject reduction result which says that typings are preserved by transitions in the abstract machine. A very similar proof for the type system in =-=[Gus98]-=- is presented in full detail in [Gus99]. 3.9 Inference Algorithm As stated the type system is undecidable since it employs type polymorphic recursion. Our inference algorithm will therefore take a ter... |

11 | Simple Usage Polymorphism
- Wansbrough, Jones
- 2000
(Show Context)
Citation Context ...gh and Peyton Jones implemented the recent analysis from [WPJ99] into the Glasgow Haskell Compiler they discovered that it was almost useless in practice since it did not scale up for large programs. =-=[WPJ00]-=-. In this paper we present a powerful and accurate type system which attempts to solve this problem. It takes the context where a function is called into account through the means of bounded usage pol... |

5 |
From polymorphic subtyping to CFL reachability: Context-sensitive flow analysis using instantiation constraints
- Fähndrich, Rehof, et al.
- 2000
(Show Context)
Citation Context ...s a problem also for other type based program analyses with bounded polymorhism. In that respect our work is most closely related to the work by Fax'en [Fax95], Mossin [Mos97] and Fanhdrich and Rehof =-=[FR00]-=-. Fax'en and Mossin present inference algorithms for type based flow analyses which simplifies constraint sets to smaller but equivalent constraint sets. In their recent work on type based flow analys... |

3 |
An efficient algorithm for a sharing analysis with polymorphism and subtyping
- Svenningsson
- 2000
(Show Context)
Citation Context ... size of the untyped lambda lifted version of the program, m is the size of the type of the largest set of (properly) mutually recursive definitions and t is the size of the largest instantiated type =-=[Sve00]-=-. Since m and t typically grow slowly or not at all with program size we expect the algorithm to scale up well in practice. We believe that a generalisation of the form of constraints used in this pap... |