Garbage collection for reversible functional languages

6 Citations (Scopus)

Abstract

Reversible languages are programming languages where all programs can
run both forwards and backwards. Reversible functional languages have
been proposed that use symmetric pattern matching and data
construction. To be reversible, these languages require linearity:
Every variable must be used exactly once, so no references are copied
and all references are followed exactly once. Copying of values must
use deep copying. Similarly, equality testing requires deep
comparison of trees.

A previous paper describes reversible treatment of reference counts,
which allows sharing of structures without deep copying, but there are
limitations. Applying a constructor to arguments creates a new node
with reference count 1, so pattern matching is by symmetry restricted
to nodes with reference count 1. A variant pattern that does not
change the reference count of the root node is introduced to allow
manipulation of shared data. Having two distinct patterns for shared
and unshared data, however, adds a burden on the programmer.

We observe that we can allow pattern matching on nodes with arbitrary
reference count if we also allow constructor application to return
nodes with arbitrary reference counts. We do this by using maximal
sharing: If a newly constructed node is identical to an already
existing node, we return a pointer to the existing node (increasing
its reference count) instead of allocating a new node with reference
count 1.

To avoid searching the entire heap for an identical node, we use
hash-consing to restrict the search to a small segment of the heap.
We estimate how large this segment needs to be to give a very low
probability of allocation failure when the heap is less than half
full. Experimentally, we find that overlapping segments gives
dramatically better results than disjoint segments.
Translated title of the contributionSpildopsamling fot reversible funktionssprog
Original languageEnglish
Title of host publicationReversible computation : 7th International Conference, RC 2015, Grenoble, France, July 16-17, 2015, Proceedings
EditorsJean Krivine, Jean-Bernard Stefani
Number of pages16
PublisherSpringer
Publication date2015
Pages79-94
Chapter5
ISBN (Print)978-3-319-20859-6
ISBN (Electronic)978-3-319-20860-2
DOIs
Publication statusPublished - 2015
EventInternational Conference, RC 2015 - Grenoble, France
Duration: 16 Jul 201517 Jul 2015
Conference number: 7

Conference

ConferenceInternational Conference, RC 2015
Number7
Country/TerritoryFrance
CityGrenoble
Period16/07/201517/07/2015
SeriesLecture notes in computer science
Volume9138
ISSN0302-9743

Cite this