ooo-build r11355 - trunk/patches/test



Author: michael
Date: Tue Jan 22 10:33:29 2008
New Revision: 11355
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11355&view=rev

Log:
simplified & cleaned up.


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 10:33:29 2008
@@ -1,6 +1,6 @@
 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/collect2.c gcc-4.2.1-simple/gcc/collect2.c
 --- pristine-gcc-4.2.1-simple/gcc/collect2.c	2006-12-11 12:18:13.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/collect2.c	2008-01-18 14:08:10.000000000 +0000
++++ gcc-4.2.1-simple/gcc/collect2.c	2008-01-21 19:50:44.000000000 +0000
 @@ -175,7 +175,7 @@
  static int aixrtl_flag;			/* true if -brtl */
  #endif
@@ -12,43 +12,18 @@
  
 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 18:12:52.000000000 +0000
-@@ -136,7 +136,7 @@
- static tree fixed_type_or_null (tree, int *, int *);
- static tree build_simple_base_path (tree expr, tree binfo);
- static tree build_vtbl_ref_1 (tree, tree);
--static tree build_vtbl_initializer (tree, tree, tree, tree, int *);
-+static tree build_vtbl_initializer (tree, tree, tree, tree, int *, tree *);
- static int count_fields (tree);
- static int add_fields_to_record_type (tree, struct sorted_fields_type*, int);
- static void check_bitfield_decl (tree);
-@@ -180,11 +180,11 @@
- 					   tree, tree, splay_tree);
++++ gcc-4.2.1-simple/gcc/cp/class.c	2008-01-21 19:54:04.000000000 +0000
+@@ -181,8 +181,7 @@
  static tree end_of_class (tree, int);
  static bool layout_empty_base (tree, tree, splay_tree);
--static void accumulate_vtbl_inits (tree, tree, tree, tree, tree);
-+static void accumulate_vtbl_inits (tree, tree, tree, tree, tree, tree *);
- static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree,
+ static void accumulate_vtbl_inits (tree, tree, tree, tree, tree);
+-static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree,
 -					       tree);
-+					       tree, tree *);
++static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree, tree);
  static void build_rtti_vtbl_entries (tree, vtbl_init_data *);
--static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *);
-+static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *, unsigned *);
+ static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *);
  static void clone_constructors_and_destructors (tree);
- static tree build_clone (tree, tree);
- static void update_vtable_entry_for_fn (tree, tree, tree, tree *, unsigned);
-@@ -2013,6 +2013,10 @@
-       return;
-     }
-   overrider_target = overrider_fn = TREE_PURPOSE (overrider);
-+  /*  fprintf (stderr, "override %d %d\n",
-+	   TREE_VALUE (overrider) != binfo,
-+	   first_defn != binfo); */
-+  BV_INHERITED(*virtuals) = first_defn != binfo || TREE_VALUE (overrider) != binfo;
- 
-   /* Check for adjusting covariant return types.  */
-   over_return = TREE_TYPE (TREE_TYPE (overrider_target));
-@@ -6355,6 +6359,49 @@
+@@ -6355,6 +6354,49 @@
    return decl;
  }
  
@@ -98,7 +73,7 @@
  
  /* Returns the binfo for the primary base of BINFO.  If the resulting
     BINFO is a virtual base, and it is inherited elsewhere in the
-@@ -6438,7 +6485,7 @@
+@@ -6438,7 +6480,7 @@
    if (indented)
      fprintf (stream, "\n");
  
@@ -107,7 +82,7 @@
      {
        int indented = 0;
  
-@@ -6637,33 +6684,531 @@
+@@ -6637,12 +6679,69 @@
    dump_thunk (stderr, 0, fn);
  }
  
@@ -116,7 +91,7 @@
 + * toplevel: purpose - type
 + *           value   - [slot relocs]
 + * slot relocs: purpose - original binfo
-+ *              value   - init structures: [src, dest, bitmask]
++ *              value   - init structures: [src, dest, bitmap]
 + */
 +tree vtable_copy_slots;
 +
@@ -168,90 +143,6 @@
 +    return tree_cons (NULL_TREE, init, chain);
 +}
 +
