Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1145/1133956.1133974acmconferencesArticle/Chapter ViewAbstractPublication PagesismmConference Proceedingsconference-collections
Article

Formal semantics of weak references

Published: 10 June 2006 Publication History

Abstract

Weak references are references that do not prevent the object they point to from being garbage collected. Many realistic languages, including Java, SML/NJ, and Haskell to name a few, support weak references. However, there is no generally accepted formal semantics for weak references. Without such a formal semantics it becomes impossible to formally prove properties of such a language and the programs written in it.We give a formal semantics for a calculus called λweak that includes weak references and is derived from Morrisett, Felleisen, and Harper's λgc. The semantics is used to examine several issues involving weak references. We use the framework to formalize the semantics for the key/value weak references found in Haskell. Furthermore, we consider a type system for the language and show how to extend the earlier result that type inference can be used to collect reachable garbage. In addition we show how to allow collection of weakly referenced garbage without incurring the computational overhead often associated with collecting a weak reference which may be later used. Lastly, we address the non-determinism of the semantics by providing both an effectively decidable syntactic restriction and a more general semantic criterion, which guarantee a unique result of evaluation.

References

[1]
APPEL, A. W. Runtime tags aren't necessary. Lisp and Symbolic Computation 2, 2 (1989), 153--162.
[2]
BAKER, H. G. Unify and conquer. In LFP '90: Proceedings of the 1990 ACM conference on LISP and functional programming (New York, NY, USA, 1990), ACM Press, pp. 218--226.
[3]
CHAILLOUX, E., MANOURY, P., AND PAGANO, B. Developing Applications with Objective Caml. O'Reilly, France, 2000.
[4]
DONNELLY, K., AND KFOURY, A. J. Some considerations on formalsemantics for weak references. Technical Report Don+Kfo:BUCS-TR-2005-X, Department of Computer Science, Boston University,July 2005. http://types.bu.edu/reports/Don+Kfo:BUCS-TR-2005-X.html.
[5]
HALLETT, J. J., AND KFOURY, A. J. A formal semantics for weak references. Technical Report Hal+Kfo:BUCS-TR-2005-X, Department of Computer Science, Boston University, May 2005. http://types.bu.edu/reports/Hal+Kfo:BUCS-TR-2005-X.html.
[6]
HAYES, B. Ephemerons: a new finalization mechanism. In OOPSLA'97: Proceedings of the 12th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications (New York, NY, USA, 1997), ACM Press, pp. 176--183.
[7]
THE HUGS/GHC TEAM. Hugs/GHC Extension Libraries: Weak. http://www.dcs.gla.ac.uk/fp/software/ghc/lib/hg-libs-15.html.
[8]
PEYTON JONES, S. L., MARLOW, S., AND ELLIOTT, C. Stretching the storage manager: Weak pointers and stable names in haskell. In IFL '99: Selected Papers from the 11th International Workshop on Implementation of Functional Languages (London, UK, 2000), Springer-Verlag, pp. 37--58.
[9]
MERIZEN, F., ZENDRA, O., AND COLNET, D. Designing efficient and safe non-strong references in eiffel with parametric types. Research Report A04-R-149, INRIA Lorraine / LORIA UMR 7503, Sep 2004.
[10]
MORRISETT, G., FELLEISEN, M., AND HARPER, R. Abstract models of memory management. In FPCA '95: Proceedings of the seventh international conference on Functional programming languages and computer architecture (New York, NY, USA, 1995), ACM Press, pp. 66--77.
[11]
MORRISETT, G., AND HARPER, R. Semantics of memory management for polymorphic languages. In Higer Order Operational Techniques in Semantics, A. Gordon and A. Pitts, Eds. Newton Institute, Cambridge University Press, 1997.
[12]
THE SMLOFNJ TEAM. SML of NJ Structure Documentation: The WEAK signature. http://www.smlnj.org/doc/SMLofNJ/pages/weak.html.
[13]
SUN MICROSYSTEMS. Java 2 Platform SE v1.3.1: package java.lang.ref. http://java.sun.com/j2se/1.3/docs/api/java/lang/ref/packagesummary.html.
[14]
TOLMACH, A. P. Tag-free garbage collection using explicit type parameters. In LISP and Functional Programming (1994), pp. 1--11.
[15]
WRIGHT, A. K., AND FELLEISEN, M. A syntactic approach to type soundness. Information and Computation 115, 1 (1994), 38--94.

Cited By

View all
  • (2023)Collecting Cyclic Garbage across Foreign Function Interfaces: Who Takes the Last Piece of Cake?Proceedings of the ACM on Programming Languages10.1145/35912447:PLDI(591-614)Online publication date: 6-Jun-2023
  • (2022)From Specification to Testing: Semantics Engineering for Lua 5.2Journal of Automated Reasoning10.1007/s10817-022-09638-y66:4(905-952)Online publication date: 11-Aug-2022
  • (2018)MemoDynProceedings of the 27th International Conference on Parallel Architectures and Compilation Techniques10.1145/3243176.3243193(1-12)Online publication date: 1-Nov-2018
  • Show More Cited By

Index Terms

  1. Formal semantics of weak references

    Recommendations

    Comments

    Please enable JavaScript to view thecomments powered by Disqus.

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    ISMM '06: Proceedings of the 5th international symposium on Memory management
    June 2006
    202 pages
    ISBN:1595932216
    DOI:10.1145/1133956
    • General Chair:
    • Erez Petrank,
    • Program Chair:
    • Eliot Moss
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 10 June 2006

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. formal semantics
    2. garbage collection
    3. weak references

    Qualifiers

    • Article

    Conference

    ISMM06
    Sponsor:

    Acceptance Rates

    Overall Acceptance Rate 72 of 156 submissions, 46%

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)6
    • Downloads (Last 6 weeks)3
    Reflects downloads up to 27 Nov 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2023)Collecting Cyclic Garbage across Foreign Function Interfaces: Who Takes the Last Piece of Cake?Proceedings of the ACM on Programming Languages10.1145/35912447:PLDI(591-614)Online publication date: 6-Jun-2023
    • (2022)From Specification to Testing: Semantics Engineering for Lua 5.2Journal of Automated Reasoning10.1007/s10817-022-09638-y66:4(905-952)Online publication date: 11-Aug-2022
    • (2018)MemoDynProceedings of the 27th International Conference on Parallel Architectures and Compilation Techniques10.1145/3243176.3243193(1-12)Online publication date: 1-Nov-2018
    • (2012)Simplifying domain modeling and memory management in user-mode filesystems with the NOFS framework2012 IEEE International Conference on Electro/Information Technology10.1109/EIT.2012.6220733(1-6)Online publication date: May-2012
    • (2007)A calculus for java's reference objectsACM SIGPLAN Notices10.1145/1294297.129429942:8(9-17)Online publication date: 1-Aug-2007

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media