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]

[C++ patch]: Remove old-abi code


Hi,
this patch removes five defines which controlled the abi class
layout. These were all wired to 1 for the new abi. I've removed
the old-abi code that they controlled.

I've adjusted comments refering to differences between old and
new abi's. And just referred to 'the abi'.

Doing this removal, shows some routines that can be merged into
their single caller, as they've now got so simple. I'll get to that
later.

Next:
1) remove flag_vtable_thunks
2) remove old-abi related test cases
3) simplify

what about -fno-honor-std?

booted & tested on i686-pc-linux-gnu, ok?

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2001-07-20  Nathan Sidwell  <nathan@codesourcery.com>

	Remove old-abi remnants. Remove comments about old abi
	behaviour. Remove refences to 'new-abi' in comments.
	* cp-tree.h: Adjust comments.
	(vbase_offsets_in_vtable_p): Delete.
	(vcall_offsets_in_vtable_p): Delete.
	(vptrs_present_everywhere_p): Delete.
	(all_overridden_vfuns_in_vtables_p): Delete.
	(merge_primary_and_secondary_vtables_p): Delete.
	(TYPE_CONTAINS_VPTR_P): Adjust.
	(VTT_NAME_PREFIX): Remove.
	(CTOR_VTBL_NAME_PREFIX): Remove.
	(init_vbase_pointers): Remove.
	* class.c: Adjust coments.
	(build_vbase_pointer_fields): Delete.
	(build_vbase_pointer): Remove old-abi code.
	(build_secondary_vtable): Likewise.
	(modify_all_vtables): Likewise.
	(create_vtable_ptr): Likewise.
	(layout_class_type): Likewise.
	(finish_struct_1): Likewise.
	(finish_vtbls): Likewise.
	(dfs_finish_vtbls): Delete.
	(build_vbase_offset_vtbl_entries): Remove old-abi code.
	* cvt.c: Adjust comments.
	* decl.c: Adjust comments.
	* decl2.c: Adjust comments.
	* init.c: Adjust comments.
	(construct_virtual_bases): Remove old-abi code.
	* lang-specs.h: Remove -fno-new-abi.
	* mangle.c: Adjust comments.
	* rtti.c: Adjust comments.
	(get_base_offset): Remove old-abi-code.
	* search.c: Adjust comments.
	(dfs_init_vbase_pointers): Remove.
	(dfs_vtable_path_unmark): Remove.
	(init_vbase_pointers): Remove.
	* semantics.c: Adjust comments.
	(emit_associated_thunks): Remove old-abi code.
	* typeck.c: Adjust comments.

