Run Time Type Information in Mercury
The logic/functional language Mercury uses a strong, mostly static type system based on polymorphic many-sorted logic. For efficiency, the Mercury compiler uses type specific representations of terms, and implements polymorphic operations such as unifications via generic code invoked with descriptions of the actual types of the operands. These descriptions, which consist of automatically generated data and code, are the main components of the Mercury runtime type information (RTTI) system. We have used this system to implement several extensions of the Mercury system, including an escape mechanism from static type checking, generic input and output facilities, a debugger, and automatic memoization, and we are in the process of using it for an accurate, native garbage collector. We give detailed information on the implementation and uses of the Mercury RTTI system as well as measurements of the space costs of the system.
KeywordsFunction Symbol Garbage Collection Type Info Native Collector Type Constructor
Unable to display preview. Download preview PDF.
- 2.Aditya, S., Caro, A.: Compiler-directed type reconstruction for polymorphic languages. In: Proceedings of the 1993 ACM Conference on Functional Programming Languages and Computer Architecture, Copenhagen, Denmark (June 1993)Google Scholar
- 3.Aditya, S., Flood, C., Hicks, J.: Garbage collection for strongly-typed languages using run-time type reconstruction. In: Proceedings of the 1994 ACM Conference on Lisp and Functional Programming, June 1994, pp. 12–23 (1994)Google Scholar
- 4.Beierle, C., Meyer, G., Semle, H.: Extending the warren abstract machine to polymorphic order-sorted resolution. In: Proceedings of the International Logic Programming Symposium, pp. 272–286 (1991)Google Scholar
- 6.Demoen, B., de la Banda, M.G., Harvey, W., Marriott, K., Stuckey, P.: Herbrand constraint solving in HAL. Technical Report 99/18, Department of Software Engineering and Computer Science, University of Melbourne, Melbourne, Australia (1998)Google Scholar
- 8.Goldberg, B.: Tag-free garbage collection for strongly typed programming languages. In: Proceedings of the SIGPLAN 1991 Conference on Programming Languages Design and Implementation, Toronto, Ontario, June 1991, pp. 165–176 (1991)Google Scholar
- 10.Henderson, F., Conway, T., Somogyi, Z., Jeffery, D.: The Mercury language reference manual. Technical Report 96/10, Department of Computer Science, University of Melbourne, Melbourne, Australia (1996)Google Scholar
- 13.Tarditi, D., Morrisett, G., Cheng, P., Stone, C., Harper, R., Lee, P.: TIL: A type-directed optimizing compiler for ML. In: Proceedings of the SIGPLAN 1996 Conference on Programming Language Design and Implemantation, New York, May 21-24, pp. 181–192 (1996)Google Scholar
- 14.Tolmach, A.: Tag-free garbage collection using explicit type parameters. In: Proceedings of the SIGPLAN 1994 Conference on Programming Languages Design and Implementation, Orlando, Florida, June 1994, pp. 1–11 (1994)Google Scholar