Abstract
Modern programming languages and operating systems use heap memory that allows allocation and deallocation of memory to be decoupled, so they don’t follow a stack discipline. Axelsen and Glück have presented a reversible heap manager where allocation and deallocation are each other’s logical inverses: Freeing a block of memory is done by running the allocation procedure backwards.
Axelsen and Glück use this heap manager to sketch implementation of a simple reversible functional language where pattern matching a constructor is the inverse of construction, so pattern-matching implies deallocation. This requires the language to be linear: A pointer can not be copied and it can only be eliminated by deallocating the node to which it points.
We overcome this limitation by adding reference counts to nodes: Copying a pointer to a node increases the reference count of the node and eliminating a pointer decreases the reference count. We show reversible implementations of operations on nodes with reference counts. We then show these operations can be used when implementing a reversible functional language RCFUN to the reversible imperative language Janus.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Axelsen, H.B.: Clean translation of an imperative reversible programming language. In: Knoop, J. (ed.) CC 2011. LNCS, vol. 6601, pp. 144–163. Springer, Heidelberg (2011)
Axelsen, H.B., Glück, R.: Reversible representation and manipulation of constructor terms in the heap. In: Dueck, G.W., Miller, D.M. (eds.) RC 2013. LNCS, vol. 7948, pp. 96–109. Springer, Heidelberg (2013)
Baker, H.G.: Nreversal of fortune–the thermodynamics of garbage collection. In: Bekkers, Y., Cohen, J. (eds.) IWMM-GIAE 1992. LNCS, vol. 637, pp. 507–524. Springer, Heidelberg (1992)
Goto, E.: Monocopy and associative algorithms in an extended lisp. Technical Report TR 74-03, University of Tokyo (1974)
Lutz, C.: Janus: a time-reversible language. A letter to Landauer (1986), http://www.cise.uf1.edu/~mpf/rc/janus.html
Mogensen, T.Æ.: Report on an implementation of a semi-inverter. In: Virbitskaite, I., Voronkov, A. (eds.) PSI 2006. LNCS, vol. 4378, pp. 322–334. Springer, Heidelberg (2007)
Mogensen, T.Æ.: Partial evaluation of janus part 2: Assertions and procedures. In: Clarke, E., Virbitskaite, I., Voronkov, A. (eds.) PSI 2011. LNCS, vol. 7162, pp. 289–301. Springer, Heidelberg (2012)
Yokoyama, T., Axelsen, H.B., Glück, R.: Principles of a reversible programming language. In: Proceedings of the 5th Conference on Computing Frontiers, CF 2008, pp. 43–54. ACM, New York (2008)
Yokoyama, T., Axelsen, H.B., Glück, R.: Towards a reversible functional language. In: De Vos, A., Wille, R. (eds.) RC 2011. LNCS, vol. 7165, pp. 14–29. Springer, Heidelberg (2012)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2014 Springer International Publishing Switzerland
About this paper
Cite this paper
Mogensen, T.Æ. (2014). Reference Counting for Reversible Languages. In: Yamashita, S., Minato, Si. (eds) Reversible Computation. RC 2014. Lecture Notes in Computer Science, vol 8507. Springer, Cham. https://doi.org/10.1007/978-3-319-08494-7_7
Download citation
DOI: https://doi.org/10.1007/978-3-319-08494-7_7
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-08493-0
Online ISBN: 978-3-319-08494-7
eBook Packages: Computer ScienceComputer Science (R0)