Abstract
Many modern programming environments use tag bits at runtime to distinguish objects of different types. This is particularly common in systems with garbage collection, since the garbage collector must be able to distinguish pointers from non-pointers, and to learn the length of records pointed to.
The use of tag bits leads to inefficiency. In addition to the obvious space overhead (tag bits and record descriptors occupy memory space), there is a time overhead: tag bits must be stripped off of data before arithmetic operations are performed, and re-attached to the data when it is stored into memory. This takes either extra instructions at runtime, or special tag-handling hardware, or both.
This paper shows how the use of tag bits, record descriptor words, explicit type parameters, and the like can be avoided in languages (like ML) with static polymorphic typechecking. Though a form of tag will still be required for user-defined variant records, all other type information can be encoded once—in the program—rather than replicated many times in the data. This can lead to savings both in space and time.
Similar content being viewed by others
References
Appel, A. W. Garbage collection can be faster than stack allocation.Information Processing Letters, 25(4): 275–279, 1987.
Appel, A. W., Ellis, J. R. and Li, K.Real-time Concurrent Collection on Stock Multiprocessors. SIGPLAN Notices (Proc. SIGPLAN '88 Conf. on Prog. Lang. Design + Implementation) 23(7): 11–20, 1988.
Appel, A. W. and MacQueen D. B. A Standard ML compiler. In Gilles Kahn, editor,Functional Programming Languages and Computer Architecture (LNCS 274), pages 301–324, Springer-Verlag, 1987.
Britton, D. E.Heap Storage Management for the Programming Language Pascal. Master's thesis, University of Arizona, 1975.
Lieberman, H. and Hewitt, C. A real-time garbage collector based on the lifetimes of objects.Communications of the ACM,23(6): 419–429, (1983).
Milner, P. A proposal for Standard ML. InACM Symposium on LISP and Functional Programming, pages 184–197, 1984.
Milner, R. A theory of type polymorphism in programming.Journal of Computer and System Sciences,17(1978): 348–375.
Rovner, P., Levin, R. and Wick, J.On Extending Modula-2 For Building Large, Integrated Systems. Technical Report Research Report 3, DEC Systems Research Center, Palo Alto, CA, 1985.
Ungar, D. Generation scavenging: a non-disruptive high performance storage reclamation algorithm. InSIGPLAN Notices (Proc. ACM SIGSOFT/SIGPLAN Software Eng. Symp. on Practical Software Development Environments), pages 157–167, 1984.
Ungar, D.M.The Design and Evaluation of a High Performance Smalltalk System. MIT Press, Cambridge, Mass., 1986.
Author information
Authors and Affiliations
Additional information
Supported in part by NSF Grant DCR-8603453 and by a Digital Equipment Corp. Faculty Incentive Grant.
Rights and permissions
About this article
Cite this article
Appel, A.W. Runtime tags aren't necessary. Lisp and Symbolic Computation 2, 153–162 (1989). https://doi.org/10.1007/BF01811537
Issue Date:
DOI: https://doi.org/10.1007/BF01811537