develooper Front page | perl.perl5.porters | Postings from April 2007

Re: long symbol names in mro.c

Thread Previous
From:
Craig A. Berry
Date:
April 22, 2007 20:35
Subject:
Re: long symbol names in mro.c
Message ID:
p06240807c251d18bc058@[172.16.52.1]
At 12:33 PM -0700 4/21/07, John E. Malmberg wrote:
>Craig A. Berry wrote:
>>The new mro.c file in blead currently causes the following compilation grief on VMS:
>>
>>XS(XS_mro_get_global_sub_generation);
>>^
>>%CC-W-LONGEXTERN, The external identifier name exceeds 31 characters; truncated to "XS_MRO_GET_GLOBAL_SUB_GENERATIO".
>>at line number 694 in file D0:[CRAIG.perl]mro.c;1
>>
>>XS(XS_mro_invalidate_all_method_caches);
>>^
>>%CC-W-LONGEXTERN, The external identifier name exceeds 31 characters; truncated to "XS_MRO_INVALIDATE_ALL_METHOD_CA".
>>at line number 695 in file D0:[CRAIG.perl]mro.c;1
>>
>>Normally XS symbols are shortened by a VMS-only name mangler when
>>processed by xsubpp, but here we are bypassing that process.  By far
>>the easiest thing to do would be to simply shorten them manually as
>>in the attached patch, but will that break anything that's already
>>out there?  I don't see anything in the core that calls these from C.
>
>It may be time to teach the dynamic loader routine to understand the
>name mangler that has long been built into DEC/HP C compilers.  That
>would make another VMSism invisible to most of Perl when the C
>complier is set to automatically CRC shorten names.

It was time eight years ago.  What will make it happen is someone who
will work out all the implications and implement all the required
changes in a way that doesn't break anything.

>After this is done, I do no know if backwards binary compatibility is needed.

I don't think such a change would be appropriate for the 5.8.x
stream.  It might have been for 5.10 but really should have been done
and tested before now to be a candidate.

>The DEC/HP C name mangling algorithm has been published on
>comp.os.vms by someone in the compiler group.

Good to know.  We might well want to replicate it in XSSymSet.pm at some point.

>I have found that for building most open source projects on VMS, I
>need to use /NAMES=(AS-IS,SHORTENED) which preserves case, and uses

It's AS_IS, not AS-IS, and it's long been a configuration option for
Perl on VMS.  Name shortening has not been an option since we do our
own for XS modules.  I can't remember when, if ever, it's come up for
core C files.

>a CRC algorithm to generate unique shortened names.
>
>The generic algorithm would require that the routine that calls
>LIB$FIND_IMAGE_SYMBOL to first try to find the symbol as-is, and
>then in uppercase if less than 31 characters.  If over 31
>characters, try first exact case CRC shortened, and then uppercase
>CRC shortened.
>
>The CRC shortening works on VAX/ALPHA/I64.

I'm aware of the methods you suggest and have used them all in other
contexts.  Perl is somewhat different in that XS processing has to
know what the symbol names are before the C compiler ever sees them.
We could probably replicate the same name mangling algorithm the
compiler uses, but that has its drawbacks too (like they might
change the algorithm).
-- 
________________________________________
Craig A. Berry
mailto:craigberry@mac.com

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About