Many useful programming language extensions and system support libraries re
quire knowledge of the locations of fields within objects at run time. Exam
ples include orthogonal persistent object stores, precise garbage collector
s, data structure picklers, and parameter marshaling schemes.
For clean and efficient implementation as libraries, these systems require
run-time knowledge of in-memory layouts of data objects, which is unavailab
le in most traditionally compiled and linked programming languages, such as
C, C++, and,Ada. Even the recently standardized nm-time type identificatio
n (RTTI) feature in C++ is insufficient, because it describes only language
-level features of the type hierarchy and not the compiler-dependent object
layout decisions.
We present a facility for run-time type description, or RTTD, which extract
s low-level layout information from debugging information generated by conv
entional compilers, and makes it available to user programs. We believe thi
s to be the simplest and most portable approach to run-time type descriptio
n, requiring no changes to existing compilers. In this paper, we describe t
he basic strategies and present details of our implementation for C++. We a
lso sketch some extensions that we have implemented, including special trea
tment of C++'s virtual function table pointers to match persistent or forei
gn data objects with the actual code in a particular application.
Our implementation of run-time type description is freely available. It is
in regular use with multiple operating systems and compilers, in both free
and commercial products, including a highperformance persistent object stor
age system for C++ and a realtime garbage collector.