Index: cp/class.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/class.c,v
retrieving revision 1.394
diff -c -3 -p -r1.394 class.c
*** class.c	2001/07/19 07:22:40	1.394
--- class.c	2001/07/20 11:30:14
*************** static tree get_vtable_name PARAMS ((tre
*** 112,118 ****
  static tree get_basefndecls PARAMS ((tree, tree));
  static int build_primary_vtable PARAMS ((tree, tree));
  static int build_secondary_vtable PARAMS ((tree, tree));
- static tree dfs_finish_vtbls PARAMS ((tree, void *));
  static void finish_vtbls PARAMS ((tree));
  static void modify_vtable_entry PARAMS ((tree, tree, tree, tree, tree *));
  static void add_virtual_function PARAMS ((tree *, tree *, int *, tree, tree));
--- 112,117 ----
*************** static bool build_base_field PARAMS ((re
*** 147,153 ****
  				     splay_tree, tree));
  static bool build_base_fields PARAMS ((record_layout_info, int *,
  				      splay_tree, tree));
- static tree build_vbase_pointer_fields PARAMS ((record_layout_info, int *));
  static tree build_vtbl_or_vbase_field PARAMS ((tree, tree, tree, tree, tree,
  					       int *));
  static void check_methods PARAMS ((tree));
--- 146,151 ----
*************** int n_inner_fields_searched = 0;
*** 241,324 ****
  
  /* Virtual base class layout.  */
  
- /* Returns a list of virtual base class pointers as a chain of
-    FIELD_DECLS.  */
- 
- static tree
- build_vbase_pointer_fields (rli, empty_p)
-      record_layout_info rli;
-      int *empty_p;
- {
-   /* Chain to hold all the new FIELD_DECLs which point at virtual
-      base classes.  */
-   tree rec = rli->t;
-   tree vbase_decls = NULL_TREE;
-   tree binfos = TYPE_BINFO_BASETYPES (rec);
-   int n_baseclasses = CLASSTYPE_N_BASECLASSES (rec);
-   tree decl;
-   int i;
- 
-   /* Under the new ABI, there are no vbase pointers in the object.
-      Instead, the offsets are stored in the vtable.  */
-   if (vbase_offsets_in_vtable_p ())
-     return NULL_TREE;
- 
-   /* Loop over the baseclasses, adding vbase pointers as needed.  */
-   for (i = 0; i < n_baseclasses; i++)
-     {
-       register tree base_binfo = TREE_VEC_ELT (binfos, i);
-       register tree basetype = BINFO_TYPE (base_binfo);
- 
-       if (!COMPLETE_TYPE_P (basetype))
- 	/* This error is now reported in xref_tag, thus giving better
- 	   location information.  */
- 	continue;
- 
-       /* All basetypes are recorded in the association list of the
- 	 derived type.  */
- 
-       if (TREE_VIA_VIRTUAL (base_binfo))
- 	{
- 	  int j;
- 	  const char *name;
- 
- 	  /* The offset for a virtual base class is only used in computing
- 	     virtual function tables and for initializing virtual base
- 	     pointers.  It is built once `get_vbase_types' is called.  */
- 
- 	  /* If this basetype can come from another vbase pointer
- 	     without an additional indirection, we will share
- 	     that pointer.  If an indirection is involved, we
- 	     make our own pointer.  */
- 	  for (j = 0; j < n_baseclasses; j++)
- 	    {
- 	      tree other_base_binfo = TREE_VEC_ELT (binfos, j);
- 	      if (! TREE_VIA_VIRTUAL (other_base_binfo)
- 		  && binfo_for_vbase (basetype, BINFO_TYPE (other_base_binfo)))
- 		goto got_it;
- 	    }
- 	  FORMAT_VBASE_NAME (name, basetype);
- 	  decl = build_vtbl_or_vbase_field (get_identifier (name), 
- 					    get_identifier (VTABLE_BASE),
- 					    build_pointer_type (basetype),
- 					    rec,
- 					    basetype,
- 					    empty_p);
- 	  BINFO_VPTR_FIELD (base_binfo) = decl;
- 	  TREE_CHAIN (decl) = vbase_decls;
- 	  place_field (rli, decl);
- 	  vbase_decls = decl;
- 	  *empty_p = 0;
- 
- 	got_it:
- 	  /* The space this decl occupies has already been accounted for.  */
- 	  ;
- 	}
-     }
- 
-   return vbase_decls;
- }
- 
  /* Returns a pointer to the virtual base class of EXP that has the
     indicated TYPE.  EXP is of class type, not a pointer type.  */
  
--- 239,244 ----
*************** static tree
*** 326,361 ****
  build_vbase_pointer (exp, type)
       tree exp, type;
  {
!   if (vbase_offsets_in_vtable_p ())
!     {
!       tree vbase;
!       tree vbase_ptr;
  
!       /* Find the shared copy of TYPE; that's where the vtable offset
! 	 is recorded.  */
!       vbase = binfo_for_vbase (type, TREE_TYPE (exp));
!       /* Find the virtual function table pointer.  */
!       vbase_ptr = build_vfield_ref (exp, TREE_TYPE (exp));
!       /* Compute the location where the offset will lie.  */
!       vbase_ptr = build (PLUS_EXPR, 
! 			 TREE_TYPE (vbase_ptr),
! 			 vbase_ptr,
! 			 BINFO_VPTR_FIELD (vbase));
!       vbase_ptr = build1 (NOP_EXPR, 
! 			  build_pointer_type (ptrdiff_type_node),
! 			  vbase_ptr);
!       /* Add the contents of this location to EXP.  */
!       return build (PLUS_EXPR,
! 		    build_pointer_type (type),
! 		    build_unary_op (ADDR_EXPR, exp, /*noconvert=*/0),
! 		    build1 (INDIRECT_REF, ptrdiff_type_node, vbase_ptr));
!     }
!   else
!     {
!       char *name;
!       FORMAT_VBASE_NAME (name, type);
!       return build_component_ref (exp, get_identifier (name), NULL_TREE, 0);
!     }
  }
  
  /* Build multi-level access to EXPR using hierarchy path PATH.
--- 246,272 ----
  build_vbase_pointer (exp, type)
       tree exp, type;
  {
!   tree vbase;
!   tree vbase_ptr;
  
!   /* Find the shared copy of TYPE; that's where the vtable offset is
!      recorded.  */
!   vbase = binfo_for_vbase (type, TREE_TYPE (exp));
!   /* Find the virtual function table pointer.  */
!   vbase_ptr = build_vfield_ref (exp, TREE_TYPE (exp));
!   /* Compute the location where the offset will lie.  */
!   vbase_ptr = build (PLUS_EXPR, 
! 		     TREE_TYPE (vbase_ptr),
! 		     vbase_ptr,
! 		     BINFO_VPTR_FIELD (vbase));
!   vbase_ptr = build1 (NOP_EXPR, 
! 		      build_pointer_type (ptrdiff_type_node),
! 		      vbase_ptr);
!   /* Add the contents of this location to EXP.  */
!   return build (PLUS_EXPR,
! 		build_pointer_type (type),
! 		build_unary_op (ADDR_EXPR, exp, /*noconvert=*/0),
! 		build1 (INDIRECT_REF, ptrdiff_type_node, vbase_ptr));
  }
  
  /* Build multi-level access to EXPR using hierarchy path PATH.
*************** build_vtbl_ref (instance, idx)
*** 603,610 ****
  	{
  	  vtbl = TYPE_BINFO_VTABLE (basetype);
  	  /* Knowing the dynamic type of INSTANCE we can easily obtain
! 	     the correct vtable entry.  In the new ABI, we resolve
! 	     this back to be in terms of the primary vtable.  */
  	  if (TREE_CODE (vtbl) == PLUS_EXPR)
  	    {
  	      idx = fold (build (PLUS_EXPR,
--- 514,521 ----
  	{
  	  vtbl = TYPE_BINFO_VTABLE (basetype);
  	  /* Knowing the dynamic type of INSTANCE we can easily obtain
! 	     the correct vtable entry.  We resolve this back to be in
! 	     terms of the primary vtable.  */
  	  if (TREE_CODE (vtbl) == PLUS_EXPR)
  	    {
  	      idx = fold (build (PLUS_EXPR,
*************** build_primary_vtable (binfo, type)
*** 818,832 ****
    return 1;
  }
  
! /* Give TYPE a new virtual function table which is initialized
     with a skeleton-copy of its original initialization.  The only
     entry that changes is the `delta' entry, so we can really
     share a lot of structure.
  
!    FOR_TYPE is the derived type which caused this table to
     be needed.
  
!    BINFO is the type association which provided TYPE for FOR_TYPE.
  
     The order in which vtables are built (by calling this function) for
     an object must remain the same, otherwise a binary incompatibility
--- 729,743 ----
    return 1;
  }
  
! /* Give BINFO a new virtual function table which is initialized
     with a skeleton-copy of its original initialization.  The only
     entry that changes is the `delta' entry, so we can really
     share a lot of structure.
  
!    FOR_TYPE is the most derived type which caused this table to
     be needed.
  
!    Returns non-zero if we haven't met BINFO before.
  
     The order in which vtables are built (by calling this function) for
     an object must remain the same, otherwise a binary incompatibility
*************** static int
*** 836,978 ****
  build_secondary_vtable (binfo, for_type)
       tree binfo, for_type;
  {
!   tree basetype;
!   tree orig_decl = BINFO_VTABLE (binfo);
!   tree name;
!   tree new_decl;
!   tree offset;
!   tree path = binfo;
!   char *buf;
!   const char *buf2;
!   char joiner = '_';
!   int i;
! 
! #ifdef JOINER
!   joiner = JOINER;
! #endif
! 
!   if (TREE_VIA_VIRTUAL (binfo))
!     my_friendly_assert (binfo == binfo_for_vbase (BINFO_TYPE (binfo),
! 						  current_class_type),
! 			170);
  
!   if (BINFO_NEW_VTABLE_MARKED (binfo, current_class_type))
      /* We already created a vtable for this base.  There's no need to
         do it again.  */
      return 0;
  
    /* Remember that we've created a vtable for this BINFO, so that we
       don't try to do so again.  */
!   SET_BINFO_NEW_VTABLE_MARKED (binfo, current_class_type);
    
    /* Make fresh virtual list, so we can smash it later.  */
    BINFO_VIRTUALS (binfo) = copy_virtuals (binfo);
- 
-   my_friendly_assert (binfo == CANONICAL_BINFO (binfo, for_type), 20010605);
-   offset = BINFO_OFFSET (binfo);
- 
-   /* In the new ABI, secondary vtables are laid out as part of the
-      same structure as the primary vtable.  */
-   if (merge_primary_and_secondary_vtables_p ())
-     {
-       BINFO_VTABLE (binfo) = NULL_TREE;
-       return 1;
-     }
- 
-   /* Create the declaration for the secondary vtable.  */
-   basetype = TYPE_MAIN_VARIANT (BINFO_TYPE (binfo));
-   buf2 = TYPE_ASSEMBLER_NAME_STRING (basetype);
-   i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1;
- 
-   /* We know that the vtable that we are going to create doesn't exist
-      yet in the global namespace, and when we finish, it will be
-      pushed into the global namespace.  In complex MI hierarchies, we
-      have to loop while the name we are thinking of adding is globally
-      defined, adding more name components to the vtable name as we
-      loop, until the name is unique.  This is because in complex MI
-      cases, we might have the same base more than once.  This means
-      that the order in which this function is called for vtables must
-      remain the same, otherwise binary compatibility can be
-      compromised.  */
- 
-   while (1)
-     {
-       char *buf1 = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (for_type)
- 				    + 1 + i);
-       char *new_buf2;
- 
-       sprintf (buf1, "%s%c%s", TYPE_ASSEMBLER_NAME_STRING (for_type), joiner,
- 	       buf2);
-       buf = (char *) alloca (strlen (VTABLE_NAME_PREFIX) + strlen (buf1) + 1);
-       sprintf (buf, "%s%s", VTABLE_NAME_PREFIX, buf1);
-       name = get_identifier (buf);
- 
-       /* If this name doesn't clash, then we can use it, otherwise
- 	 we add more to the name until it is unique.  */
- 
-       if (! IDENTIFIER_GLOBAL_VALUE (name))
- 	break;
- 
-       /* Set values for next loop through, if the name isn't unique.  */
- 
-       path = BINFO_INHERITANCE_CHAIN (path);
  
!       /* We better not run out of stuff to make it unique.  */
!       my_friendly_assert (path != NULL_TREE, 368);
! 
!       basetype = TYPE_MAIN_VARIANT (BINFO_TYPE (path));
! 
!       if (for_type == basetype)
! 	{
! 	  /* If we run out of basetypes in the path, we have already
! 	     found created a vtable with that name before, we now
! 	     resort to tacking on _%d to distinguish them.  */
! 	  int j = 2;
! 	  i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1 + i + 1 + 3;
! 	  buf1 = (char *) alloca (i);
! 	  do {
! 	    sprintf (buf1, "%s%c%s%c%d",
! 		     TYPE_ASSEMBLER_NAME_STRING (basetype), joiner,
! 		     buf2, joiner, j);
! 	    buf = (char *) alloca (strlen (VTABLE_NAME_PREFIX)
! 				   + strlen (buf1) + 1);
! 	    sprintf (buf, "%s%s", VTABLE_NAME_PREFIX, buf1);
! 	    name = get_identifier (buf);
! 
! 	    /* If this name doesn't clash, then we can use it,
! 	       otherwise we add something different to the name until
! 	       it is unique.  */
! 	  } while (++j <= 999 && IDENTIFIER_GLOBAL_VALUE (name));
! 
! 	  /* Hey, they really like MI don't they?  Increase the 3
!              above to 6, and the 999 to 999999.  :-)  */
! 	  my_friendly_assert (j <= 999, 369);
! 
! 	  break;
! 	}
! 
!       i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1 + i;
!       new_buf2 = (char *) alloca (i);
!       sprintf (new_buf2, "%s%c%s",
! 	       TYPE_ASSEMBLER_NAME_STRING (basetype), joiner, buf2);
!       buf2 = new_buf2;
!     }
! 
!   new_decl = build_vtable (for_type, name, TREE_TYPE (orig_decl));
!   DECL_ALIGN (new_decl) = DECL_ALIGN (orig_decl);
!   DECL_USER_ALIGN (new_decl) = DECL_USER_ALIGN (orig_decl);
!   BINFO_VTABLE (binfo) = pushdecl_top_level (new_decl);
! 
! #ifdef GATHER_STATISTICS
!   n_vtables += 1;
!   n_vtable_elems += list_length (BINFO_VIRTUALS (binfo));
! #endif
! 
    return 1;
  }
  
  /* Create a new vtable for BINFO which is the hierarchy dominated by
!    T.  */
  
  static int
  make_new_vtable (t, binfo)
--- 747,774 ----
  build_secondary_vtable (binfo, for_type)
       tree binfo, for_type;
  {
!   my_friendly_assert (binfo == CANONICAL_BINFO (binfo, for_type), 20010605);
  
!   if (BINFO_NEW_VTABLE_MARKED (binfo, for_type))
      /* We already created a vtable for this base.  There's no need to
         do it again.  */
      return 0;
  
    /* Remember that we've created a vtable for this BINFO, so that we
       don't try to do so again.  */
!   SET_BINFO_NEW_VTABLE_MARKED (binfo, for_type);
    
    /* 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.  */
!   BINFO_VTABLE (binfo) = NULL_TREE;
    return 1;
  }
  
  /* Create a new vtable for BINFO which is the hierarchy dominated by
!    T. Return non-zero if we actually created a new vtable.  */
  
  static int
  make_new_vtable (t, binfo)
*************** determine_primary_base (t, vfuns_p)
*** 1903,1911 ****
  	  if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
  	    CLASSTYPE_RTTI (t) = CLASSTYPE_RTTI (basetype);
  
! 	  /* A virtual baseclass can't be the primary base under the
! 	     old ABI.  And under the new ABI we still prefer a
! 	     non-virtual base.  */
  	  if (TREE_VIA_VIRTUAL (base_binfo))
  	    continue;
  
--- 1699,1706 ----
  	  if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
  	    CLASSTYPE_RTTI (t) = CLASSTYPE_RTTI (basetype);
  
! 	  /* We prefer a non-virtual base, although a virtual one will
! 	     do.  */
  	  if (TREE_VIA_VIRTUAL (base_binfo))
  	    continue;
  
*************** determine_primary_base (t, vfuns_p)
*** 1974,1982 ****
  	}
      }
  
!   /* The new ABI allows for the use of a "nearly-empty" virtual base
!      class as the primary base class if no non-virtual polymorphic
!      base can be found.  */
    if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
      {
        /* If not NULL, this is the best primary base candidate we have
--- 1769,1776 ----
  	}
      }
  
!   /* A "nearly-empty" virtual base class can be the primary base
!      class, if no non-virtual polymorphic base can be found.  */
    if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
      {
        /* If not NULL, this is the best primary base candidate we have
*************** update_vtable_entry_for_fn (t, binfo, fn
*** 2759,2767 ****
       the final overrider, and not to an intermediate virtual base.  */
    virtual_base = NULL_TREE;
  
!   /* Under the new ABI, we will convert to an intermediate virtual
!      base first, and then use the vcall offset located there to finish
!      the conversion.  */
    while (b)
      {
        /* If we find the final overrider, then we can stop
--- 2553,2560 ----
       the final overrider, and not to an intermediate virtual base.  */
    virtual_base = NULL_TREE;
  
!   /* We will convert to an intermediate virtual base first, and then
!      use the vcall offset located there to finish the conversion.  */
    while (b)
      {
        /* If we find the final overrider, then we can stop
*************** dfs_modify_vtables (binfo, data)
*** 2851,2859 ****
  
        t = (tree) data;
  
-       /* If we're supporting RTTI then we always need a new vtable to
- 	 point to the RTTI information.  Under the new ABI we may need
- 	 a new vtable to contain vcall and vbase offsets.  */
        make_new_vtable (t, binfo);
        
        /* Now, go through each of the virtual functions in the virtual
--- 2644,2649 ----
*************** modify_all_vtables (t, vfuns_p, overridd
*** 2890,2899 ****
       int *vfuns_p;
       tree overridden_virtuals;
  {
!   tree binfo;
  
-   binfo = TYPE_BINFO (t);
- 
    /* Update all of the vtables.  */
    dfs_walk (binfo, 
  	    dfs_modify_vtables, 
--- 2680,2688 ----
       int *vfuns_p;
       tree overridden_virtuals;
  {
!   tree binfo = TYPE_BINFO (t);
!   tree *fnsp;
  
    /* Update all of the vtables.  */
    dfs_walk (binfo, 
  	    dfs_modify_vtables, 
*************** modify_all_vtables (t, vfuns_p, overridd
*** 2901,2943 ****
  	    t);
    dfs_walk (binfo, dfs_unmark, dfs_marked_real_bases_queue_p, t);
  
!   /* If we should include overriding functions for secondary vtables
!      in our primary vtable, add them now.  */
!   if (all_overridden_vfuns_in_vtables_p ())
!     {
!       tree *fnsp = &overridden_virtuals;
! 
!       while (*fnsp)
! 	{
! 	  tree fn = TREE_VALUE (*fnsp);
! 
! 	  if (!BINFO_VIRTUALS (binfo)
! 	      || !value_member (fn, BINFO_VIRTUALS (binfo)))
! 	    {
! 	      /* Set the vtable index.  */
! 	      set_vindex (fn, vfuns_p);
! 	      /* We don't need to convert to a base class when calling
! 		 this function.  */
! 	      DECL_VIRTUAL_CONTEXT (fn) = t;
! 
! 	      /* We don't need to adjust the `this' pointer when
! 		 calling this function.  */
! 	      BV_DELTA (*fnsp) = integer_zero_node;
! 	      BV_VCALL_INDEX (*fnsp) = NULL_TREE;
! 
! 	      /* This is an overridden function not already in our
! 		 vtable.  Keep it.  */
! 	      fnsp = &TREE_CHAIN (*fnsp);
! 	    }
! 	  else
! 	    /* We've already got an entry for this function.  Skip
! 	       it.  */
! 	    *fnsp = TREE_CHAIN (*fnsp);
  	}
      }
!   else
!     overridden_virtuals = NULL_TREE;
! 
    return overridden_virtuals;
  }
  
--- 2690,2724 ----
  	    t);
    dfs_walk (binfo, dfs_unmark, dfs_marked_real_bases_queue_p, t);
  
!   /* Include overriding functions for secondary vtables in our primary
!      vtable.  */
!   for (fnsp = &overridden_virtuals; *fnsp; )
!     {
!       tree fn = TREE_VALUE (*fnsp);
! 
!       if (!BINFO_VIRTUALS (binfo)
! 	  || !value_member (fn, BINFO_VIRTUALS (binfo)))
! 	{
! 	  /* Set the vtable index.  */
! 	  set_vindex (fn, vfuns_p);
! 	  /* We don't need to convert to a base class when calling
! 	     this function.  */
! 	  DECL_VIRTUAL_CONTEXT (fn) = t;
! 
! 	  /* We don't need to adjust the `this' pointer when
! 	     calling this function.  */
! 	  BV_DELTA (*fnsp) = integer_zero_node;
! 	  BV_VCALL_INDEX (*fnsp) = NULL_TREE;
! 
! 	  /* This is an overridden function not already in our
! 	     vtable.  Keep it.  */
! 	  fnsp = &TREE_CHAIN (*fnsp);
  	}
+       else
+ 	/* We've already got an entry for this function.  Skip it.  */
+ 	*fnsp = TREE_CHAIN (*fnsp);
      }
!   
    return overridden_virtuals;
  }
  
*************** build_base_fields (rli, empty_p, offsets
*** 4179,4186 ****
    int i;
    bool atend = 0;
  
!   /* Under the new ABI, the primary base class is always allocated
!      first.  */
    if (CLASSTYPE_HAS_PRIMARY_BASE_P (rec))
      build_base_field (rli, CLASSTYPE_PRIMARY_BINFO (rec), 
  		      empty_p, offsets, t);
--- 3960,3966 ----
    int i;
    bool atend = 0;
  
!   /* The primary base class is always allocated first.  */
    if (CLASSTYPE_HAS_PRIMARY_BASE_P (rec))
      build_base_field (rli, CLASSTYPE_PRIMARY_BINFO (rec), 
  		      empty_p, offsets, t);
*************** build_base_fields (rli, empty_p, offsets
*** 4192,4199 ****
  
        base_binfo = BINFO_BASETYPE (TYPE_BINFO (rec), i);
  
!       /* Under the new ABI, the primary base was already allocated
! 	 above, so we don't need to allocate it again here.  */
        if (base_binfo == CLASSTYPE_PRIMARY_BINFO (rec))
  	continue;
  
--- 3972,3979 ----
  
        base_binfo = BINFO_BASETYPE (TYPE_BINFO (rec), i);
  
!       /* The primary base was already allocated above, so we don't
! 	 need to allocate it again here.  */
        if (base_binfo == CLASSTYPE_PRIMARY_BINFO (rec))
  	continue;
  
*************** create_vtable_ptr (t, empty_p, vfuns_p,
*** 4710,4718 ****
       here.  Even if there weren't any new virtual functions, we might need a
       new virtual function table if we're supposed to include vptrs in
       all classes that need them.  */
!   if (!TYPE_VFIELD (t)
!       && (*vfuns_p 
! 	  || (TYPE_CONTAINS_VPTR_P (t) && vptrs_present_everywhere_p ())))
      {
        /* We build this decl with vtbl_ptr_type_node, which is a
  	 `vtable_entry_type*'.  It might seem more precise to use
--- 4490,4496 ----
       here.  Even if there weren't any new virtual functions, we might need a
       new virtual function table if we're supposed to include vptrs in
       all classes that need them.  */
!   if (!TYPE_VFIELD (t) && (*vfuns_p || TYPE_CONTAINS_VPTR_P (t)))
      {
        /* We build this decl with vtbl_ptr_type_node, which is a
  	 `vtable_entry_type*'.  It might seem more precise to use
*************** layout_virtual_bases (t, offsets)
*** 4917,4926 ****
    TYPE_ALIGN (t) = MAX (TYPE_ALIGN (t), BITS_PER_UNIT);
  
    /* Go through the virtual bases, allocating space for each virtual
!      base that is not already a primary base class.  Under the old
!      ABI, these are allocated according to a depth-first left-to-right
!      postorder traversal; in the new ABI, inheritance graph order is
!      used instead.  */
    for (vbases = TYPE_BINFO (t);
         vbases; 
         vbases = TREE_CHAIN (vbases))
--- 4695,4702 ----
    TYPE_ALIGN (t) = MAX (TYPE_ALIGN (t), BITS_PER_UNIT);
  
    /* Go through the virtual bases, allocating space for each virtual
!      base that is not already a primary base class.  These are
!      allocated in inheritance graph order.  */
    for (vbases = TYPE_BINFO (t);
         vbases; 
         vbases = TREE_CHAIN (vbases))
*************** layout_virtual_bases (t, offsets)
*** 4947,4954 ****
  	     appropriately aligned offset.  */
  	  dsize = CEIL (dsize, desired_align) * desired_align;
  
! 	  /* Under the new ABI, we try to squish empty virtual bases in
! 	     just like ordinary empty bases.  */
  	  if (is_empty_class (basetype))
  	    layout_empty_base (vbase,
  			       size_int (CEIL (dsize, BITS_PER_UNIT)),
--- 4723,4730 ----
  	     appropriately aligned offset.  */
  	  dsize = CEIL (dsize, desired_align) * desired_align;
  
! 	  /* We try to squish empty virtual bases in just like
! 	     ordinary empty bases.  */
  	  if (is_empty_class (basetype))
  	    layout_empty_base (vbase,
  			       size_int (CEIL (dsize, BITS_PER_UNIT)),
*************** layout_class_type (t, empty_p, vfuns_p, 
*** 5130,5137 ****
    vptr = create_vtable_ptr (t, empty_p, vfuns_p,
  			    new_virtuals_p, overridden_virtuals_p);
  
!   /* Under the new ABI, the vptr is always the first thing in the
!      class.  */
    if (vptr)
      {
        TYPE_FIELDS (t) = chainon (vptr, TYPE_FIELDS (t));
--- 4906,4912 ----
    vptr = create_vtable_ptr (t, empty_p, vfuns_p,
  			    new_virtuals_p, overridden_virtuals_p);
  
!   /* The vptr is always the first thing in the class.  */
    if (vptr)
      {
        TYPE_FIELDS (t) = chainon (vptr, TYPE_FIELDS (t));
*************** layout_class_type (t, empty_p, vfuns_p, 
*** 5144,5153 ****
    if (build_base_fields (rli, empty_p, empty_base_offsets, t))
      CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
    
-   /* Add pointers to all of our virtual base-classes.  */
-   TYPE_FIELDS (t) = chainon (build_vbase_pointer_fields (rli, empty_p),
- 			     TYPE_FIELDS (t));
- 
    /* CLASSTYPE_INLINE_FRIENDS is really TYPE_NONCOPIED_PARTS.  Thus,
       we have to save this before we start modifying
       TYPE_NONCOPIED_PARTS.  */
--- 4919,4924 ----
*************** layout_class_type (t, empty_p, vfuns_p, 
*** 5170,5179 ****
        type = TREE_TYPE (field);
  
        /* If this field is a bit-field whose width is greater than its
! 	 type, then there are some special rules for allocating it
! 	 under the new ABI.  Under the old ABI, there were no special
! 	 rules, but the back-end can't handle bitfields longer than a
! 	 `long long', so we use the same mechanism.  */
        if (DECL_C_BIT_FIELD (field)
  	  && INT_CST_LT (TYPE_SIZE (type), DECL_SIZE (field)))
  	{
--- 4941,4948 ----
        type = TREE_TYPE (field);
  
        /* If this field is a bit-field whose width is greater than its
! 	 type, then there are some special rules for allocating
! 	 it.  */
        if (DECL_C_BIT_FIELD (field)
  	  && INT_CST_LT (TYPE_SIZE (type), DECL_SIZE (field)))
  	{
*************** layout_class_type (t, empty_p, vfuns_p, 
*** 5238,5247 ****
      }
  
    /* We make all structures have at least one element, so that they
!      have non-zero size.  In the new ABI, the class may be empty even
!      if it has basetypes.  Therefore, we add the fake field after all
!      the other fields; if there are already FIELD_DECLs on the list,
!      their offsets will not be disturbed.  */
    if (!eoc && *empty_p)
      {
        tree padding;
--- 5007,5016 ----
      }
  
    /* We make all structures have at least one element, so that they
!      have non-zero size.  The class may be empty even if it has
!      basetypes.  Therefore, we add the fake field after all the other
!      fields; if there are already FIELD_DECLs on the list, their
!      offsets will not be disturbed.  */
    if (!eoc && *empty_p)
      {
        tree padding;
*************** finish_struct_1 (t)
*** 5400,5408 ****
        = chainon (CLASSTYPE_VFIELDS (t), build_tree_list (NULL_TREE, t));
  
    /* If necessary, create the primary vtable for this class.  */
!   if (new_virtuals
!       || overridden_virtuals
!       || (TYPE_CONTAINS_VPTR_P (t) && vptrs_present_everywhere_p ()))
      {
        new_virtuals = nreverse (new_virtuals);
        /* We must enter these virtuals into the table.  */
--- 5169,5175 ----
        = chainon (CLASSTYPE_VFIELDS (t), build_tree_list (NULL_TREE, t));
  
    /* If necessary, create the primary vtable for this class.  */
!   if (new_virtuals || overridden_virtuals || TYPE_CONTAINS_VPTR_P (t))
      {
        new_virtuals = nreverse (new_virtuals);
        /* We must enter these virtuals into the table.  */
*************** note_name_declared_in_class (name, decl)
*** 6779,6788 ****
      }
  }
  
! /* Returns the VAR_DECL for the complete vtable associated with
!    BINFO.  (Under the new ABI, secondary vtables are merged with
!    primary vtables; this function will return the VAR_DECL for the
!    primary vtable.)  */
  
  tree
  get_vtbl_decl_for_binfo (binfo)
--- 6546,6554 ----
      }
  }
  
! /* Returns the VAR_DECL for the complete vtable associated with BINFO.
!    Secondary vtables are merged with primary vtables; this function
!    will return the VAR_DECL for the primary vtable.  */
  
  tree
  get_vtbl_decl_for_binfo (binfo)
*************** static void
*** 7130,7193 ****
  finish_vtbls (t)
       tree t;
  {
!   if (merge_primary_and_secondary_vtables_p ())
!     {
!       tree list;
!       tree vbase;
  
!       /* Under the new ABI, 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 (TYPE_BINFO_VTABLE (t), NULL_TREE);
!       accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t),
! 			     TYPE_BINFO (t), t, list);
!       /* Then come the virtual bases, also in inheritance graph
! 	 order.  */
!       for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
! 	{
! 	  tree real_base;
  	  
! 	  if (!TREE_VIA_VIRTUAL (vbase))
! 	    continue;
            
!           /* Although we walk in inheritance order, that might not get the
!              canonical base.  */
!           real_base = binfo_for_vbase (BINFO_TYPE (vbase), t);
            
! 	  accumulate_vtbl_inits (real_base, real_base,
! 	                         TYPE_BINFO (t), t, list);
! 	}
! 
!       if (TYPE_BINFO_VTABLE (t))
! 	initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
!     }
!   else
!     {
!       dfs_walk (TYPE_BINFO (t), dfs_finish_vtbls, 
! 		dfs_unmarked_real_bases_queue_p, t);
!       dfs_walk (TYPE_BINFO (t), dfs_unmark, 
! 		dfs_marked_real_bases_queue_p, t);
      }
- }
  
! /* Called from finish_vtbls via dfs_walk.  */
! 
! static tree
! dfs_finish_vtbls (binfo, data)
!      tree binfo;
!      void *data;
! {
!   tree t = (tree) data;
! 
!   if (BINFO_NEW_VTABLE_MARKED (binfo, t))
!     initialize_vtable (binfo, 
! 		       build_vtbl_initializer (binfo, binfo, t, 
! 					       TYPE_BINFO (t), NULL));
! 
!   SET_BINFO_MARKED (binfo);
! 
!   return NULL_TREE;
  }
  
  /* Initialize the vtable for BINFO with the INITS.  */
--- 6896,6929 ----
  finish_vtbls (t)
       tree t;
  {
!   tree list;
!   tree vbase;
  
!   /* 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 (TYPE_BINFO_VTABLE (t), NULL_TREE);
!   accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t),
! 			 TYPE_BINFO (t), t, list);
!   
!   /* Then come the virtual bases, also in inheritance graph order.  */
!   for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
!     {
!       tree real_base;
  	  
!       if (!TREE_VIA_VIRTUAL (vbase))
! 	continue;
            
!       /* Although we walk in inheritance order, that might not get the
!          canonical base.  */
!       real_base = binfo_for_vbase (BINFO_TYPE (vbase), t);
            
!       accumulate_vtbl_inits (real_base, real_base,
! 			     TYPE_BINFO (t), t, list);
      }
  
!   if (TYPE_BINFO_VTABLE (t))
!     initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
  }
  
  /* Initialize the vtable for BINFO with the INITS.  */
*************** accumulate_vtbl_inits (binfo, orig_binfo
*** 7666,7674 ****
      }
  }
  
! /* Called from accumulate_vtbl_inits when using the new ABI.
!    Accumulates the vtable initializers for all of the vtables into
!    TREE_VALUE (DATA).  Returns the initializers for the BINFO vtable.  */
  
  static tree
  dfs_accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, t, l)
--- 7402,7409 ----
      }
  }
  
! /* Called from accumulate_vtbl_inits.  Returns the initializers for
!    the BINFO vtable.  */
  
  static tree
  dfs_accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, t, l)
*************** build_vbase_offset_vtbl_entries (binfo, 
*** 7958,7968 ****
    tree vbase;
    tree t;
  
-   /* Under the old ABI, pointers to virtual bases are stored in each
-      object.  */
-   if (!vbase_offsets_in_vtable_p ())
-     return;
- 
    /* If there are no virtual baseclasses, then there is nothing to
       do.  */
    if (!TYPE_USES_VIRTUAL_BASECLASSES (BINFO_TYPE (binfo)))
--- 7693,7698 ----
*************** build_vcall_offset_vtbl_entries (binfo, 
*** 8039,8049 ****
       tree binfo;
       vtbl_init_data *vid;
  {
-   /* Under the old ABI, the adjustments to the `this' pointer were made
-      elsewhere.  */
-   if (!vcall_offsets_in_vtable_p ())
-     return;
- 
    /* We only need these entries if this base is a virtual base.  */
    if (!TREE_VIA_VIRTUAL (binfo))
      return;
--- 7769,7774 ----
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.627
diff -c -3 -p -r1.627 cp-tree.h
*** cp-tree.h	2001/07/19 04:27:15	1.627
--- cp-tree.h	2001/07/20 11:30:16
*************** Boston, MA 02111-1307, USA.  */
*** 133,143 ****
       The BV_FN is the declaration for the virtual function itself.
  
     BINFO_VTABLE
!      Sometimes this is a VAR_DECL.  Under the new ABI, it is instead
!      an expression with POINTER_TYPE pointing that gives the value
       to which the vptr should be initialized.  Use get_vtbl_decl_for_binfo
!      to extract the VAR_DECL for the complete vtable; that macro works
!      in both ABIs.
  
     DECL_ARGUMENTS
       For a VAR_DECL this is DECL_ANON_UNION_ELEMS.
--- 133,141 ----
       The BV_FN is the declaration for the virtual function itself.
  
     BINFO_VTABLE
!      This is an expression with POINTER_TYPE that gives the value
       to which the vptr should be initialized.  Use get_vtbl_decl_for_binfo
!      to extract the VAR_DECL for the complete vtable.
  
     DECL_ARGUMENTS
       For a VAR_DECL this is DECL_ANON_UNION_ELEMS.
*************** extern int flag_rtti;
*** 224,263 ****
  
  extern int flag_huge_objects;
  
- /* Nonzero if virtual base class offsets are stored in the virtual
-    function table.  Zero if, instead, a pointer to the virtual base is
-    stored in the object itself.  */
- #define vbase_offsets_in_vtable_p() (1)
- 
- /* Nonzero if displacements to the `this' pointer to use when calling
-    virtual functions in a virtual base class are present in the
-    vtable.  */
- #define vcall_offsets_in_vtable_p() (1)
- 
- /* Nonzero if a derived class that needs a vptr should always get one,
-    even if a non-primary base class already has one.  For example,
-    given:
- 
-      struct S { int i; virtual void f(); };
-      struct T : virtual public S {};
- 
-    one could either reuse the vptr in `S' for `T', or create a new
-    vptr for `T'.  If this flag is nonzero we choose the latter
-    alternative; otherwise, we choose the former.  */
- #define vptrs_present_everywhere_p() (1)
- 
- /* Nonzero if the vtable for a derived class should contain the
-    virtual functions from the primary base and all virtual functions
-    present in the class itself.  Zero if, instead, it should contain
-    only those virtual functions from the primary base together with
-    the functions declared in the derived class (but not in any base
-    class).  */
- #define all_overridden_vfuns_in_vtables_p() (1)
- 
- /* Nonzero if primary and secondary vtables are combined into a single
-    vtable.  */
- #define merge_primary_and_secondary_vtables_p() (1)
- 
  
  /* Language-dependent contents of an identifier.  */
  
--- 222,227 ----
*************** struct lang_decl
*** 2431,2438 ****
  /* Nonzero if this class has a virtual function table pointer.  */
  #define TYPE_CONTAINS_VPTR_P(NODE)		\
    (TYPE_POLYMORPHIC_P (NODE)			\
!    || (vbase_offsets_in_vtable_p ()		\
!        && TYPE_USES_VIRTUAL_BASECLASSES (NODE)))
  
  extern int flag_new_for_scope;
  
--- 2395,2401 ----
  /* Nonzero if this class has a virtual function table pointer.  */
  #define TYPE_CONTAINS_VPTR_P(NODE)		\
    (TYPE_POLYMORPHIC_P (NODE)			\
!    || TYPE_USES_VIRTUAL_BASECLASSES (NODE))
  
  extern int flag_new_for_scope;
  
*************** extern int flag_new_for_scope;
*** 2587,2653 ****
  
  /* A pointer-to-function member type looks like:
  
-    struct {
-      short __delta;
-      short __index;
-      union {
-        P __pfn;
-        short __delta2;
-      } __pfn_or_delta2;
-    };
- 
-    where P is a POINTER_TYPE to a METHOD_TYPE appropriate for the
-    pointer to member.  The fields are used as follows:
- 
-      If __INDEX is -1, then the function to call is non-virtual, and
-      is located at the address given by __PFN.
- 
-      If __INDEX is zero, then this a NULL pointer-to-member.
- 
-      Otherwise, the function to call is virtual.  Then, __DELTA2 gives
-      the offset from an instance of the object to the virtual function
-      table, and __INDEX - 1 is the index into the vtable to use to
-      find the function.
- 
-      The value to use for the THIS parameter is the address of the
-      object plus __DELTA.
- 
-    For example, given:
- 
-      struct B1 {
-        int i;
-      };
- 
-      struct B2 {
-        double d;
-        void f();
-      };
- 
-      struct S : public B1, B2 {};
- 
-    the pointer-to-member for `&S::f' looks like:
- 
-      { 4, -1, { &f__2B2 } };
- 
-    The `4' means that given an `S*' you have to add 4 bytes to get to
-    the address of the `B2*'.  Then, the -1 indicates that this is a
-    non-virtual function.  Of course, `&f__2B2' is the name of that
-    function.
- 
-    (Of course, the exact values may differ depending on the mangling
-    scheme, sizes of types, and such.).
- 
-    Under the new ABI, we do:
- 
       struct {
         __P __pfn;
         ptrdiff_t __delta;
       };
  
!    (We don't need DELTA2, because the vtable is always the first thing
!    in the object.)  If the function is virtual, then PFN is one plus
!    twice the index into the vtable; otherwise, it is just a pointer to
!    the function.
  
     Unfortunately, using the lowest bit of PFN doesn't work in
     architectures that don't impose alignment requirements on function
--- 2550,2564 ----
  
  /* A pointer-to-function member type looks like:
  
       struct {
         __P __pfn;
         ptrdiff_t __delta;
       };
  
!    (As the vtable is always the first thing in the object, we don't
!    need an offset to it.)  If the function is virtual, then PFN is one
!    plus twice the index into the vtable; otherwise, it is just a
!    pointer to the function.
  
     Unfortunately, using the lowest bit of PFN doesn't work in
     architectures that don't impose alignment requirements on function
*************** extern varray_type local_classes;
*** 3342,3356 ****
  
  #define EXCEPTION_CLEANUP_NAME	"exception cleanup"
  
- /* The name used as a prefix for VTTs.  When the new ABI mangling
-    scheme is implemented, this should be removed.  */
- 
- #define VTT_NAME_PREFIX "__vtt_"
- 
- /* The name used as a prefix for construction vtables.  */
- 
- #define CTOR_VTBL_NAME_PREFIX "__ctorvt_"
- 
  #define THIS_NAME_P(ID_NODE) (strcmp(IDENTIFIER_POINTER (ID_NODE), "this") == 0)
  
  #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
--- 3253,3258 ----
*************** extern tree lookup_fnfields			PARAMS ((t
*** 4165,4171 ****
  extern tree lookup_member			PARAMS ((tree, tree, int, int));
  extern int look_for_overrides			PARAMS ((tree, tree));
  extern void get_pure_virtuals		        PARAMS ((tree));
- extern tree init_vbase_pointers			PARAMS ((tree, tree));
  extern void get_vbase_types			PARAMS ((tree));
  extern void maybe_suppress_debug_info		PARAMS ((tree));
  extern void note_debug_info_needed		PARAMS ((tree));
--- 4067,4072 ----
Index: cp/cvt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/cvt.c,v
retrieving revision 1.100
diff -c -3 -p -r1.100 cvt.c
*** cvt.c	2001/07/05 15:39:36	1.100
--- cvt.c	2001/07/20 11:30:16
*************** cp_convert_to_pointer (type, expr, force
*** 259,266 ****
  	return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0);
  
        if (TYPE_PTRMEM_P (type))
! 	/* Under the new ABI, a NULL pointer-to-member is represented
! 	   by -1, not by zero.  */
  	expr = build_int_2 (-1, -1);
        else
  	expr = build_int_2 (0, 0);
--- 259,266 ----
  	return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0);
  
        if (TYPE_PTRMEM_P (type))
! 	/* A NULL pointer-to-member is represented by -1, not by
! 	   zero.  */
  	expr = build_int_2 (-1, -1);
        else
  	expr = build_int_2 (0, 0);
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.802
diff -c -3 -p -r1.802 decl.c
*** decl.c	2001/07/13 20:40:41	1.802
--- decl.c	2001/07/20 11:30:19
*************** Boston, MA 02111-1307, USA.  */
*** 48,55 ****
  extern int (*valid_lang_attribute) PARAMS ((tree, tree, tree, tree));
  
  #ifndef BOOL_TYPE_SIZE
! /* In the new ABI, `bool' has size and alignment `1', on all
!    platforms.  */
  #define BOOL_TYPE_SIZE CHAR_TYPE_SIZE
  #endif
  
--- 48,54 ----
  extern int (*valid_lang_attribute) PARAMS ((tree, tree, tree, tree));
  
  #ifndef BOOL_TYPE_SIZE
! /* `bool' has size and alignment `1', on all platforms.  */
  #define BOOL_TYPE_SIZE CHAR_TYPE_SIZE
  #endif
  
*************** check_special_function_return_type (sfk,
*** 9475,9481 ****
        if (type)
  	cp_error ("return type specification for constructor invalid");
  
-       /* In the new ABI constructors do not return a value.  */
        type = void_type_node;
        break;
  
--- 9474,9479 ----
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl2.c,v
retrieving revision 1.476
diff -c -3 -p -r1.476 decl2.c
*** decl2.c	2001/07/19 06:22:04	1.476
--- decl2.c	2001/07/20 11:30:20
*************** comdat_linkage (decl)
*** 2291,2302 ****
         address, and this will not hold when we emit multiple copies of
         the function.  However, there's little else we can do.  
  
!        Also, by default, the typeinfo implementation for the new ABI
!        assumes that there will be only one copy of the string used as
!        the name for each type.  Therefore, if weak symbols are
!        unavailable, the run-time library should perform a more
!        conservative check; it should perform a string comparison,
!        rather than an address comparison.  */
      TREE_PUBLIC (decl) = 0;
    else
      {
--- 2291,2302 ----
         address, and this will not hold when we emit multiple copies of
         the function.  However, there's little else we can do.  
  
!        Also, by default, the typeinfo implementation assumes that
!        there will be only one copy of the string used as the name for
!        each type.  Therefore, if weak symbols are unavailable, the
!        run-time library should perform a more conservative check; it
!        should perform a string comparison, rather than an address
!        comparison.  */
      TREE_PUBLIC (decl) = 0;
    else
      {
*************** get_guard (decl)
*** 2744,2751 ****
      {
        tree guard_type;
  
!       /* Under the new ABI, we use a type that is big enough to
! 	 contain a mutex as well as an integer counter.  */
        guard_type = long_long_integer_type_node;
        guard = build_decl (VAR_DECL, sname, guard_type);
        
--- 2744,2751 ----
      {
        tree guard_type;
  
!       /* We use a type that is big enough to contain a mutex as well
! 	 as an integer counter.  */
        guard_type = long_long_integer_type_node;
        guard = build_decl (VAR_DECL, sname, guard_type);
        
*************** static tree
*** 2772,2779 ****
  get_guard_bits (guard)
       tree guard;
  {
!   /* Under the new ABI, we only set the first byte of the guard,
!      in order to leave room for a mutex in the high-order bits.  */
    guard = build1 (ADDR_EXPR, 
  		  build_pointer_type (TREE_TYPE (guard)),
  		  guard);
--- 2772,2779 ----
  get_guard_bits (guard)
       tree guard;
  {
!   /* We only set the first byte of the guard, in order to leave room
!      for a mutex in the high-order bits.  */
    guard = build1 (ADDR_EXPR, 
  		  build_pointer_type (TREE_TYPE (guard)),
  		  guard);
Index: cp/init.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/init.c,v
retrieving revision 1.245
diff -c -3 -p -r1.245 init.c
*** init.c	2001/07/10 10:38:10	1.245
--- init.c	2001/07/20 11:30:20
*************** initialize_vtbl_ptrs (addr)
*** 175,183 ****
    list = build_tree_list (type, addr);
  
    /* Walk through the hierarchy, initializing the vptr in each base
!      class.  We do these in pre-order because under the new ABI we
!      can't find the virtual bases for a class until we've initialized
!      the vtbl for that class.  */
    dfs_walk_real (TYPE_BINFO (type), dfs_initialize_vtbl_ptrs, 
  		 NULL, dfs_unmarked_real_bases_queue_p, list);
    dfs_walk (TYPE_BINFO (type), dfs_unmark,
--- 175,183 ----
    list = build_tree_list (type, addr);
  
    /* Walk through the hierarchy, initializing the vptr in each base
!      class.  We do these in pre-order because can't find the virtual
!      bases for a class until we've initialized the vtbl for that
!      class.  */
    dfs_walk_real (TYPE_BINFO (type), dfs_initialize_vtbl_ptrs, 
  		 NULL, dfs_unmarked_real_bases_queue_p, list);
    dfs_walk (TYPE_BINFO (type), dfs_unmark,
*************** expand_virtual_init (binfo, decl)
*** 851,858 ****
    /* Compute the initializer for vptr.  */
    vtbl = build_vtbl_address (binfo);
  
!   /* Under the new ABI, we may get this vptr from a VTT, if this is a
!      subobject constructor or subobject destructor.  */
    vtt_index = BINFO_VPTR_INDEX (binfo);
    if (vtt_index)
      {
--- 851,858 ----
    /* Compute the initializer for vptr.  */
    vtbl = build_vtbl_address (binfo);
  
!   /* We may get this vptr from a VTT, if this is a subobject
!      constructor or subobject destructor.  */
    vtt_index = BINFO_VPTR_INDEX (binfo);
    if (vtt_index)
      {
*************** construct_virtual_bases (type, this_ref,
*** 951,972 ****
    /* If there are no virtual baseclasses, we shouldn't even be here.  */
    my_friendly_assert (TYPE_USES_VIRTUAL_BASECLASSES (type), 19990621);
  
-   /* First set the pointers in our object that tell us where to find
-      our virtual baseclasses.  */
-   if (!vbase_offsets_in_vtable_p ())
-     {
-       tree if_stmt;
-       tree result;
- 
-       if_stmt = begin_if_stmt ();
-       finish_if_stmt_cond (flag, if_stmt);
-       result = init_vbase_pointers (type, this_ptr);
-       if (result)
- 	finish_expr_stmt (build_compound_expr (result));
-       finish_then_clause (if_stmt);
-       finish_if_stmt ();
-     }
- 
    /* Now, run through the baseclasses, initializing each.  */ 
    for (vbases = CLASSTYPE_VBASECLASSES (type); vbases;
         vbases = TREE_CHAIN (vbases))
--- 951,956 ----
*************** build_java_class_ref (type)
*** 2213,2219 ****
        jclass_node = TREE_TYPE (jclass_node);
      }
  
!   /* Mangle the class$ field, new and old ABI */
    {
      tree field;
      for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
--- 2197,2203 ----
        jclass_node = TREE_TYPE (jclass_node);
      }
  
!   /* Mangle the class$ field */
    {
      tree field;
      for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
*************** get_cookie_size (type)
*** 2252,2259 ****
  {
    tree cookie_size;
  
!   /* Under the new ABI, we need to allocate an additional max
!      (sizeof (size_t), alignof (true_type)) bytes.  */
    tree sizetype_size;
    tree type_align;
    
--- 2236,2243 ----
  {
    tree cookie_size;
  
!   /* We need to allocate an additional max (sizeof (size_t), alignof
!      (true_type)) bytes.  */
    tree sizetype_size;
    tree type_align;
    
*************** build_new_1 (exp)
*** 2360,2368 ****
    if (!has_array || !TYPE_VEC_NEW_USES_COOKIE (true_type))
      use_cookie = 0;
    /* When using placement new, users may not realize that they need
!      the extra storage.  Under the old ABI, we don't allocate the
!      cookie whenever they use one placement argument of type `void
!      *'.  Under the new ABI, we require that the operator called be
       the global placement operator delete[].  */
    else if (placement && !TREE_CHAIN (placement) 
  	   && same_type_p (TREE_TYPE (TREE_VALUE (placement)),
--- 2344,2350 ----
    if (!has_array || !TYPE_VEC_NEW_USES_COOKIE (true_type))
      use_cookie = 0;
    /* When using placement new, users may not realize that they need
!      the extra storage.  We require that the operator called be
       the global placement operator delete[].  */
    else if (placement && !TREE_CHAIN (placement) 
  	   && same_type_p (TREE_TYPE (TREE_VALUE (placement)),
*************** build_new_1 (exp)
*** 2479,2487 ****
        tree cookie;
  
        /* Store the number of bytes allocated so that we can know how
! 	 many elements to destroy later.  Under the new ABI, we use
! 	 the last sizeof (size_t) bytes to store the number of
! 	 elements.  */
        cookie = build (MINUS_EXPR, build_pointer_type (sizetype),
  		      alloc_node, size_in_bytes (sizetype));
        cookie = build_indirect_ref (cookie, NULL);
--- 2461,2468 ----
        tree cookie;
  
        /* Store the number of bytes allocated so that we can know how
! 	 many elements to destroy later.  We use the last sizeof
! 	 (size_t) bytes to store the number of elements.  */
        cookie = build (MINUS_EXPR, build_pointer_type (sizetype),
  		      alloc_node, size_in_bytes (sizetype));
        cookie = build_indirect_ref (cookie, NULL);
Index: cp/lang-specs.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/lang-specs.h,v
retrieving revision 1.44
diff -c -3 -p -r1.44 lang-specs.h
*** lang-specs.h	2001/06/07 23:54:23	1.44
--- lang-specs.h	2001/07/20 11:30:20
*************** Boston, MA 02111-1307, USA.  */
*** 38,51 ****
      "%{E|M|MM:cpp0 -lang-c++ %{!no-gcc:-D__GNUG__=%v1}\
         %{!Wno-deprecated:-D__DEPRECATED}\
         %{!fno-exceptions:-D__EXCEPTIONS}\
!        %{!fno-new-abi:-D__GXX_ABI_VERSION=100}\
         %{ansi:-D__STRICT_ANSI__ -trigraphs -$} %(cpp_options)}\
       %{!E:%{!M:%{!MM:\
         %{save-temps:cpp0 -lang-c++ \
  		    %{!no-gcc:-D__GNUG__=%v1}\
         		    %{!Wno-deprecated:-D__DEPRECATED}\
  		    %{!fno-exceptions:-D__EXCEPTIONS}\
! 		    %{!fno-new-abi:-D__GXX_ABI_VERSION=100}\
  		    %{ansi:-D__STRICT_ANSI__ -trigraphs -$}\
  		    %(cpp_options) %b.ii \n}\
        cc1plus %{save-temps:-fpreprocessed %b.ii}\
--- 38,51 ----
      "%{E|M|MM:cpp0 -lang-c++ %{!no-gcc:-D__GNUG__=%v1}\
         %{!Wno-deprecated:-D__DEPRECATED}\
         %{!fno-exceptions:-D__EXCEPTIONS}\
!        -D__GXX_ABI_VERSION=100\
         %{ansi:-D__STRICT_ANSI__ -trigraphs -$} %(cpp_options)}\
       %{!E:%{!M:%{!MM:\
         %{save-temps:cpp0 -lang-c++ \
  		    %{!no-gcc:-D__GNUG__=%v1}\
         		    %{!Wno-deprecated:-D__DEPRECATED}\
  		    %{!fno-exceptions:-D__EXCEPTIONS}\
! 		    -D__GXX_ABI_VERSION=100\
  		    %{ansi:-D__STRICT_ANSI__ -trigraphs -$}\
  		    %(cpp_options) %b.ii \n}\
        cc1plus %{save-temps:-fpreprocessed %b.ii}\
*************** Boston, MA 02111-1307, USA.  */
*** 53,59 ****
  			    %{!no-gcc:-D__GNUG__=%v1} \
         			    %{!Wno-deprecated:-D__DEPRECATED}\
  			    %{!fno-exceptions:-D__EXCEPTIONS}\
! 			    %{!fno-new-abi:-D__GXX_ABI_VERSION=100}\
  			    %{ansi:-D__STRICT_ANSI__}}\
         %{ansi:-trigraphs -$}\
         %(cc1_options) %2 %{+e1*}\
--- 53,59 ----
  			    %{!no-gcc:-D__GNUG__=%v1} \
         			    %{!Wno-deprecated:-D__DEPRECATED}\
  			    %{!fno-exceptions:-D__EXCEPTIONS}\
! 			    -D__GXX_ABI_VERSION=100\
  			    %{ansi:-D__STRICT_ANSI__}}\
         %{ansi:-trigraphs -$}\
         %(cc1_options) %2 %{+e1*}\
Index: cp/mangle.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/mangle.c,v
retrieving revision 1.34
diff -c -3 -p -r1.34 mangle.c
*** mangle.c	2001/04/26 08:34:06	1.34
--- mangle.c	2001/07/20 11:30:21
***************
*** 1,4 ****
! /* Name mangling for the new standard C++ ABI.
     Copyright (C) 2000, 2001 Free Software Foundation, Inc.
     Written by Alex Samuel <sameul@codesourcery.com>
  
--- 1,4 ----
! /* Name mangling for the 3.0 C++ ABI.
     Copyright (C) 2000, 2001 Free Software Foundation, Inc.
     Written by Alex Samuel <sameul@codesourcery.com>
  
*************** write_special_name_constructor (ctor)
*** 1195,1204 ****
       <special-name> ::= D0 # deleting (in-charge) destructor
                      ::= D1 # complete object (in-charge) destructor
                      ::= D2 # base object (not-in-charge) destructor 
! 
!    We also need to provide unique mngled names for old-ABI
!    destructors, sometimes.  These should only be used internally.  We
!    use "D*INTERNAL*" for these.  */
  
  static void
  write_special_name_destructor (dtor)
--- 1195,1201 ----
       <special-name> ::= D0 # deleting (in-charge) destructor
                      ::= D1 # complete object (in-charge) destructor
                      ::= D2 # base object (not-in-charge) destructor 
!   */
  
  static void
  write_special_name_destructor (dtor)
Index: cp/rtti.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/rtti.c,v
retrieving revision 1.115
diff -c -3 -p -r1.115 rtti.c
*** rtti.c	2001/05/22 19:41:55	1.115
--- rtti.c	2001/07/20 11:30:21
*************** build_headof (exp)
*** 130,137 ****
    /* We use this a couple of times below, protect it.  */
    exp = save_expr (exp);
  
!   /* Under the new ABI, the offset-to-top field is at index -2 from
!      the vptr.  */
    index = build_int_2 (-2, -1);
  
    aref = build_vtbl_ref (build_indirect_ref (exp, NULL), index);
--- 130,136 ----
    /* We use this a couple of times below, protect it.  */
    exp = save_expr (exp);
  
!   /* The offset-to-top field is at index -2 from the vptr.  */
    index = build_int_2 (-2, -1);
  
    aref = build_vtbl_ref (build_indirect_ref (exp, NULL), index);
*************** get_base_offset (binfo, parent)
*** 452,487 ****
  {
    if (! TREE_VIA_VIRTUAL (binfo))
      return BINFO_OFFSET (binfo);
-   else if (! vbase_offsets_in_vtable_p ())
-     {
-       const char *name;
-       tree result;
-       tree field;
-     
-       FORMAT_VBASE_NAME (name, BINFO_TYPE (binfo));
-       field = lookup_field (parent, get_identifier (name), 0, 0);
-       result = byte_position (field);
-       
-       if (DECL_CONTEXT (field) != parent)
-         {
-           /* The vbase pointer might be in a non-virtual base of PARENT.
-            * Adjust for the offset of that base in PARENT.  */
-           tree path;
-           
-           get_base_distance (DECL_CONTEXT (field), parent, -1, &path);
-           result = build (PLUS_EXPR, TREE_TYPE (result),
-                           result, BINFO_OFFSET (path));
-           result = fold (result);
-         }
-       return result;
-     }
    else
!     /* Under the new ABI, we store the vtable offset at which
!        the virtual base offset can be found.  */
      return convert (sizetype,
  		    BINFO_VPTR_FIELD (binfo_for_vbase (BINFO_TYPE (binfo),
  						       parent)));
- 
  }
  
  /* Execute a dynamic cast, as described in section 5.2.6 of the 9/93 working
--- 451,462 ----
  {
    if (! TREE_VIA_VIRTUAL (binfo))
      return BINFO_OFFSET (binfo);
    else
!     /* We store the vtable offset at which the virtual base offset can
!        be found.  */
      return convert (sizetype,
  		    BINFO_VPTR_FIELD (binfo_for_vbase (BINFO_TYPE (binfo),
  						       parent)));
  }
  
  /* Execute a dynamic cast, as described in section 5.2.6 of the 9/93 working
*************** tinfo_base_init (desc, target)
*** 833,840 ****
      DECL_EXTERNAL (name_decl) = 0;
      TREE_PUBLIC (name_decl) = 1;
      comdat_linkage (name_decl);
!     /* The new ABI specifies the external name of the string
!        containing the type's name.  */
      SET_DECL_ASSEMBLER_NAME (name_decl,
  			     mangle_typeinfo_string_for_type (target));
      DECL_INITIAL (name_decl) = name_string;
--- 808,815 ----
      DECL_EXTERNAL (name_decl) = 0;
      TREE_PUBLIC (name_decl) = 1;
      comdat_linkage (name_decl);
!     /* External name of the string containing the type's name has a
!        special name.  */
      SET_DECL_ASSEMBLER_NAME (name_decl,
  			     mangle_typeinfo_string_for_type (target));
      DECL_INITIAL (name_decl) = name_string;
*************** create_pseudo_type_info VPARAMS((const c
*** 1295,1302 ****
    vtable_decl = get_vtable_decl (real_type, /*complete=*/1);
    vtable_decl = build_unary_op (ADDR_EXPR, vtable_decl, 0);
  
!   /* Under the new ABI, we need to point into the middle of the
!      vtable.  */
    vtable_decl = build (PLUS_EXPR,
  		       TREE_TYPE (vtable_decl),
  		       vtable_decl,
--- 1270,1276 ----
    vtable_decl = get_vtable_decl (real_type, /*complete=*/1);
    vtable_decl = build_unary_op (ADDR_EXPR, vtable_decl, 0);
  
!   /* We need to point into the middle of the vtable.  */
    vtable_decl = build (PLUS_EXPR,
  		       TREE_TYPE (vtable_decl),
  		       vtable_decl,
Index: cp/search.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/search.c,v
retrieving revision 1.210
diff -c -3 -p -r1.210 search.c
*** search.c	2001/06/06 21:52:52	1.210
--- search.c	2001/07/20 11:30:22
*************** static tree marked_pushdecls_p PARAMS ((
*** 102,108 ****
  static tree unmarked_pushdecls_p PARAMS ((tree, void *));
  static tree dfs_debug_unmarkedp PARAMS ((tree, void *));
  static tree dfs_debug_mark PARAMS ((tree, void *));
- static tree dfs_init_vbase_pointers PARAMS ((tree, void *));
  static tree dfs_get_vbase_types PARAMS ((tree, void *));
  static tree dfs_push_type_decls PARAMS ((tree, void *));
  static tree dfs_push_decls PARAMS ((tree, void *));
--- 102,107 ----
*************** static tree get_shared_vbase_if_not_prim
*** 140,146 ****
  static tree dfs_find_vbase_instance PARAMS ((tree, void *));
  static tree dfs_get_pure_virtuals PARAMS ((tree, void *));
  static tree dfs_build_inheritance_graph_order PARAMS ((tree, void *));
- static tree dfs_vtable_path_unmark PARAMS ((tree, void *));
  
  /* Allocate a level of searching.  */
  
--- 139,144 ----
*************** dfs_unmark (binfo, data) 
*** 2335,2442 ****
  }
  
  
- static tree
- dfs_init_vbase_pointers (binfo, data)
-      tree binfo;
-      void *data;
- {
-   struct vbase_info *vi = (struct vbase_info *) data;
-   tree type = BINFO_TYPE (binfo);
-   tree fields;
-   tree this_vbase_ptr;
- 
-   /* Don't initialize the same base more than once.  */
-   SET_BINFO_VTABLE_PATH_MARKED (binfo);
- 
-   /* We know that VI->DECL_PTR points to the complete object.  So,
-      finding a pointer to this subobject is easy.  */
-   this_vbase_ptr = build (PLUS_EXPR,
- 			  build_pointer_type (type),
- 			  vi->decl_ptr,
- 			  BINFO_OFFSET (binfo));
- 
-   /* We're going to iterate through all the pointers to virtual
-      base-classes.  They come at the beginning of the class.  */
-   fields = TYPE_FIELDS (type);
- 
-   if (fields == NULL_TREE
-       || DECL_NAME (fields) == NULL_TREE
-       || ! VBASE_NAME_P (DECL_NAME (fields)))
-     return NULL_TREE;
- 
-   if (build_pointer_type (type) 
-       != TYPE_MAIN_VARIANT (TREE_TYPE (this_vbase_ptr)))
-     my_friendly_abort (125);
- 
-   while (fields && DECL_NAME (fields) && VBASE_NAME_P (DECL_NAME (fields)))
-     {
-       tree ref = build (COMPONENT_REF, TREE_TYPE (fields),
- 			build_indirect_ref (this_vbase_ptr, NULL), fields);
-       tree init;
-       tree vbase_type;
-       tree vbase_binfo;
- 
-       vbase_type = TREE_TYPE (TREE_TYPE (fields));
-       vbase_binfo = binfo_for_vbase (vbase_type, vi->type);
-       init = build (PLUS_EXPR, 
- 		    build_pointer_type (vbase_type),
- 		    vi->decl_ptr,
- 		    BINFO_OFFSET (vbase_binfo));
-       vi->inits 
- 	= tree_cons (vbase_binfo,
- 		     build_modify_expr (ref, NOP_EXPR, init),
- 		     vi->inits);
-       fields = TREE_CHAIN (fields);
-     }
-   
-   return NULL_TREE;
- }
- 
- /* Call CLEAR_BINFO_VTABLE_PATH_MARKED for BINFO.  */
- 
- static tree
- dfs_vtable_path_unmark (binfo, data)
-      tree binfo;
-      void *data ATTRIBUTE_UNUSED;
- {
-   CLEAR_BINFO_VTABLE_PATH_MARKED (binfo);
-   return NULL_TREE;
- }
- 
- tree
- init_vbase_pointers (type, decl_ptr)
-      tree type;
-      tree decl_ptr;
- {
-   my_friendly_assert (!vbase_offsets_in_vtable_p (), 20000516);
- 
-   if (TYPE_USES_VIRTUAL_BASECLASSES (type))
-     {
-       struct vbase_info vi;
-       tree binfo = TYPE_BINFO (type);
- 
-       /* Find all the virtual base classes, marking them for later
- 	 initialization.  */
-       vi.type = type;
-       vi.decl_ptr = decl_ptr;
-       vi.inits = NULL_TREE;
- 
-       /* Build up a list of the initializers.  */
-       dfs_walk_real (binfo, 
- 		     dfs_init_vbase_pointers, 0,
- 		     unmarked_vtable_pathp,
- 		     &vi);
-       dfs_walk (binfo,
- 		dfs_vtable_path_unmark,
- 		marked_vtable_pathp,
- 		NULL);
- 
-       return vi.inits;
-     }
- 
-   return 0;
- }
- 
  /* get the virtual context (the vbase that directly contains the
     DECL_CONTEXT of the FNDECL) that the given FNDECL is declared in,
     or NULL_TREE if there is none.
--- 2333,2338 ----
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/semantics.c,v
retrieving revision 1.219
diff -c -3 -p -r1.219 semantics.c
*** semantics.c	2001/07/19 06:22:04	1.219
--- semantics.c	2001/07/20 11:30:22
*************** emit_associated_thunks (fn)
*** 2337,2343 ****
       is so that you can know statically the entire set of thunks that
       will ever be needed for a given virtual function, thereby
       enabling you to output all the thunks with the function itself.  */
!   if (vcall_offsets_in_vtable_p () && DECL_VIRTUAL_P (fn))
      {
        tree binfo;
        tree v;
--- 2337,2343 ----
       is so that you can know statically the entire set of thunks that
       will ever be needed for a given virtual function, thereby
       enabling you to output all the thunks with the function itself.  */
!   if (DECL_VIRTUAL_P (fn))
      {
        tree binfo;
        tree v;
*************** expand_body (fn)
*** 2403,2410 ****
  				simplify_aggr_init_exprs_r,
  				NULL);
  
!   /* If this is a constructor or destructor body, we have to clone it
!      under the new ABI.  */
    if (maybe_clone_body (fn))
      {
        /* We don't want to process FN again, so pretend we've written
--- 2403,2410 ----
  				simplify_aggr_init_exprs_r,
  				NULL);
  
!   /* If this is a constructor or destructor body, we have to clone
!      it.  */
    if (maybe_clone_body (fn))
      {
        /* We don't want to process FN again, so pretend we've written
Index: cp/typeck.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/typeck.c,v
retrieving revision 1.357
diff -c -3 -p -r1.357 typeck.c
*** typeck.c	2001/07/09 23:46:06	1.357
--- typeck.c	2001/07/20 11:30:24
*************** build_ptrmemfunc (type, pfn, force)
*** 6105,6112 ****
  	  delta = build_component_ref (pfn, delta_identifier, NULL_TREE, 0);
  	}
  
!       /* Under the new ABI, the conversion is easy.  Just adjust
! 	 the DELTA field.  */
        delta = cp_convert (ptrdiff_type_node, delta);
        if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta)
  	n = cp_build_binary_op (LSHIFT_EXPR, n, integer_one_node);
--- 6105,6111 ----
  	  delta = build_component_ref (pfn, delta_identifier, NULL_TREE, 0);
  	}
  
!       /* Just adjust the DELTA field.  */
        delta = cp_convert (ptrdiff_type_node, delta);
        if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta)
  	n = cp_build_binary_op (LSHIFT_EXPR, n, integer_one_node);
*************** expand_ptrmemfunc_cst (cst, delta, pfn)
*** 6171,6180 ****
        *delta = fold (build (PLUS_EXPR, TREE_TYPE (*delta),
  			    *delta, BINFO_OFFSET (binfo)));
  
!       /* Under the new ABI, we set PFN to the vtable offset at
! 	 which the function can be found, plus one (unless
! 	 ptrmemfunc_vbit_in_delta, in which case delta is shifted
! 	 left, and then incremented).  */
        *pfn = DECL_VINDEX (fn);
        *pfn = fold (build (MULT_EXPR, integer_type_node, *pfn,
  			  TYPE_SIZE_UNIT (vtable_entry_type)));
--- 6170,6178 ----
        *delta = fold (build (PLUS_EXPR, TREE_TYPE (*delta),
  			    *delta, BINFO_OFFSET (binfo)));
  
!       /* We set PFN to the vtable offset at which the function can be
! 	 found, plus one (unless ptrmemfunc_vbit_in_delta, in which
! 	 case delta is shifted left, and then incremented).  */
        *pfn = DECL_VINDEX (fn);
        *pfn = fold (build (MULT_EXPR, integer_type_node, *pfn,
  			  TYPE_SIZE_UNIT (vtable_entry_type)));

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