-+#if 0
-+/* Register vtreloc for a given type, and return a decl
-+   for this type's vtrelocs */
-+static tree
-+build_vtreloc_decl (tree t, tree slot_relocs)
-+{
-+  int dest_offset = 0;
-+  tree inits = NULL_TREE;
-+  tree st;
-+  
-+  if (getenv ("MOREDEBUG"))
-+    fprintf (stderr, "Copy data for '%s'\n",
-+	     type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+  for (st = slot_relocs; st; st = TREE_CHAIN(st)) 
-+    {
-+      tree orig_binfo = TREE_PURPOSE(st);
-+      tree init_list = TREE_VALUE(st);
-+      tree v;
-+      int bitmap = 0;
-+      unsigned int i = 0;
-+      unsigned int src_offset = 0;
-+      int elide_leading_bits = 1;
-+
-+      if (getenv ("MOREDEBUG"))
-+	fprintf (stderr, "\tfrom %s (%d) entries\n",
-+		 orig_binfo ? type_as_string (orig_binfo, TFF_PLAIN_IDENTIFIER) : "<null pad>",
-+		 list_length (init_list));
-+      for (v = init_list; v; v = TREE_CHAIN(v))
-+	{
-+	  if (!TREE_VALUE(v))
-+	    {
-+	      if (getenv ("MOREDEBUG"))
-+		fprintf (stderr, "\t%3d\tNULL\n", dest_offset);
-+	    }
-+	  else
-+	    {
-+	      tree fn = TREE_VALUE(v);
-+	      elide_leading_bits = 0;
-+	      if (getenv ("MOREDEBUG"))
-+		{
-+		  fprintf (stderr, "\t%3d\t%s ", dest_offset,
-+			   expr_as_string (fn, TFF_PLAIN_IDENTIFIER));
-+		  fprintf (stderr, "[ %s ]\n",
-+			   expr_as_string (DECL_VINDEX (fn), TFF_PLAIN_IDENTIFIER));
-+		}
-+	      bitmap |= 1 << i;
-+	    }
-+	  /* don't waste space for non-copies */
-+	  if (!elide_leading_bits)
-+	    i++;
-+	  dest_offset++;
-+	  src_offset++;
-+	  /* FIXME: this sucks - must be a better way to 
-+	     find target size: 32 or 64 (?) [ assuming elf etc. ] */
-+	  if (i == (sizeof (long) * 8)) { /* FIXME ... arch size etc. */
-+	    /*	    inits = build_vtable_copy_slot (
-+					    t, dest_offset - i, orig_binfo,
-+					    src_offset - i, bitmap, inits); */
-+	    i = bitmap = 0;
-+	  }
-+	}
-+      /*      inits = build_vtable_copy_slot (
-+				      t, dest_offset - i, orig_binfo,
-+				      src_offset - i, bitmap, inits); */
-+    }
-+
-+  /*  if (inits)
-+    {
-+      tree decl;
-+
-+      vtable_copy_slots = tree_cons (t, inits, vtable_copy_slots);
-+    
-+      decl = get_vtreloc_decl (t, inits);
-+
-+      return build_nop (vfunc_ptr_type_node, build_address (decl));
-+    }
-+    else */
-+    return fold_build1 (NOP_EXPR,
-+			vtable_entry_type,
-+			build_int_cst (build_pointer_type (void_type_node),
-+				       0xf00df00d));
-+}
-+#endif
-+
  /* Virtual function table initialization.  */
  
  /* Create all the necessary vtables for T and its base classes.  */
@@ -263,35 +154,10 @@
  {
    tree list;
    tree vbase;
+@@ -6662,8 +6761,354 @@
+       accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
+     }
  
-+  tree slot_relocs = NULL_TREE;
-   /* We lay out the primary and secondary vtables in one contiguous
-      vtable.  The primary vtable is first, followed by the non-virtual
-      secondary vtables in inheritance graph order.  */
-   list = build_tree_list (BINFO_VTABLE (TYPE_BINFO (t)), NULL_TREE);
-   accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t),
--			 TYPE_BINFO (t), t, list);
-+			 TYPE_BINFO (t), t, list,
-+			 &slot_relocs);
- 
-   /* Then come the virtual bases, also in inheritance graph order.  */
-   for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
-     {
-       if (!BINFO_VIRTUAL_P (vbase))
- 	continue;
--      accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
-+      accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list, &slot_relocs);
-+    }
-+
-+  /* So ... we have a hack here - we append a reference to
-+     the vtable to ourselves, in order to stop us getting GC'd */
-+  /*  if (slot_relocs)
-+    {
-+      tree init = build_vtreloc_decl (t, slot_relocs);
-+      TREE_VALUE (list) = chainon (TREE_VALUE (list),
-+				   build_tree_list (NULL_TREE, init));
-+				   } */
-+
 +  return TREE_VALUE (list);
 +}
 +
