This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: Removing space waste for g++ static inlined objects
- To: "'Ronald F. Guilmette'" <rfg at monkeys dot com>, "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>
- Subject: RE: Removing space waste for g++ static inlined objects
- From: David Korn <dkorn at pixelpower dot com>
- Date: Wed, 14 Feb 2001 17:51:25 -0000
Hi Ronald,
I gave your patch a try. The good news is that it caused no regressions
on powerpc-wrs-vxworks.
The not-so-good news is that the overall effects of your patch seem to
increase the size of compiled objects and mess around in strange and
unexpected ways with the contents of the object file symbol table.
I tested it on the $HUGEAPP that I work on in my paid job. 296 modules,
half-a-million code lines or so. We have a simple inline accessor function
that is called from a couple of hundred places throughout the project, so
I added a static variable to it (taking care not to let it be optimized
away):
inline int PGetCurrentScreen()
{
static int f[1024] = { 0 };
f[CurrentScreen]++;
if (f[CurrentScreen] == 32945) return 7;
return CurrentScreen;
}
Here's what I get from building my app before and after applying your
patch:
Directory of C:\Work\h051r\b4
10/02/2001 23:58 13,143,549 h051app.out
1 File(s) 13,143,549 bytes
0 Dir(s) 1,433,264,128 bytes
Directory of C:\Work\h051r\aftr
11/02/2001 00:27 12,427,658 h051app.out
1 File(s) 12,427,658 bytes
0 Dir(s) 1,433,264,128 bytes free
which is a difference of 700k more-or-less. At 4k per array times maybe a
couple of hundred calls, that seems about right. This is what the output
from
nm shows:
*** b4/namesonly.txt Sun Feb 11 00:44:14 2001
--- aftr/namesonly.txt Sun Feb 11 00:44:20 2001
***************
*** 1,3 ****
--- 1,4 ----
+ ? _23PGetCurrentScreen__Fv.0$f.9
B ABChannelDescription
B ABChannelSel
B ABProgram
The '?' means unknown linker section, so I assume this is your link once
section.
*************** U vxDecGet
*** 11851,11857 ****
U write
W ConvertColourToRGB__FP1C
W ConvertColourToYUV__FP1C
! W PGetCurrentScreen__Fv
b ABCache
b ACBufferB1
b ACBufferB2
Here, we are no longer emitting a static copy of the function, since IIUIC
prior to your patch functions with static variables would not be inlined to
avoid this problem.
--- 11852,11900 ----
And here, despite the link having been done with the -r flag, we see lots
of absolute relocation symbols! I don't know how they got here, but ...
U write
W ConvertColourToRGB__FP1C
W ConvertColourToYUV__FP1C
! a _23PGetCurrentScreen__Fv.0$f.12
! a _23PGetCurrentScreen__Fv.0$f.15
! a _23PGetCurrentScreen__Fv.0$f.15
! a _23PGetCurrentScreen__Fv.0$f.18
! a _23PGetCurrentScreen__Fv.0$f.18
! a _23PGetCurrentScreen__Fv.0$f.21
! a _23PGetCurrentScreen__Fv.0$f.21
! a _23PGetCurrentScreen__Fv.0$f.21
! a _23PGetCurrentScreen__Fv.0$f.24
! a _23PGetCurrentScreen__Fv.0$f.27
! a _23PGetCurrentScreen__Fv.0$f.27
! a _23PGetCurrentScreen__Fv.0$f.30
! a _23PGetCurrentScreen__Fv.0$f.30
! a _23PGetCurrentScreen__Fv.0$f.30
! a _23PGetCurrentScreen__Fv.0$f.36
! a _23PGetCurrentScreen__Fv.0$f.36
! a _23PGetCurrentScreen__Fv.0$f.36
! a _23PGetCurrentScreen__Fv.0$f.45
! a _23PGetCurrentScreen__Fv.0$f.48
! a _23PGetCurrentScreen__Fv.0$f.48
! a _23PGetCurrentScreen__Fv.0$f.51
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
! a _23PGetCurrentScreen__Fv.0$f.9
b ABCache
b ACBufferB1
b ACBufferB2
*************** d _20pixel_read__FPUiii.1$shmasktbl.99
....but it looks like they correspond to these symbols from the unpatched
compiler's output...
*** 12227,12422 ****
d _20pixel_read__FPUiii.2$yuvmixvals.100
d _20pixel_read__FPUiii.2$yuvmixvals.59
d _22H05x_GetHostname__Fv.0$rack_name.464
- d _23PGetCurrentScreen__Fv.0$f.12
- d _23PGetCurrentScreen__Fv.0$f.12
- d _23PGetCurrentScreen__Fv.0$f.12
- d _23PGetCurrentScreen__Fv.0$f.12
- d _23PGetCurrentScreen__Fv.0$f.15
- d _23PGetCurrentScreen__Fv.0$f.15
- d _23PGetCurrentScreen__Fv.0$f.15
- d _23PGetCurrentScreen__Fv.0$f.15
- d _23PGetCurrentScreen__Fv.0$f.15
- d _23PGetCurrentScreen__Fv.0$f.15
- d _23PGetCurrentScreen__Fv.0$f.15
- d _23PGetCurrentScreen__Fv.0$f.15
- d _23PGetCurrentScreen__Fv.0$f.15
- d _23PGetCurrentScreen__Fv.0$f.15
- d _23PGetCurrentScreen__Fv.0$f.15
- d _23PGetCurrentScreen__Fv.0$f.15
- d _23PGetCurrentScreen__Fv.0$f.18
- d _23PGetCurrentScreen__Fv.0$f.18
- d _23PGetCurrentScreen__Fv.0$f.18
- d _23PGetCurrentScreen__Fv.0$f.18
- d _23PGetCurrentScreen__Fv.0$f.18
- d _23PGetCurrentScreen__Fv.0$f.18
- d _23PGetCurrentScreen__Fv.0$f.18
- d _23PGetCurrentScreen__Fv.0$f.18
- d _23PGetCurrentScreen__Fv.0$f.18
- d _23PGetCurrentScreen__Fv.0$f.18
- d _23PGetCurrentScreen__Fv.0$f.18
- d _23PGetCurrentScreen__Fv.0$f.18
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.21
- d _23PGetCurrentScreen__Fv.0$f.24
- d _23PGetCurrentScreen__Fv.0$f.24
- d _23PGetCurrentScreen__Fv.0$f.24
- d _23PGetCurrentScreen__Fv.0$f.24
- d _23PGetCurrentScreen__Fv.0$f.24
- d _23PGetCurrentScreen__Fv.0$f.24
- d _23PGetCurrentScreen__Fv.0$f.27
- d _23PGetCurrentScreen__Fv.0$f.27
- d _23PGetCurrentScreen__Fv.0$f.27
- d _23PGetCurrentScreen__Fv.0$f.27
- d _23PGetCurrentScreen__Fv.0$f.27
- d _23PGetCurrentScreen__Fv.0$f.27
- d _23PGetCurrentScreen__Fv.0$f.27
- d _23PGetCurrentScreen__Fv.0$f.27
- d _23PGetCurrentScreen__Fv.0$f.27
- d _23PGetCurrentScreen__Fv.0$f.27
- d _23PGetCurrentScreen__Fv.0$f.27
- d _23PGetCurrentScreen__Fv.0$f.27
- d _23PGetCurrentScreen__Fv.0$f.30
- d _23PGetCurrentScreen__Fv.0$f.30
- d _23PGetCurrentScreen__Fv.0$f.30
- d _23PGetCurrentScreen__Fv.0$f.30
- d _23PGetCurrentScreen__Fv.0$f.30
- d _23PGetCurrentScreen__Fv.0$f.30
- d _23PGetCurrentScreen__Fv.0$f.30
- d _23PGetCurrentScreen__Fv.0$f.30
- d _23PGetCurrentScreen__Fv.0$f.30
- d _23PGetCurrentScreen__Fv.0$f.30
- d _23PGetCurrentScreen__Fv.0$f.30
- d _23PGetCurrentScreen__Fv.0$f.30
- d _23PGetCurrentScreen__Fv.0$f.33
- d _23PGetCurrentScreen__Fv.0$f.33
- d _23PGetCurrentScreen__Fv.0$f.36
- d _23PGetCurrentScreen__Fv.0$f.36
- d _23PGetCurrentScreen__Fv.0$f.36
- d _23PGetCurrentScreen__Fv.0$f.36
- d _23PGetCurrentScreen__Fv.0$f.36
- d _23PGetCurrentScreen__Fv.0$f.36
- d _23PGetCurrentScreen__Fv.0$f.36
- d _23PGetCurrentScreen__Fv.0$f.36
- d _23PGetCurrentScreen__Fv.0$f.36
- d _23PGetCurrentScreen__Fv.0$f.36
- d _23PGetCurrentScreen__Fv.0$f.36
- d _23PGetCurrentScreen__Fv.0$f.39
- d _23PGetCurrentScreen__Fv.0$f.39
- d _23PGetCurrentScreen__Fv.0$f.39
- d _23PGetCurrentScreen__Fv.0$f.39
- d _23PGetCurrentScreen__Fv.0$f.42
- d _23PGetCurrentScreen__Fv.0$f.42
- d _23PGetCurrentScreen__Fv.0$f.45
- d _23PGetCurrentScreen__Fv.0$f.45
- d _23PGetCurrentScreen__Fv.0$f.45
- d _23PGetCurrentScreen__Fv.0$f.45
- d _23PGetCurrentScreen__Fv.0$f.45
- d _23PGetCurrentScreen__Fv.0$f.48
- d _23PGetCurrentScreen__Fv.0$f.48
- d _23PGetCurrentScreen__Fv.0$f.48
- d _23PGetCurrentScreen__Fv.0$f.48
- d _23PGetCurrentScreen__Fv.0$f.51
- d _23PGetCurrentScreen__Fv.0$f.51
- d _23PGetCurrentScreen__Fv.0$f.51
- d _23PGetCurrentScreen__Fv.0$f.51
- d _23PGetCurrentScreen__Fv.0$f.6
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
- d _23PGetCurrentScreen__Fv.0$f.9
d _25NameThatColour__FG1CPc.13$boundsarray.100
d _25TIFFSetField__FP4TIFFie.0$module.51
d _26InRemoteLEDsCallback__Fv.0$RemoteLEDs.73
--- 12270,12275 ----
For some reason, your patch also causes the two functions below, neither
of
which was referenced by the code, to be emitted. Presumably they would
previously have been marked for inlining and quietly dropped by the
linliner;
yet here they are.
*************** t MedianFilter__FPUiT0iiii
*** 15873,15878 ****
--- 15726,15732 ----
t MenuDown__Fi
t MenuDrawKnobText__FP8menuitem
t MenuLeft__Fv
+ t MenuLineHC__FUiUiiii
t MenuRight__Fv
t MenuSelect__Fv
t MenuUp__Fi
*************** t SaveRendered3DStill__F13MENUSELECTION
*** 16443,16448 ****
--- 16297,16303 ----
t SaveRenderedImage__F13MENUSELECTION
t SaveRenderedStill__F13MENUSELECTION
t SaveTextVariables__FP19DISPLAYLISTENTRY_V2
+ t SaveWorkingBackground__Fii9eWP_modes
t Scale1D__FPUiiiT0iiPs
t Scale2D__FPPUiiiiiT0iiiiPs
t ScaleColourToBlack__FPUiiif
This is confusing, so I looked at one of the individual .o files that
was linked together to make the app.
*** b4/eng.txt Sun Feb 11 01:18:06 2001
--- aftr/eng.txt Sun Feb 11 01:18:02 2001
***************
*** 0 ****
--- 1 ----
+ 00000000 ? _23PGetCurrentScreen__Fv.0$f.30
***************
It has added your linkonce symbol
*** 55,76 ****
! 00000000 d _23PGetCurrentScreen__Fv.0$f.30
in the place of this one, and the remaining symbols show the space
saving..
! 000014cc d _31DecodeSoftwareVersion__FUiPci.0$recognised_checksums.350
! 00001024 D EngineeringPassword
! 00001048 D FrontPanelMessage
! 000010cc D GPI1KeyName
! 000010dc D GPI2KeyName
! 000010ec D GPO1KeyName
! 0000110c D GPO1KeyNameOff
! 000010fc D GPO2KeyName
! 0000111c D GPO2KeyNameOff
! 000010ac D LocalHostIP
! 000010bc D LocalHostIPMask
! 0000108c D LocalHostName
! 00001000 D MenuSpeeds
! 0000116c D multi_part_enabled
! 0000142c D SCSIDeviceNames
! 0000140c D SCSIDeviceTypes
! 0000118c D SCSIName
! 0000114c D SCSIPresent
! 0000138c D SCSIType
! 0000112c D Stylus1ButtonAssignmentName
! 0000113c D Stylus2ButtonAssignmentName
--- 56,76 ----
! 000004cc d _31DecodeSoftwareVersion__FUiPci.0$recognised_checksums.350
! 00000024 D EngineeringPassword
! 00000048 D FrontPanelMessage
! 000000cc D GPI1KeyName
! 000000dc D GPI2KeyName
! 000000ec D GPO1KeyName
! 0000010c D GPO1KeyNameOff
! 000000fc D GPO2KeyName
! 0000011c D GPO2KeyNameOff
! 000000ac D LocalHostIP
! 000000bc D LocalHostIPMask
! 0000008c D LocalHostName
! 00000000 D MenuSpeeds
! 0000016c D multi_part_enabled
! 0000042c D SCSIDeviceNames
! 0000040c D SCSIDeviceTypes
! 0000018c D SCSIName
! 0000014c D SCSIPresent
! 0000038c D SCSIType
! 0000012c D Stylus1ButtonAssignmentName
! 0000013c D Stylus2ButtonAssignmentName
But when I look at the objects with the size utility.
C:\Work\h051r\b4>sizeppc engineer.o
text data bss dec hex filename
119712 27820 243216 390748 5f65c engineer.o
C:\Work\h051r\aftr>sizeppc engineer.o
text data bss dec hex filename
119712 27820 243216 390748 5f65c engineer.o
I can't see any difference in the size of the data section. And looking
at the directory listing of the objects
*** b4/dirlist.txt Sun Feb 11 01:03:47 2001
--- aftr/dirlist.txt Sun Feb 11 01:03:45 2001
***************
! 323,660 engineer.o51
-----------------------
! 323,760 engineer.o51
It seems to have added 100 bytes!! So now I'm really confused. I suppose
this is probably caused by the extra inlined function bodies ?
DaveK
--
we are not seats or eyeballs or end users or consumers.
we are human beings - and our reach exceeds your grasp.
deal with it. - cluetrain.org
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************