[m-dev.] name mangling

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon Nov 19 13:34:23 AEDT 2001


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.

- 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.

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?

Zoltan.
--------------------------------------------------------------------------
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