[m-dev.] name mangling

Simon Taylor stayl at cs.mu.OZ.AU
Mon Nov 19 18:09:13 AEDT 2001


On 19-Nov-2001, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> The mangling of the names of type specialized procedures turns them into long
> lists of integers, which makes it quite tedious to read the generated C code,
> e.g. when evaluating the effects of optimizations.
>
> I propose to change the name mangling scheme so that names containing chars
> that are not acceptable in C identifiers (e.g. '[' and ']') are mangled
> by modifying only the non-C-id parts. The scheme I propose is:
> 
> - Replace every character that is not acceptable in a C identifier with
>   'z_N_', where N is a sequence of digits giving the characters' ASCII code.

It would also be worth allowing more readable aliases for common
characters like ` ', `:', `=', `[', `]', `,', `(' and ')'.
 
> - Replace every occurrence of 'z_' in the original name with 'z__'.
>
> The use of z_ instead of f_ is to make the break with the existing scheme
> more obvious.
 
> I also propose that type specialization not put spaces around the equal signs
> in the names it generates.

Fine.
 
> Since this breaks link compatibility, I propose doing the change together
> with other changes (e.g. to the TypeCtorInfo structure) that also have
> that effect.
> 
> Any objections? Fergus, Simon?

No, I was thinking about doing something like that myself.

Simon.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list