@@ -448,7 +314,7 @@
 +	{
 +	  unsigned int cmp;
 +	  unsigned int k, bits_set;
-+	  unsigned int bitmask;
++	  unsigned int bitmap;
 +	  int elide_leading_zeros = 1;
 +	  vt_fragment *src = VEC_index (vt_fragment, src_frags, j);
 +
@@ -462,7 +328,7 @@
 +
 +	  /* FIXME: bin elide_leading_zeros until we have better
 +	   * comparison logic ? */
-+	  for (bitmask = bits_set = k = 0; k < cmp; k++)
++	  for (bitmap = bits_set = k = 0; k < cmp; k++)
 +	    {
 +	      tree src_fn = VEC_index (constructor_elt, src->vec, src->offset + k)->value;
 +	      tree dest_fn = VEC_index (constructor_elt, dest->vec, dest->offset + k)->value;
@@ -471,7 +337,7 @@
 +
 +	      if (src_fn == dest_fn)
 +		{
-+		  bitmask |= (1 << bits_set);
++		  bitmap |= (1 << bits_set);
 +		  elide_leading_zeros = 0;
 +		}
 +	      
@@ -479,20 +345,20 @@
 +		       expr_as_string (src_fn, TFF_PLAIN_IDENTIFIER),
 +		       src_fn == dest_fn ? "==" : "!=",
 +		       expr_as_string (dest_fn, TFF_PLAIN_IDENTIFIER),
-+		       bitmask);
++		       bitmap);
 +	      
 +	      if (!elide_leading_zeros)
 +		bits_set++;
 +
 +	      if (bits_set == (sizeof (long) * 8)) /* FIXME: arch size etc. urgh ... */
 +		{
-+		  push_vtfrag (&vt_copies, src, dest, bitmask, k - bits_set);
-+		  bits_set = bitmask = 0;
++		  push_vtfrag (&vt_copies, src, dest, bitmap, k - bits_set);
++		  bits_set = bitmap = 0;
 +		  elide_leading_zeros = 1;
 +		}
 +	    }
-+	  if (bitmask != 0)
-+	    push_vtfrag (&vt_copies, src, dest, bitmask, k - bits_set);
++	  if (bitmap != 0)
++	    push_vtfrag (&vt_copies, src, dest, bitmap, k - bits_set);
 +	}
 +    }
 +
@@ -515,14 +381,14 @@
 +      fprintf (stderr, "re-writing vtable:\n");
 +      for (i = 0; i < VEC_length(vt_copy_record, vt_copies); i++)
 +	{
-+	  unsigned int j, bitmask;
++	  unsigned int j, bitmap;
 +	  vt_copy_record *vtc = VEC_index(vt_copy_record, vt_copies, i);
 +
 +	  /* re-write the existing vtable intializer */
-+	  bitmask = vtc->bitmap;
-+	  for (j = vtc->dest->offset + vtc->offset; bitmask; j++, (bitmask>>=1))
++	  bitmap = vtc->bitmap;
++	  for (j = vtc->dest->offset + vtc->offset; bitmap; j++, (bitmap>>=1))
 +	    {
-+	      if (bitmask & 1)
++	      if (bitmap & 1)
 +		{
 +		  constructor_elt *elt = VEC_index (constructor_elt, vtable, j);
 +		  fprintf (stderr, "\tclobber '%s'\n",
@@ -575,8 +441,8 @@
 +	  elt->index = TREE_PURPOSE (t);
 +	  elt->value = TREE_VALUE (t);
 +	}
-     }
- 
++    }
++
 +  return v;
 +}
 +
@@ -590,7 +456,7 @@
 +  vinits = build_init_vec (inits);
 +  /* FIXME: keep these around as our cache ? & heap allocate etc. */
 +
-+  if (inits && getenv ("INHERITEDINITS"))
++  if (inits && getenv ("VT_SHRINK"))
 +  {
 +    int i;
 +    tree base_binfo;
@@ -644,380 +510,9 @@
  }
  
  /* Initialize the vtable for BINFO with the INITS.  */
