[m-rev.] for review: mangle symbols with a leading digit in java

Peter Wang novalazy at gmail.com
Mon Jun 22 11:28:38 AEST 2009


2009/6/21 Julien Fischer <juliensf at csse.unimelb.edu.au>:
>> @@ -373,12 +379,27 @@ sym_name_mangle(qualified(ModuleName,
>> PlainName)) = MangledName :-
>>    MangledPlainName = name_mangle(PlainName),
>>    MangledName = qualify_name(MangledModuleName, MangledPlainName).
>>
>> -name_mangle(Name) = MangledName :-
>> +name_mangle(Name) = name_mangle_2(yes, Name).
>> +
>> +name_mangle_no_leading_digit(Name) = name_mangle_2(no, Name).
>> +
>> +:- func name_mangle_2(bool, string) = string.
>> +
>> +name_mangle_2(AllowLeadingDigit, Name) = MangledName :-
>>    % Warning: any changes to the name mangling algorithm here may also
>>    % require changes to extras/dynamic_linking/name_mangle.m,
>>    % profiler/demangle.m, util/mdemangle.c and compiler/name_mangle.m.
>
> Presumably that comment only applies to the C name mangling stuff?
> That needs to be made clear here.

It's really the one algorithm with two slightly different ideas of what
constitutes an invalid symbol, so the comment applies either way.

> I think a better interface would be to parameterize all of the name
> mangling functions in this module by the target language, for example:
>
>    :- func name_mangle(compilation_target, string) = string.
>
> etc.

Perhaps, but the no leading digit rule applies to C as well, we just
happen to not generate code where the mangled name is unprefixed by
something else (I assume).

Peter
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list