Bug 3273

Summary: general const cleanups for server core
Product: xorg Reporter: Adam Jackson <ajax>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high CC: mharris
Version: git   
Hardware: x86 (IA32)   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
constify-server-core-1.patch
none
constify-server-core-2.patch
none
constify-server-core-4.patch none

Description Adam Jackson 2005-05-11 21:58:08 UTC
the unshared text segment in the server is needlessly large.  many tables and
structures are not marked const even though they are never modified.  LBX is the
worst offender by far with about 140k of writable data.

attached patch cleans up the worst of the damage in the server core.

before and after:

   text    data     bss     dec     hex filename
1798965   25672   73696 1898333  1cf75d Xorg.after
1643170  182500   73696 1899366  1cfb66 Xorg.before
Comment 1 Adam Jackson 2005-05-11 21:59:06 UTC
Created attachment 2667 [details] [review]
constify-server-core-1.patch
Comment 2 Alan Coopersmith 2005-05-12 08:45:27 UTC
One additional change, which we've been using since Solaris 8 with no noticable
downside is to tell lbxutil to use "const" flags when building the tables it
generates at build time:

In xc/lib/lbxutil/image/Imakefile, change"
       RunProgram(MKG3STATES,> g3_states_h)
to
       RunProgram(MKG3STATES,-c > g3_states_h)

That was good for about 140k moving from .data to .rodata in our builds.
Comment 3 Adam Jackson 2005-05-13 07:20:57 UTC
added.  hm, wonder if there's a similar flag for fontutil.
Comment 4 Adam Jackson 2005-05-20 18:05:56 UTC
*** Bug 3356 has been marked as a duplicate of this bug. ***
Comment 5 Adam Jackson 2005-05-20 18:09:59 UTC
Created attachment 2729 [details] [review]
constify-server-core-2.patch

hit a few more subsystems from last time: fontfile, composite, damage, fixes,
render, more of the loader, the config parser, etc.

new size(1) numbers:

   text    data     bss     dec     hex filename
1806232   18248   73696 1898176  1cf6c0 Xorg

this one breaks Xdmx because i was a bit enthusiatic about removing a
declaration from one header, but wanted to checkpoint it.
Comment 6 Adam Jackson 2005-05-31 19:43:25 UTC
Created attachment 2804 [details] [review]
constify-server-core-4.patch

hit a few more extensions, and back out overagressive consting in libfontenc
(otherwise mkfontscale segfaults trying to write to .rodata).  pretty confident
in this version.
Comment 7 Alan Coopersmith 2005-10-09 00:07:12 UTC
This looks good - are you going to commit before RC1 to get wider testing?
Comment 8 Adam Jackson 2006-04-04 23:50:18 UTC
more or less fixed in head, but still fixing as i go.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.