-@@ -6945,6 +7490,7 @@
-   tree inits;
-   tree id;
-   tree vbase;
-+  tree slot_relocs;
- 
-   /* See if we've already created this construction vtable group.  */
-   id = mangle_ctor_vtbl_for_type (t, binfo);
-@@ -6955,11 +7501,13 @@
-   /* Build a version of VTBL (with the wrong type) for use in
-      constructing the addresses of secondary vtables in the
-      construction vtable group.  */
-+
-   vtbl = build_vtable (t, id, ptr_type_node);
-   DECL_CONSTRUCTION_VTABLE_P (vtbl) = 1;
-   list = build_tree_list (vtbl, NULL_TREE);
-+  slot_relocs = NULL_TREE;
-   accumulate_vtbl_inits (binfo, TYPE_BINFO (TREE_TYPE (binfo)),
--			 binfo, t, list);
-+			 binfo, t, list, NULL /* &slot_relocs */);
- 
-   /* Add the vtables for each of our virtual bases using the vbase in T
-      binfo.  */
-@@ -6973,7 +7521,7 @@
- 	continue;
-       b = copied_binfo (vbase, binfo);
- 
--      accumulate_vtbl_inits (b, vbase, binfo, t, list);
-+      accumulate_vtbl_inits (b, vbase, binfo, t, list, NULL /* &slot_relocs */);
-     }
-   inits = TREE_VALUE (list);
- 
-@@ -6986,6 +7534,11 @@
-   CLASSTYPE_VTABLES (t) = chainon (CLASSTYPE_VTABLES (t), vtbl);
-   initialize_artificial_var (vtbl, inits);
-   dump_vtable (t, binfo, vtbl);
-+
-+/* Construction vtables cause serious grief:
-+   determining overriding is tough - and we get the
-+   wrong vtable names for our fixups (etc.)
-+   append_slot_relocs (t, slot_relocs); */
- }
- 
- /* Add the vtbl initializers for BINFO (and its bases other than
-@@ -7003,7 +7556,8 @@
- 		       tree orig_binfo,
- 		       tree rtti_binfo,
- 		       tree t,
--		       tree inits)
-+		       tree inits,
-+                       tree *slot_relocs)
- {
-   int i;
-   tree base_binfo;
-@@ -7026,7 +7580,7 @@
-   TREE_VALUE (inits)
-     = chainon (TREE_VALUE (inits),
- 	       dfs_accumulate_vtbl_inits (binfo, orig_binfo,
--					  rtti_binfo, t, inits));
-+					  rtti_binfo, t, inits, slot_relocs));
- 
-   /* Walk the BINFO and its bases.  We walk in preorder so that as we
-      initialize each vtable we can figure out at what offset the
-@@ -7041,7 +7595,7 @@
-       accumulate_vtbl_inits (base_binfo,
- 			     BINFO_BASE_BINFO (orig_binfo, i),
- 			     rtti_binfo, t,
--			     inits);
-+			     inits, slot_relocs);
-     }
- }
- 
-@@ -7053,7 +7607,8 @@
- 			   tree orig_binfo,
- 			   tree rtti_binfo,
- 			   tree t,
--			   tree l)
-+			   tree l,
-+                           tree *slot_relocs)
- {
-   tree inits = NULL_TREE;
-   tree vtbl = NULL_TREE;
-@@ -7120,7 +7675,7 @@
- 
-       /* Compute the initializer for this vtable.  */
-       inits = build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo,
--				      &non_fn_entries);
-+				      &non_fn_entries, slot_relocs);
- 
-       /* Figure out the position to which the VPTR should point.  */
-       vtbl = TREE_PURPOSE (l);
-@@ -7184,7 +7739,8 @@
- 			tree orig_binfo,
- 			tree t,
- 			tree rtti_binfo,
--			int* non_fn_entries_p)
-+			int* non_fn_entries_p,
-+                        tree *slot_relocs)
- {
-   tree v, b;
-   tree vfun_inits;
-@@ -7192,6 +7748,8 @@
-   unsigned ix;
-   tree vbinfo;
-   VEC(tree,gc) *vbases;
-+  tree slot_reloc_data;
-+  unsigned num_inits, num_parent_inits;
- 
-   /* Initialize VID.  */
-   memset (&vid, 0, sizeof (vid));
-@@ -7213,7 +7771,7 @@
-      signature, we share the vcall offsets.  */
-   vid.fns = VEC_alloc (tree, gc, 32);
-   /* Add the vcall and vbase offset entries.  */
--  build_vcall_and_vbase_vtbl_entries (binfo, &vid);
-+  build_vcall_and_vbase_vtbl_entries (binfo, &vid, &num_parent_inits);
- 
-   /* Clear BINFO_VTABLE_PATH_MARKED; it's set by
-      build_vbase_offset_vtbl_entries.  */
-@@ -7240,20 +7798,62 @@
- 	}
-     }
- 
-+  num_inits = list_length (vid.inits);
-   if (non_fn_entries_p)
--    *non_fn_entries_p = list_length (vid.inits);
-+      *non_fn_entries_p = num_inits;
-+
-+  /* If we have non-function entries not present in a parent vtable,
-+     insert a bogus slot reloc copy from a NULL parent to pad that
-+     out */
-+  slot_reloc_data = NULL_TREE;
-+  if (slot_relocs && num_inits > num_parent_inits)
-+    {
-+      unsigned i;
-+      for (i = 0; i < num_inits - num_parent_inits; i++)
-+        slot_reloc_data = tree_cons (NULL_TREE, NULL_TREE,
-+                                     slot_reloc_data);
-+      *slot_relocs = chainon
-+          (*slot_relocs, tree_cons (NULL_TREE, slot_reloc_data, NULL));
-+      slot_reloc_data = NULL_TREE;
-+    }
- 
-   /* Go through all the ordinary virtual functions, building up
-      initializers.  */
-   vfun_inits = NULL_TREE;
-+
-+  if (getenv ("MOREDEBUG"))
-+    {
-+      fprintf (stderr, "Init vtable idx %d: ",
-+	       slot_relocs ? list_length (*slot_relocs) : -1);
-+      debug_class (t);
-+      fprintf (stderr, "orig_binfo:\n");
-+      debug_class (BINFO_TYPE (orig_binfo));
-+      fprintf (stderr, " (%s)",
-+	       type_as_string (t, TFF_PLAIN_IDENTIFIER));
-+      fprintf (stderr, " (%s)",
-+	       type_as_string (TYPE_BINFO (t), TFF_PLAIN_IDENTIFIER));
-+      fprintf (stderr, " (%s)",
-+	       type_as_string (binfo, TFF_PLAIN_IDENTIFIER));
-+      fprintf (stderr, " (%s) -",
-+	       type_as_string (orig_binfo, TFF_PLAIN_IDENTIFIER));
-+      fprintf (stderr, " (%s) -",
-+	       type_as_string (rtti_binfo, TFF_PLAIN_IDENTIFIER));
-+      if (get_primary_binfo (binfo))
-+	fprintf (stderr, " (%s)",
-+		 type_as_string (get_primary_binfo (binfo), TFF_PLAIN_IDENTIFIER));
-+      fprintf (stderr, "** %d inits **\n", num_inits);
-+    }
-+
-   for (v = BINFO_VIRTUALS (orig_binfo); v; v = TREE_CHAIN (v))
-     {
-       tree delta;
-       tree vcall_index;
-       tree fn, fn_original;
-       tree init = NULL_TREE;
-+      tree slot_fn = NULL_TREE;
-+      tree first_overrider = NULL_TREE;
- 
--      fn = BV_FN (v);
-+      fn = BV_FN (v); /* v! */
-       fn_original = fn;
-       if (DECL_THUNK_P (fn))
- 	{
-@@ -7281,7 +7881,10 @@
- 	{
- 	  /* We found a defn before a lost primary; go ahead as normal.  */
- 	  if (look_for_overrides_here (BINFO_TYPE (b), fn_original))
--	    break;
-+           {
-+             first_overrider = TYPE_BINFO (BINFO_TYPE (b));
-+             break;
-+           }
- 
- 	  /* The nearest definition is from a lost primary; clear the
- 	     slot.  */
-@@ -7299,6 +7902,9 @@
- 	  delta = BV_DELTA (v);
- 	  vcall_index = BV_VCALL_INDEX (v);
- 
-+/*          fprintf (stderr, "\tVfn: %s\n",
-+            expr_as_string (fn, TFF_PLAIN_IDENTIFIER)); */
-+
- 	  gcc_assert (TREE_CODE (delta) == INTEGER_CST);
- 	  gcc_assert (TREE_CODE (fn) == FUNCTION_DECL);
- 
-@@ -7315,13 +7921,57 @@
- 	    {
- 	      if (!integer_zerop (delta) || vcall_index)
- 		{
--		  fn = make_thunk (fn, /*this_adjusting=*/1, delta, vcall_index);
--		  if (!DECL_NAME (fn))
--		    finish_thunk (fn);
-+		  if (BV_INHERITED (v) && getenv ("VT_SHRINK"))
-+		    {
-+		      slot_fn = fn;
-+		      init = fold_build1 (NOP_EXPR,
-+					  vtable_entry_type,
-+					  build_int_cst (build_pointer_type (void_type_node),
-+							 0xdeadf000));
-+/* 		      fprintf (stderr,"inherited thunk!\n"); */
-+		    }
-+		  else
-+		    {
-+		      fn = make_thunk (fn, /*this_adjusting=*/1, delta, vcall_index);
-+		      if (!DECL_NAME (fn))
-+			finish_thunk (fn);
-+		    }
- 		}
--	      /* Take the address of the function, considering it to be of an
--		 appropriate generic type.  */
--	      init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
-+	      else if (getenv ("VT_SHRINK")
-+		       && slot_relocs && first_overrider
-+		       && BINFO_TYPE (first_overrider) != t
-+		       /* necessary for virtual inheritance */
-+		       && BINFO_TYPE (first_overrider) != binfo)
-+               {
-+                 /* accumulate information about overriding */
-+                 gcc_assert (BINFO_VTABLE (first_overrider));
-+                 slot_fn = fn;
-+                 init = fold_build1 (NOP_EXPR,
-+                                     vtable_entry_type,
-+                                     build_int_cst (build_pointer_type (void_type_node),
-+                                                    0xdeadbeef));
-+               }
-+	      /*              fprintf (stderr, " %s : ",
-+                       expr_as_string (fn, TFF_PLAIN_IDENTIFIER));
-+              fprintf (stderr, " %s !=? ",
-+                       type_as_string (BINFO_TYPE (first_overrider), TFF_PLAIN_IDENTIFIER));
-+              fprintf (stderr, " %s   %p !=? %p !=? %p !=? %p !=? %p\n",
-+                       type_as_string (t, TFF_PLAIN_IDENTIFIER),
-+                       BINFO_TYPE (first_overrider), t,
-+                       binfo, orig_binfo, rtti_binfo);
-+              fprintf (stderr, "%p !=? %p !=? %p !=? %p !=? %p\n",
-+                       BINFO_INHERITANCE_CHAIN (first_overrider),
-+                       BINFO_INHERITANCE_CHAIN (t),
-+                       BINFO_INHERITANCE_CHAIN (binfo),
-+                       BINFO_INHERITANCE_CHAIN (orig_binfo),
-+                       BINFO_INHERITANCE_CHAIN (rtti_binfo)); */
-+
-+              if (!init)
-+                {
-+	          /* Take the address of the function, considering it to be of an
-+		     appropriate generic type.  */
-+	          init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
-+                }
- 	    }
- 	}
- 
-@@ -7346,8 +7996,71 @@
- 	}
-       else
- 	vfun_inits = tree_cons (NULL_TREE, init, vfun_inits);
-+
-+      /* Accumulate overriding information for subequent construction
-+         of copy-vtable initialisers */
-+      if (slot_relocs)
-+      {
-+        slot_reloc_data = tree_cons (NULL_TREE, slot_fn, slot_reloc_data);
-+      }
-     }
- 
-+  /* Write details about vtable inheritance, if we have any parent entries */
-+  if (slot_relocs)
-+  {
-+      unsigned i;
-+      tree copy_parent = orig_binfo, iter = orig_binfo;
-+
-+/*      fprintf (stderr, "Find copy parent for (%s)\n",
-+	      type_as_string (BINFO_TYPE (iter), TFF_PLAIN_IDENTIFIER)); */
-+      if (orig_binfo == TYPE_BINFO (t))
-+          copy_parent = get_primary_binfo (orig_binfo);
-+      else {
-+	while (iter != TYPE_BINFO (t)) {
-+	  copy_parent = iter;
-+	  iter = BINFO_INHERITANCE_CHAIN (iter);
-+	  /*	  fprintf (stderr, "\tUp a class (%s)\n",
-+		  type_as_string (BINFO_TYPE (iter), TFF_PLAIN_IDENTIFIER)); */
-+	}
-+      }
-+      /*      fprintf (stderr, "\tresult: (%s) %p\n",
-+	       copy_parent ? type_as_string (BINFO_TYPE (copy_parent), TFF_PLAIN_IDENTIFIER) : "<null>",
-+	       copy_parent); */
-+
-+      /* FIXME: we want to walk up 'get_primary_binfo' ...
-+	 until we hit the type ... then take the 'last' entry.
-+	 Then we need to collate this with the last entry on
-+	 *slot_relocs if it has the same type ... */
-+
-+      /* We screwed up somehow ? */
-+      /*      if (copy_parent) 
-+	{
-+	  fprintf (stderr, "Copying from:\n");
-+	  debug_class (BINFO_TYPE (copy_parent));
-+	  } */
-+
-+      slot_reloc_data = nreverse (slot_reloc_data);
-+
-+      /* Prepend dummy entries for rtti etc. */
-+      for (i = 0; i < num_parent_inits; i++)
-+	slot_reloc_data = tree_cons (NULL_TREE, NULL_TREE,
-+				     slot_reloc_data);
-+
-+      if (*slot_relocs && TREE_PURPOSE(*slot_relocs) == copy_parent)
-+	{ /* append to that ... */
-+#warning badness happens here.
-+	  /* FIXME: internal entries have fewer slots ? - magic minus one ... */
-+
-+	  fprintf (stderr, "Append to that !? [%d] %d\n", num_inits, num_parent_inits);
-+	  TREE_VALUE (*slot_relocs) = chainon (TREE_VALUE (*slot_relocs), slot_reloc_data);
-+	}
-+      else
-+	{
-+	  *slot_relocs = chainon
-+	    (*slot_relocs, tree_cons (copy_parent, slot_reloc_data, NULL));
-+	}
-+  }
-+
-   /* The initializers for virtual functions were built up in reverse
-      order; straighten them out now.  */
-   vfun_inits = nreverse (vfun_inits);
-@@ -7363,7 +8076,8 @@
-    offsets in BINFO, which is in the hierarchy dominated by T.  */
- 
- static void
--build_vcall_and_vbase_vtbl_entries (tree binfo, vtbl_init_data* vid)
-+build_vcall_and_vbase_vtbl_entries (tree binfo, vtbl_init_data* vid,
-+                                    unsigned *num_parent_inits)
- {
-   tree b;
- 
-@@ -7371,10 +8085,17 @@
-      corresponding to the primary base class.  */
-   b = get_primary_binfo (binfo);
-   if (b)
--    build_vcall_and_vbase_vtbl_entries (b, vid);
-+    build_vcall_and_vbase_vtbl_entries (b, vid, NULL);
-+
-+  if (num_parent_inits)
-+    *num_parent_inits = list_length (vid->inits);
- 
-   /* Add the vbase entries for this base.  */
-   build_vbase_offset_vtbl_entries (binfo, vid);
-+
-+  if (num_parent_inits)
-+    *num_parent_inits = list_length (vid->inits);
-+
-   /* Add the vcall entries for this base.  */
-   build_vcall_offset_vtbl_entries (binfo, vid);
- }
 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-18 21:18:56.000000000 +0000
