This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[C++ PATCH]: Move BV_VCALL_INDEX clearing


In preparation for reoganizing vtable construction, this patch moves
the vcall_index setting to fewer places.

booted & tested on i686-pc-linux-gnu. I also ran the CodeSourcery
ABI testsuite on i686-pc-linux-gnu, with no regressions.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2004-09-16  Nathan Sidwell  <nathan@codesourcery.com>

	* class.c (copy_virtuals): Remove.
	(build_primary_vtable): Use copy_list directly.
	(build_secondary_vtable): Likewise.
	(update_vtable_entry_for_fn): Clear BV_CALL_INDEX here.
	(create_vtable_ptr): Likewise.

Index: cp/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v
retrieving revision 1.671
diff -c -3 -p -r1.671 class.c
*** cp/class.c	15 Sep 2004 09:43:49 -0000	1.671
--- cp/class.c	16 Sep 2004 11:32:38 -0000
*************** static void build_vcall_and_vbase_vtbl_e
*** 183,189 ****
  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);
- static tree copy_virtuals (tree);
  static void build_ctor_vtbl_group (tree, tree);
  static void build_vtt (tree);
  static tree binfo_ctor_vtable (tree);
--- 183,188 ----
*************** get_vtable_decl (tree type, int complete
*** 709,730 ****
    return decl;
  }
  
- /* Returns a copy of the BINFO_VIRTUALS list in BINFO.  The
-    BV_VCALL_INDEX for each entry is cleared.  */
- 
- static tree
- copy_virtuals (tree binfo)
- {
-   tree copies;
-   tree t;
- 
-   copies = copy_list (BINFO_VIRTUALS (binfo));
-   for (t = copies; t; t = TREE_CHAIN (t))
-     BV_VCALL_INDEX (t) = NULL_TREE;
- 
-   return copies;
- }
- 
  /* Build the primary virtual function table for TYPE.  If BINFO is
     non-NULL, build the vtable starting with the initial approximation
     that it is the same as the one which is the head of the association
--- 708,713 ----
*************** build_primary_vtable (tree binfo, tree t
*** 746,752 ****
  	   no need to do it again.  */
  	return 0;
        
!       virtuals = copy_virtuals (binfo);
        TREE_TYPE (decl) = TREE_TYPE (get_vtbl_decl_for_binfo (binfo));
        DECL_SIZE (decl) = TYPE_SIZE (TREE_TYPE (decl));
        DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (TREE_TYPE (decl));
--- 729,735 ----
  	   no need to do it again.  */
  	return 0;
        
!       virtuals = copy_list (BINFO_VIRTUALS (binfo));
        TREE_TYPE (decl) = TREE_TYPE (get_vtbl_decl_for_binfo (binfo));
        DECL_SIZE (decl) = TYPE_SIZE (TREE_TYPE (decl));
        DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (TREE_TYPE (decl));
*************** build_secondary_vtable (tree binfo)
*** 797,803 ****
    SET_BINFO_NEW_VTABLE_MARKED (binfo);
    
    /* Make fresh virtual list, so we can smash it later.  */
!   BINFO_VIRTUALS (binfo) = copy_virtuals (binfo);
  
    /* Secondary vtables are laid out as part of the same structure as
       the primary vtable.  */
--- 780,786 ----
    SET_BINFO_NEW_VTABLE_MARKED (binfo);
    
    /* Make fresh virtual list, so we can smash it later.  */
!   BINFO_VIRTUALS (binfo) = copy_list (BINFO_VIRTUALS (binfo));
  
    /* Secondary vtables are laid out as part of the same structure as
       the primary vtable.  */
*************** update_vtable_entry_for_fn (tree t, tree
*** 2237,2242 ****
--- 2220,2227 ----
    if (virtual_base)
      BV_VCALL_INDEX (*virtuals) 
        = get_vcall_index (overrider_target, BINFO_TYPE (virtual_base));
+   else
+     BV_VCALL_INDEX (*virtuals) = NULL_TREE;
  }
  
  /* Called from modify_all_vtables via dfs_walk.  */
*************** create_vtable_ptr (tree t, tree* virtual
*** 4200,4205 ****
--- 4185,4191 ----
  	
  	BV_FN (new_virtual) = fn;
  	BV_DELTA (new_virtual) = integer_zero_node;
+ 	BV_VCALL_INDEX (new_virtual) = NULL_TREE;
  
  	TREE_CHAIN (new_virtual) = *virtuals_p;
  	*virtuals_p = new_virtual;

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