This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch,RFC] java: Align data in .rodata.jutf8.* sections.



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)
    {


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