++++ gcc-4.2.1-simple/gcc/cp/cp-tree.h	2008-01-21 19:50:44.000000000 +0000
 @@ -498,6 +498,7 @@
      CPTI_UNKNOWN_TYPE,
      CPTI_VTBL_TYPE,
@@ -1034,17 +529,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]
-@@ -1466,6 +1468,9 @@
- /* The function to call.  */
- #define BV_FN(NODE) (TREE_VALUE (NODE))
- 
-+/* Inherited, rather than implemented by the class itself. */
-+#define BV_INHERITED(NODE) (TREE_THIS_VOLATILE(NODE))
-+
- 
- /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
-    this type can raise.  Each TREE_VALUE is a _TYPE.  The TREE_VALUE
-@@ -3392,6 +3397,11 @@
+@@ -3392,6 +3394,11 @@
     TREE_PURPOSE slot.  */
  extern GTY(()) tree static_aggregates;
  
@@ -1056,7 +541,7 @@
  /* Functions called along with real static constructors and destructors.  */
  
  extern GTY(()) tree static_ctors;
-@@ -3847,6 +3857,7 @@
+@@ -3847,6 +3854,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);
@@ -1064,7 +549,7 @@
  extern void debug_class				(tree);
  extern void debug_thunks			(tree);
  extern tree cp_fold_obj_type_ref		(tree, tree);
