This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

TREE_SYMBOL_REFERENCED, assemble_name, memory wastage


I'm looking into eliminating the IDENTIFIER_NODE used by
DECL_ASSEMBLER_NAME.  In C++, where DECL_ASSEMBLER_NAME is almost
never the same as DECL_NAME, the extra IDENTIFIER_NODE means an
additional 44 bytes of memory per function (more on 64-bit machines;
it's mostly pointers).  When you've got forty thousand functions in
your input file, we're talking serious memory here.  And almost none
of that 44 bytes is used.  In fact, I'm pretty sure only two bits are:
the flags for TREE_SYMBOL_REFERENCED and TREE_ADDRESSABLE.

The trouble is that TREE_SYMBOL_REFERENCED is an important bit.  We
use it to determine all sorts of things, like whether we're going to
throw away static functions.  It might seem sensible to move it into a
decl structure.  However, it's usually set by assemble_name, which is
called in hundreds of places, most of them deep in target specific
code.  And by the time we get there, the original decl is long gone;
all we have is a string, which can be looked up in the identifier
table to recover the IDENTIFIER_NODE, which is what assemble_name
does.

To put TREE_SYMBOL_REFERENCED in decls instead, we'd need to set it
way upstream, in tree->RTL conversion.  And then we'd need to make all
the optimizers update it when they deleted dead code.  This is not
happening.

I haven't looked at TREE_ADDRESSABLE in detail but I suspect it's the
same situation.

Suggestions?

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]