366 research outputs found

    Liveness-Based Garbage Collection for Lazy Languages

    Full text link
    We consider the problem of reducing the memory required to run lazy first-order functional programs. Our approach is to analyze programs for liveness of heap-allocated data. The result of the analysis is used to preserve only live data---a subset of reachable data---during garbage collection. The result is an increase in the garbage reclaimed and a reduction in the peak memory requirement of programs. While this technique has already been shown to yield benefits for eager first-order languages, the lack of a statically determinable execution order and the presence of closures pose new challenges for lazy languages. These require changes both in the liveness analysis itself and in the design of the garbage collector. To show the effectiveness of our method, we implemented a copying collector that uses the results of the liveness analysis to preserve live objects, both evaluated (i.e., in WHNF) and closures. Our experiments confirm that for programs running with a liveness-based garbage collector, there is a significant decrease in peak memory requirements. In addition, a sizable reduction in the number of collections ensures that in spite of using a more complex garbage collector, the execution times of programs running with liveness and reachability-based collectors remain comparable

    Modelling Garbage Collection Algorithms --- Extend abstract

    Get PDF
    We show how abstract requirements of garbage collection can be captured using temporal logic. The temporal logic specification can then be used as a basis for process algebra specifications which can involve varying amounts of parallelism. We present two simple CCS specifications as an example, followed by a more complex specification of the cyclic reference counting algorithm. The verification of such algorithms is then briefly discussed

    A simple approach to distributed objects in prolog

    Full text link
    We present the design of a distributed object system for Prolog, based on adding remote execution and distribution capabilities to a previously existing object system. Remote execution brings RPC into a Prolog system, and its semantics is easy to express in terms of well-known Prolog builtins. The final distributed object design features state mobility and user-transparent network behavior. We sketch an implementation which provides distributed garbage collection and some degree of tolerance to network failures. We provide a preliminary study of the overhead of the communication mechanism for some test cases

    No Zombie Types: Liveness-Based Justification For Monotonic Gradual Types

    Get PDF
    Gradual type systems with the monotonic dynamic semantics, such as HiggsCheck implementing SafeTypeScript, are able to achieve decent performance, making them a viable option for JavaScript programmers seeking run-time-checkable type annotations. However, the type restrictions for objects in the monotonic dynamic semantics are, as the name suggests, monotonic. Once a typed reference is defined or assigned to refer to an object, the contract carrying the type obligation of the reference is part of the object for the remainder of execution. In some cases, such contracts become "zombies": the reference that justifies a contract is out of scope, yet the object still retains the type obligation. In this thesis, we propose a novel idea of contract liveness and its implementation. Briefly speaking, contracts must be justified by live stack references defined with associated type obligations. Our implementation, taking inspiration from how garbage collectors approximate object liveness by reachability of objects, approximates contract liveness by reachability of contracts. Then, to achieve a much closer approximation to contract liveness, we introduce a poisoning process: we nullify the stack references justifying the violated contract, and associate the location that triggered the contract violation with a poisoned reference for blame. The implementation is compared with the original implementation of HiggsCheck. The comparison shows our system is fully compatible with code that raised no errors, with a small performance penalty of 8.14% average slowdown. We also discuss the performance of the contract removal process, and possible worst cases for the liveness-based system. Also, the semantics of HiggsCheck SafeTypeScript is modified to formalize the liveness-based type system. Our work proves that relaxations of contractual obligations in a gradually typed system with the monotonic semantics are viable and realistic

    The derivation of distributed termination detection algorithms from garbage collection schemes

    Get PDF
    It is shown that the termination detection problem for distributed computations can be modelled as an instance of the garbage collection problem. Consequently, algorithms for the termination detection problem are obtained by applying transformations to garbage collection algorithms. The transformation can be applied to collectors of the "mark-and-sweep" type as well as to reference counting garbage collectors. As examples, the scheme is used to transform the distributed reference counting protocol of Lermen and Maurer, the weighted reference counting protocol, the local reference counting protocol, and Ben-Ari's mark-and-sweep collector into termination detection algorithms. Known termination detection algorithms as well as new variants are obtained

    Linear Haskell: practical linearity in a higher-order polymorphic language

    Get PDF
    Linear type systems have a long and storied history, but not a clear path forward to integrate with existing languages such as OCaml or Haskell. In this paper, we study a linear type system designed with two crucial properties in mind: backwards-compatibility and code reuse across linear and non-linear users of a library. Only then can the benefits of linear types permeate conventional functional programming. Rather than bifurcate types into linear and non-linear counterparts, we instead attach linearity to function arrows. Linear functions can receive inputs from linearly-bound values, but can also operate over unrestricted, regular values. To demonstrate the efficacy of our linear type system - both how easy it can be integrated in an existing language implementation and how streamlined it makes it to write programs with linear types - we implemented our type system in GHC, the leading Haskell compiler, and demonstrate two kinds of applications of linear types: mutable data with pure interfaces; and enforcing protocols in I/O-performing functions

    Establishing local temporal heap safety properties with applications to compile-time memory management

    Get PDF
    AbstractWe present a framework for statically reasoning about temporal heap safety properties. We focus on local temporal heap safety properties, in which the verification process may be performed for a program object independently of other program objects. We apply our framework to produce new conservative static algorithms for compile-time memory management, which prove for certain program points that a memory object or a heap reference will not be needed further. These algorithms can be used for reducing space consumption of Java programs. We have implemented a prototype of our framework, and used it to verify compile-time memory management properties for several small, but interesting example programs, including JavaCard programs
    • …
    corecore