-@@ -4533,6 +4544,8 @@
+@@ -4533,6 +4541,8 @@
  extern tree mangle_typeinfo_for_type		(tree);
  extern tree mangle_typeinfo_string_for_type	(tree);
  extern tree mangle_vtbl_for_type		(tree);
@@ -1075,7 +560,7 @@
  extern tree mangle_thunk			(tree, int, tree, tree);
 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/decl.c gcc-4.2.1-simple/gcc/cp/decl.c
 --- pristine-gcc-4.2.1-simple/gcc/cp/decl.c	2007-07-24 09:14:45.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/decl.c	2008-01-18 14:08:10.000000000 +0000
++++ gcc-4.2.1-simple/gcc/cp/decl.c	2008-01-21 19:50:44.000000000 +0000
 @@ -124,6 +124,10 @@
  	tree vtbl_type_node;
  	tree vtbl_ptr_type_node;
@@ -1111,7 +596,7 @@
 +    vtbl_slot_copy_type_node = make_aggr_type (RECORD_TYPE);
 +    elem_fields = append_struct_field ("vt_src_addr", ptr_type_node, elem_fields);
 +    elem_fields = append_struct_field ("vt_dest_addr", ptr_type_node, elem_fields);
-+    elem_fields = append_struct_field ("vt_copy_bitmask", size_type_node, elem_fields);
++    elem_fields = append_struct_field ("vt_copy_bitmap", size_type_node, elem_fields);
 +    finish_builtin_struct (vtbl_slot_copy_type_node, "__vt_copy_slot_relocs",
 +                           elem_fields, NULL_TREE);
 +    layout_type (vtbl_slot_copy_type_node);
