One potential concern.  I know of certain bits of code where strings
like "$Id: some text$" are "edited" in place to form version numbers
from $Id$ and similar strings.

The places I can think of actually occur in kernel code!

I suspect that making this the default _might_ break a number of
things.  It would be very, very helpful if we had compiler help to
_detect_ incorrect attempts to write to constant strings.  I'm not sure
-xstrconst will give us the warnings to catch them before they become
bugs in the field.

    -- Garrett

Roland Mainz wrote:
> Adam Leventhal wrote:
>   
>> On Tue, Mar 06, 2007 at 04:37:59PM +0100, [EMAIL PROTECTED] wrote:
>>     
>>>> Ok.  I'll bite... what is a "tail merging string".  And does this save
>>>> space (as I think the name implies)?
>>>>         
>>> Suppose you have two strings:
>>>
>>>       Permission Denied.
>>>       You're not authorized.  Permission Denied.
>>>
>>> If the strings can be modified, you need to store both.
>>>       
>> Any bets on how much space this will save in the kernel (or anywhere)? My
>> guess is fewer than 100 bytes.
>>     
>
> I think this is more in the range of megabytes since the kernel is full
> of duplicate strings.
>
> Quick look at the problem (kernel only):
> -- snip --
> # scan all kernel files and dump all strings (or things which look like
> strings)
> $ cat $(find /kernel /usr/kernel /platform -type f) | strings -a | wc -c
>  15951405
> # scan all kernel files for string-like stuff and remove duplicates
> $ cat $(find /kernel /usr/kernel /platform -type f) | strings -a | sort
> -u | wc -c
>  5342818
> $ bc -l
> (15951405-5342818) / (1024 * 1024)
> 10.11713695526123046875
> -- snip --
> In theory we could save ~~10.1MB in the kernel (userland is likely much
> worse).
>
> Note that "strings -a" lists lots of garbage which isn't really strings
> which means the number will be below 10.1MB. Another limiting factor is
> that we cannot fold multiple string literals across module borders but I
> guess we can still save 3-5MB minimum.
>
> The number could be improved a little bit by adding a compiler option to
> fold all identical+duplicate read-only which will save some more memory. 
>
> ----
>
> Bye,
> Roland
>
>   

_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to