ooo-build r11356 - trunk/patches/test
- From: michael svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r11356 - trunk/patches/test
- Date: Tue, 22 Jan 2008 12:29:27 +0000 (GMT)
Author: michael
Date: Tue Jan 22 12:29:27 2008
New Revision: 11356
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11356&view=rev
Log:
fix nasty off-by-one
Modified:
trunk/patches/test/gcc-vt-copy-4.diff
Modified: trunk/patches/test/gcc-vt-copy-4.diff
==============================================================================
--- trunk/patches/test/gcc-vt-copy-4.diff (original)
+++ trunk/patches/test/gcc-vt-copy-4.diff Tue Jan 22 12:29:27 2008
@@ -12,7 +12,7 @@
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/class.c gcc-4.2.1-simple/gcc/cp/class.c
--- pristine-gcc-4.2.1-simple/gcc/cp/class.c 2007-07-05 10:02:39.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/class.c 2008-01-21 19:54:04.000000000 +0000
++++ gcc-4.2.1-simple/gcc/cp/class.c 2008-01-22 12:23:56.000000000 +0000
@@ -181,8 +181,7 @@
static tree end_of_class (tree, int);
static bool layout_empty_base (tree, tree, splay_tree);
@@ -154,34 +154,67 @@
{
tree list;
tree vbase;
-@@ -6662,8 +6761,354 @@
+@@ -6662,8 +6761,397 @@
accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
}
+ return TREE_VALUE (list);
+}
+
++/* List of un-altered vtable inits */
++/*
++ * list of: purpose - type
++ * value - [constructor_list]
++ */
++tree vtable_copy_types;
++
++/* FIXME: rather a lame search */
++static VEC(constructor_elt,gc) *
++get_vtinit_for_binfo (tree binfo, int list_only)
++{
++ tree k;
++ for (k = vtable_copy_types; k; k = TREE_CHAIN(k))
++ {
++ if (TREE_PURPOSE(k) == binfo)
++ return CONSTRUCTOR_ELTS (TREE_VALUE(k));
++ }
++ if (list_only)
++ return NULL;
++
++ fprintf (stderr, "vtinit list: type %s not found\n",
++ type_as_string (BINFO_TYPE (binfo), TFF_PLAIN_IDENTIFIER));
++ k = get_vtbl_decl_for_binfo (binfo);
++ if (k)
++ return CONSTRUCTOR_ELTS (DECL_INITIAL (k));
++ else
++ return NULL;
++}
++
++static void
++set_vtinit_for_binfo (tree binfo, VEC(constructor_elt,gc) *vtinits)
++{
++ /* FIXME: should we search for it first ? */
++ fprintf (stderr, "vtinit list: add type %s\n",
++ type_as_string (BINFO_TYPE (binfo), TFF_PLAIN_IDENTIFIER));
++ vtable_copy_types = tree_cons (binfo, build_constructor (NULL_TREE, vtinits),
++ vtable_copy_types);
++}
++
+static void
-+debug_vtable (tree t, tree binfo, VEC(constructor_elt,gc) *opt_vtable)
++debug_vtable (tree t, tree binfo)
+{
-+ tree vtable_tree;
+ tree value;
+ unsigned HOST_WIDE_INT ix;
+ VEC(constructor_elt,gc) *vtable;
+
+ fprintf (stderr, "VTable for '%s'\n",
+ type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+ if (opt_vtable)
-+ vtable = opt_vtable;
-+ else
++
++ vtable = get_vtinit_for_binfo (binfo, 0);
++ if (!vtable)
+ {
-+ vtable_tree = get_vtbl_decl_for_binfo (binfo);
-+ if (!vtable_tree)
-+ {
-+ fprintf (stderr, "<none>\n");
-+ return;
-+ }
-+ vtable = CONSTRUCTOR_ELTS (DECL_INITIAL (vtable_tree));
++ fprintf (stderr, "<none>\n");
++ return;
+ }
+
+ FOR_EACH_CONSTRUCTOR_VALUE (vtable, ix, value)
@@ -214,11 +247,15 @@
+DEF_VEC_ALLOC_O(vt_copy_record, heap);
+
+static void
-+vtdecompose_frags (tree t_binfo, VEC(constructor_elt,gc) *vtable,
-+ VEC(vt_fragment,heap) **frags)
++vtdecompose_frags (tree t_binfo, VEC(vt_fragment,heap) **frags)
+{
+ unsigned int seek_fn = 1, i;
+ vt_fragment *frag = NULL;
++ VEC(constructor_elt,gc) *vtable;
++
++ vtable = get_vtinit_for_binfo (t_binfo, 0);
++ if (!vtable)
++ return;
+
+ for (i = 0; i < VEC_length(constructor_elt,vtable); i++)
+ {
@@ -352,7 +389,7 @@
+
+ if (bits_set == (sizeof (long) * 8)) /* FIXME: arch size etc. urgh ... */
+ {
-+ push_vtfrag (&vt_copies, src, dest, bitmap, k - bits_set);
++ push_vtfrag (&vt_copies, src, dest, bitmap, k - bits_set + 1);
+ bits_set = bitmap = 0;
+ elide_leading_zeros = 1;
+ }
@@ -386,13 +423,23 @@
+
+ /* re-write the existing vtable intializer */
+ bitmap = vtc->bitmap;
++ fprintf (stderr, "\tclobber from off %d + %d, bitmap 0x%x\n",
++ vtc->dest->offset, vtc->offset, bitmap);
+ for (j = vtc->dest->offset + vtc->offset; bitmap; j++, (bitmap>>=1))
+ {
+ if (bitmap & 1)
+ {
+ constructor_elt *elt = VEC_index (constructor_elt, vtable, j);
-+ fprintf (stderr, "\tclobber '%s'\n",
-+ expr_as_string (elt->value, TFF_PLAIN_IDENTIFIER));
++ fprintf (stderr, "\tclobber '%s' (0x%x)\n",
++ expr_as_string (elt->value, TFF_PLAIN_IDENTIFIER),
++ bitmap);
++
++ { /* Lengthy Assertion */
++ constructor_elt *src_elt = VEC_index (constructor_elt, vtc->src->vec,
++ vtc->src->offset + j - vtc->dest->offset);
++ gcc_assert (TREE_CODE (elt->value) == INTEGER_CST /* FIXME: strange, but sometimes we overlap */
++ || TREE_OPERAND (elt->value, 0) == TREE_OPERAND (src_elt->value, 0));
++ }
+ elt->value = fold_build1 (NOP_EXPR,
+ vtable_entry_type,
+ build_int_cst (build_pointer_type (void_type_node),
@@ -450,11 +497,8 @@
+finish_vtbls (tree t)
+{
+ tree inits;
-+ VEC(constructor_elt,gc) *vinits = NULL;
+
+ inits = vtbl_get_inits (t);
-+ vinits = build_init_vec (inits);
-+ /* FIXME: keep these around as our cache ? & heap allocate etc. */
+
+ if (inits && getenv ("VT_SHRINK"))
+ {
@@ -462,30 +506,29 @@
+ tree base_binfo;
+ VEC(vt_fragment,heap) *dest_frags;
+ VEC(vt_fragment,heap) *src_frags;
++ VEC(constructor_elt,gc) *vinits = NULL;
++
++ vinits = build_init_vec (inits);
++ if (!get_vtinit_for_binfo (TYPE_BINFO (t), 1))
++ set_vtinit_for_binfo (TYPE_BINFO (t), vinits);
++ else
++ fprintf (stderr, "already set!\n");
+
-+ debug_vtable (t, TYPE_BINFO (t), vinits);
++ debug_vtable (t, TYPE_BINFO (t));
+
+ fprintf (stderr, "Inherited from:\n");
+ for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (t), i, base_binfo); i++)
+ {
+ tree btype = BINFO_TYPE (base_binfo);
-+ debug_vtable (btype, TYPE_BINFO (btype), NULL);
-+ fprintf (stderr, "same ? %d or super-type\n",
-+ base_binfo == TYPE_BINFO (btype));
++ debug_vtable (btype, TYPE_BINFO (btype));
+ }
+
+ src_frags = VEC_alloc(vt_fragment,heap,4);
+ dest_frags = VEC_alloc(vt_fragment,heap,4);
-+ vtdecompose_frags (TYPE_BINFO (t), vinits, &dest_frags);
++ vtdecompose_frags (TYPE_BINFO (t), &dest_frags);
+ for (i = 0; BINFO_BASE_ITERATE (TYPE_BINFO (t), i, base_binfo); i++)
-+ {
-+ VEC(constructor_elt,gc) *vtable;
-+ tree vtable_tree = get_vtbl_decl_for_binfo (TYPE_BINFO (BINFO_TYPE (base_binfo)));
-+ if (!vtable_tree)
-+ continue;
-+ vtable = CONSTRUCTOR_ELTS (DECL_INITIAL (vtable_tree));
-+ vtdecompose_frags (TYPE_BINFO (BINFO_TYPE (base_binfo)), vtable, &src_frags);
-+ }
++ vtdecompose_frags (TYPE_BINFO (BINFO_TYPE (base_binfo)), &src_frags);
++
+ fprintf (stderr, "dest:\n");
+ debug_fragments (dest_frags);
+ fprintf (stderr, "src:\n");
@@ -512,7 +555,7 @@
/* Initialize the vtable for BINFO with the INITS. */
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/cp-tree.h gcc-4.2.1-simple/gcc/cp/cp-tree.h
--- pristine-gcc-4.2.1-simple/gcc/cp/cp-tree.h 2007-07-24 09:14:47.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/cp-tree.h 2008-01-21 19:50:44.000000000 +0000
++++ gcc-4.2.1-simple/gcc/cp/cp-tree.h 2008-01-22 10:41:00.000000000 +0000
@@ -498,6 +498,7 @@
CPTI_UNKNOWN_TYPE,
CPTI_VTBL_TYPE,
@@ -529,7 +572,7 @@
#define std_node cp_global_trees[CPTI_STD]
#define abi_node cp_global_trees[CPTI_ABI]
#define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE]
-@@ -3392,6 +3394,11 @@
+@@ -3392,6 +3394,14 @@
TREE_PURPOSE slot. */
extern GTY(()) tree static_aggregates;
@@ -538,10 +581,13 @@
+ destination is stored in the TREE_PURPOSE slot. */
+extern GTY(()) tree vtable_copy_slots;
+
++/* A type mapping of types to un-altered type tables */
++extern GTY(()) tree vtable_copy_types;
++
/* Functions called along with real static constructors and destructors. */
extern GTY(()) tree static_ctors;
-@@ -3847,6 +3854,7 @@
+@@ -3847,6 +3857,7 @@
extern void maybe_note_name_used_in_class (tree, tree);
extern void note_name_declared_in_class (tree, tree);
extern tree get_vtbl_decl_for_binfo (tree);
@@ -549,7 +595,7 @@
extern void debug_class (tree);
extern void debug_thunks (tree);
extern tree cp_fold_obj_type_ref (tree, tree);
-@@ -4533,6 +4541,8 @@
+@@ -4533,6 +4544,8 @@
extern tree mangle_typeinfo_for_type (tree);
extern tree mangle_typeinfo_string_for_type (tree);
extern tree mangle_vtbl_for_type (tree);
@@ -662,8 +708,8 @@
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-21 19:50:44.000000000 +0000
-@@ -2670,6 +2670,76 @@
++++ gcc-4.2.1-simple/gcc/cp/mangle.c 2008-01-22 10:56:33.000000000 +0000
+@@ -2670,6 +2670,79 @@
return mangle_special_for_type (type, "TV");
}
@@ -684,8 +730,8 @@
+static void write_order_complexity_for_type (const tree type)
+{
+ int max_depth = 0;
-+ int i, virts;
-+ tree binfo, vbase, p;
++ int virts;
++ tree binfo;
+ char buffer[128]; /* hack */
+
+ binfo = TYPE_BINFO (type);
@@ -693,9 +739,12 @@
+ max_depth = calc_max_depth (binfo);
+
+#if 0
-+ /* FIXME: virtual bases ? */
-+ for (vbase = binfo; vbase; vbase = TREE_CHAIN (vbase))
-+ virts++;
++ {
++ tree vbase;
++ /* FIXME: virtual bases ? */
++ for (vbase = binfo; vbase; vbase = TREE_CHAIN (vbase))
++ virts++;
++ }
+#endif
+ virts = 0;
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]