@@ -1123,8 +608,8 @@
    pop_namespace ();
 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/decl2.c gcc-4.2.1-simple/gcc/cp/decl2.c
 --- pristine-gcc-4.2.1-simple/gcc/cp/decl2.c	2007-06-28 14:16:12.000000000 +0100
-+++ gcc-4.2.1-simple/gcc/cp/decl2.c	2008-01-21 18:14:16.000000000 +0000
-@@ -2910,6 +2910,45 @@
++++ gcc-4.2.1-simple/gcc/cp/decl2.c	2008-01-21 19:50:44.000000000 +0000
+@@ -2910,6 +2910,40 @@
      finish_objects (function_key, priority, body);
  }
  
@@ -1133,7 +618,7 @@
 +{
 +  tree k;
 +
-+  if (!getenv ("VT_SHRINK") && !getenv ("INHERITEDINITS"))
++  if (!getenv ("VT_SHRINK"))
 +      return;
 +
 +  fprintf (stderr, "Generate_vtable_copy_slots\n");
@@ -1153,11 +638,6 @@
 +	  DECL_COMDAT (decl) = 1;
 +	  ctor = build_constructor_from_list (TREE_TYPE (decl), inits);
 +	  initialize_artificial_var (decl, ctor);
-+/*
-+//	  TREE_PUBLIC (decl) = 0;
-+//	  DECL_WEAK (decl) = 1;
-+//	  DECL_INTERFACE_KNOWN (decl) = 1;
-+*/
 +	  if (getenv ("MOREDEBUG"))
 +	    fprintf (stderr, "Generate vtreloc variable '%s' comdat? %d\n",
 +		     decl_as_string (decl, TFF_PLAIN_IDENTIFIER),
@@ -1170,7 +650,7 @@
  /* Generate constructor and destructor functions for the priority
     indicated by N.  */
  
-@@ -3312,6 +3351,9 @@
+@@ -3312,6 +3346,9 @@
  	}
      }
  
