Re: [rfa] teach lookup_symbol about namespace scope

Paul Hilfinger
2003-05-19T09:55:27Z

Yes, Ada does do things weirdly at the moment, and will probably continue
to do so, but I don't think this need worry anybody. Our particular needs
are:

1. We do NOT cache demangled names, and we look up all symbols using
mangled names. Originally, we just followed C++, but changed when
we discovered that our customers had HUGE executables for which the
startup and memory costs became substantial. David Carlton expressed
concern that our approach must cause maintenance problems, but to date
(i.e., since early 1998), the approach has caused no problems for us.

2. We generally expect multiple symbol matches, rather than just taking
the first match, and therefore our main lookup routine returns a list
of symbols.

3. Linkage (mangled) names have the form
<prefix>__<simple name><optional suffic>
and we need to be able to match this name given either
either <prefix>__<simple name> or <simple name>.

In our sources, I have introduced a macro SYMBOL_SEARCH_NAME that in
the Ada case is equivalent to SYMBOL_LINKAGE_NAME and in other cases
to the demangled name. As long as symbol tables (hash tables, etc.)
are built and searched according to the search name, everything just
works. To handle the need for a symbol list (as Elena mentions) we
simply wrote our own lookup_symbol. We'll certainly take advantage of
any opportunity to dump the latter code, of course, and will
contribute little hooks if that's what it takes. However, it wasn't
difficult to create our version in the first place and it has not been
hard to maintain, so even in the worst case (i.e., we have to rewrite
symbol lookup entirely) it will not be a terrible problem. Besides, I
am confident that with the spiffy new design we're seeing, adaptation
for Ada should be even easier than before.

Paul Hilfinger