ooo-build r11302 - trunk/patches/test



Author: michael
Date: Thu Jan 17 15:21:29 2008
New Revision: 11302
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11302&view=rev

Log:
a cunning plan to sort vtreloc inits


Modified:
   trunk/patches/test/gcc-vt-copy-3.diff

Modified: trunk/patches/test/gcc-vt-copy-3.diff
==============================================================================
--- trunk/patches/test/gcc-vt-copy-3.diff	(original)
+++ trunk/patches/test/gcc-vt-copy-3.diff	Thu Jan 17 15:21:29 2008
@@ -838,28 +838,74 @@
  
 diff -u -r -x '*~' -x testsuite -x libjava -x cc-nptl -x build-dir -x '*.orig' -x obj-i586-suse-linux -x texis -x Makeconfig -x version.h -x '*.o' -x '*.1' -x 'Makefile*' -x 'config*' -x libtool -x '*.info' -x '*.tex' pristine-gcc-4.2.1-simple/gcc/cp/mangle.c gcc-4.2.1-simple/gcc/cp/mangle.c
 --- pristine-gcc-4.2.1-simple/gcc/cp/mangle.c	2006-12-11 12:16:19.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/cp/mangle.c	2008-01-16 16:31:26.000000000 +0000
-@@ -2670,6 +2670,25 @@
++++ gcc-4.2.1-simple/gcc/cp/mangle.c	2008-01-17 14:59:24.000000000 +0000
+@@ -2670,6 +2670,71 @@
    return mangle_special_for_type (type, "TV");
  }
  
-+/* Create an identifier for the mangled name of the vt relocs for TYPE.  */
-+
-+tree mangle_vtreloc_for_type (const tree type)
++static void write_order_complexity_for_type (const tree type)
 +{
-+  return mangle_special_for_type (type, "VTR");
++  int max_depth = 0;
++  int i, virts;
++  tree binfo, base_binfo, vbase, p;
++  char buffer[128]; /* hack */
++
++  binfo = TYPE_BINFO (type);
++
++  /* FIXME: as should be obvious I have no idea what I'm doing here */
++  for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); ++i)
++    ;
++  if (i > max_depth)
++    max_depth = i;
++
++  i = 0;
++  for (p = binfo; p; p = BINFO_INHERITANCE_CHAIN (p))
++    i++;
++  if (i > max_depth)
++    max_depth = i;
++
++  /* Then come the virtual bases, also in inheritance graph order.  */
++  virts = 0;
++  for (vbase = binfo; vbase; vbase = TREE_CHAIN (vbase))
++    virts++;
++
++  sprintf (buffer, "_%.8i_", max_depth + virts);
++  write_string (buffer);
 +}
 +
-+tree mangle_vtreloc_section_for_type (const tree type)
++/*
++ * In order to get initialization order right, use a metric of
++ * the maximum 'inheritedness' of a class, ie. a vtable that
++ * inherits from 5 others, should be initialized after those
++ * that inherit from 4 
++ */
++static const char *mangle_vtreloc (const tree type, const char *prefix)
 +{
-+  const char *section;
++  const char *name;
 +
 +  start_mangling (type, /*ident_p=*/true);
-+  write_string (".vtrelocs._ZVTR");
++  write_string (prefix);
++  write_order_complexity_for_type (type);
 +  write_type (type);
-+  section = finish_mangling (/*warn=*/false);
++  name = finish_mangling (/*warn=*/false);
++  fprintf (stderr, "name '%s'\n", name);
++
++  return name;
++}
++
++/* Create an identifier for the mangled name of the vt relocs for TYPE.  */
++
++tree mangle_vtreloc_for_type (const tree type)
++{
++  return get_identifier_nocopy (mangle_vtreloc (type, "_ZVTR"));
++}
++
++/* Create an identifier for the section name of the vt relocs for TYPE.  */
 +
-+  return build_string (strlen (section), section);
++tree mangle_vtreloc_section_for_type (const tree type)
++{
++  const char *name = mangle_vtreloc (type, ".vtrelocs._ZVTR");
++  return build_string (strlen (name), name);
 +}
 +
  /* Returns an identifier for the mangled name of the VTT for TYPE.  */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]