@@ -1182,7 +662,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/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-18 14:08:10.000000000 +0000
++++ gcc-4.2.1-simple/gcc/cp/mangle.c	2008-01-21 19:50:44.000000000 +0000
 @@ -2670,6 +2670,76 @@
    return mangle_special_for_type (type, "TV");
  }
@@ -1260,56 +740,3 @@
  /* Returns an identifier for the mangled name of the VTT for TYPE.  */
  
  tree
-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/method.c gcc-4.2.1-simple/gcc/cp/method.c
---- pristine-gcc-4.2.1-simple/gcc/cp/method.c	2006-12-11 12:16:19.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/cp/method.c	2008-01-21 16:10:01.000000000 +0000
-@@ -169,6 +169,9 @@
-   TREE_CHAIN (thunk) = DECL_THUNKS (function);
-   DECL_THUNKS (function) = thunk;
- 
-+  /*  fprintf (stderr, "make_thunk for '%s'\n",
-+      decl_as_string (function, TFF_PLAIN_IDENTIFIER)); */
-+
-   return thunk;
- }
- 
-@@ -426,6 +429,9 @@
-   DECL_ARGUMENTS (thunk_fndecl) = a;
-   BLOCK_VARS (DECL_INITIAL (thunk_fndecl)) = a;
- 
-+  fprintf (stderr, "Generate thunk '%s'\n",
-+	   decl_as_string (thunk_fndecl, TFF_PLAIN_IDENTIFIER));
-+
-   if (this_adjusting
-       && targetm.asm_out.can_output_mi_thunk (thunk_fndecl, fixed_offset,
- 					      virtual_value, alias))
-@@ -521,6 +527,8 @@
- 
-       thunk_fndecl = finish_function (0);
-       tree_lowering_passes (thunk_fndecl);
-+
-+      // causes emit_associated_thunks to be called ... [hmm ]
-       expand_body (thunk_fndecl);
-     }
- 
-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/semantics.c gcc-4.2.1-simple/gcc/cp/semantics.c
---- pristine-gcc-4.2.1-simple/gcc/cp/semantics.c	2008-01-10 09:49:05.000000000 +0000
-+++ gcc-4.2.1-simple/gcc/cp/semantics.c	2008-01-18 15:39:24.000000000 +0000
-@@ -55,7 +55,7 @@
- 
- static tree maybe_convert_cond (tree);
- static tree simplify_aggr_init_exprs_r (tree *, int *, void *);
--static void emit_associated_thunks (tree);
-+void emit_associated_thunks (tree);
- static tree finalize_nrv_r (tree *, int *, void *);
- 
- 
-@@ -3017,7 +3017,7 @@
- 
- /* Emit all thunks to FN that should be emitted when FN is emitted.  */
- 
--static void
-+void
- emit_associated_thunks (tree fn)
- {
-   /* When we use vcall offsets, we emit thunks with the virtual



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