public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch,RFC] java: Align data in .rodata.jutf8.* sections.
@ 2009-03-18 17:00 David Daney
  0 siblings, 0 replies; only message in thread
From: David Daney @ 2009-03-18 17:00 UTC (permalink / raw)
  To: Java Patch List; +Cc: GCC Patches, Richard Sandiford


For MIPS we have defined the DATA_ALIGNMENT target hook.  This extra
alignment causes the size of _Utf* elements contained in the
.rodata.jutf8.* sections to be different than the calculated value
which is emitted to the object file.  The result is that the linker
cannot merge identical _Utf* objects leading to bloat.

My fix is to mark the decls as DECL_USER_ALIGN so the alignment is not
overridden by DATA_ALIGNMENT.  I feel justified in doing this as I am
acting in the roll of the author of the java runtime, even though
there was no explicit alignment specified in the source code.

An alternative would be to align the decl according to all pertinent
rules (like DATA_ALIGNMENT) and use the result of that to calculate
the size of the elements.  The disadvantage of this approach is that
the resulting data ends up with a lot of unneeded padding.

The patch is only lightly tested, so I am mainly want feedback on the
approach at this time.  If deemed OK, It would probably be deferred to
4.5 as I am not sure if it is a regression.

Comments?

2009-03-18  David Daney  <ddaney@caviumnetworks.com>

	* class.c (build_utf8_ref): Make decl DECL_USER_ALIGN.

diff --git a/gcc/java/class.c b/gcc/java/class.c
index dbb84ac..fb48413 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -971,6 +971,7 @@ build_utf8_ref (tree name)
   TREE_READONLY (decl) = 1;
   TREE_THIS_VOLATILE (decl) = 0;
   DECL_INITIAL (decl) = cinit;
+  DECL_USER_ALIGN(decl) = 1;
 
   if (HAVE_GAS_SHF_MERGE)
     {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-18 16:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-18 17:00 [Patch,RFC] java: Align data in .rodata.jutf8.* sections David Daney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).