Mangling issues

Daveed Vandevoorde daveed at edg.com
Thu Mar 2 16:26:23 UTC 2000


Martin von Loewis wrote:
> 
> While reviewing the mangling spec, I found a number of open questions,
> which you may want to consider today:
> 
> 1. When compressing names using S backward references, is the usage of
>    such a backward reference a type as well? I.e. given
> 
>    void foo(Hello,World,World,Hello)
> 
>    is this
> 
>    _Z3foo5Hello5WorldS1_S3_
> 
>    or is this
> 
>    _Z3foo5Hello5WorldS1_S2_
> 
>    instead (in which case the occurence of S1_ would not be counted as
>    a type). My feeling is that those backward references count as
>    types themselves, so the first answer would be correct.

Agreed.

> 2. When composing types using qualifiers, do the nested types get
>    numbers as well? I.e. given
> 
>    void foo(Hello&,Hello,Hello&)
> 
>    is that
> 
>    _Z3fooR5Hello5HelloS2_
> 
>    (as suggested by example 7), or is there a way to refer to Hello
>    already in the second parameter - even though the first parameter
>    is Hello&, not Hello. If so, do the enclosed types come before or
>    after the composed types, i.e. is the example mangled as
> 
>    _Z3fooR5HelloS1_S3_

This is the intent.

>    or is it
> 
>    _Z3fooR5HelloS2_S2_
> 
>    Also, if there is a way to refer back to a composed type either by
>    composing it again, or by referring to a earlier composition -
>    which one must be used? E.g. in the third parameter, it could be
>    either one of above solutions, or, say
> 
>    _Z3fooR5HelloS1_RS1_
> 
>    This alternative uses the most recent encoding of Hello, and
>    composes it to get something that is strictly shorter than the
>    uncompressed version. Of course, referring to a less recent but
>    more composed type would give better compression.

I'll have to work on wording to make the above clear.  Basically, you
must compress a type as soon as you have the opportunity in its
"top-down" traversal (unless the compression enlarges the encoding).
This might sometimes be less optimal in that you must refer to a less
recent type that requires more digits to refer to (but I think that's
unusual).

	Daveed




More information about the cxx-abi-dev mailing list