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: new-abi rtti prepatch 1


Hi,
I've installed the attached appoved patch, which
* defines/renames some rtti global tree nodes
* adjustments in rtti.c for said name changes
* breaking out of some rtti helper functions from expand_*_desc
* minor correction to use of __GXX_ABI_VERSION

nathan
-- 
Dr Nathan Sidwell :: sidwell@codesourcery.com
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk
2000-01-22  Nathan Sidwell  <sidwell@codesourcery.com>

	* cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
	CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
	CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
	(CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
	CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
	CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
	(CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
	(CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
	(CPTI_TINFO_VAR_ID): New enumeration.
	(__tp_desc_type_node, __access_mode_type_node,
	__bltn_desc_type_node, __user_desc_type_node,
	__class_desc_type_node, __ptr_desc_type_node,
	__attr_desc_type_node, __func_desc_type_node,
	__ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
	(ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
	ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
	enum_desc_type_node, class_desc_type_node,
	si_class_desc_type_node, vmi_class_desc_type_node,
	ptmd_desc_type_node, base_desc_type_node): New #defines.
	(tinfo_fn_id, tinfo_fn_type): Rename to ...
	(tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
	(tinfo_var_id): New enumeration.
	(DECL_TINFO_FN_P): Augment comment.
	* decl.c (cp_global_trees): Adjust documentation.
	* rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
	tinfo_decl_type and tinfo_var_id.
	(get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
	(build_typeid): Remove unused variable.
	(get_tinfo_var): Use tinfo_var_id.
	(tinfo_name): New static function.
	(get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
	(tinfo_from_decl): Likewise.
	(get_base_offset): New static function, broken out of
	expand_class_desc.
	(expand_si_desc): Use tinfo_name.
	(expand_class_desc): Likewise. Lose local static variable.
	Use base_desc_type_node. Use get_base_offset.
	(expand_ptr_desc): Use tinfo_name.
	(expand_attr_desc): Likewise.
	(expand_generic_desc): Likewise.
	
	* tinfo.cc (__GXX_ABI_VERSION): Test value, not existance.
	* tinfo.h (__GXX_ABI_VERSION): Test value, not existance.

Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.388
diff -c -3 -p -r1.388 cp-tree.h
*** cp-tree.h	2000/01/18 10:23:31	1.388
--- cp-tree.h	2000/01/22 12:02:41
*************** enum cp_tree_index
*** 496,511 ****
      CPTI_DELTA_TYPE,
      CPTI_CLEANUP_TYPE,
  
!     CPTI_TP_DESC_TYPE,
!     CPTI_ACCESS_MODE_TYPE,
      CPTI_BLTN_DESC_TYPE,
-     CPTI_USER_DESC_TYPE,
-     CPTI_CLASS_DESC_TYPE,
      CPTI_PTR_DESC_TYPE,
!     CPTI_ATTR_DESC_TYPE,
      CPTI_FUNC_DESC_TYPE,
!     CPTI_PTMF_DESC_TYPE,
      CPTI_PTMD_DESC_TYPE,
      
      CPTI_CLASS_STAR_TYPE,
      CPTI_CLASS_TYPE,
--- 496,513 ----
      CPTI_DELTA_TYPE,
      CPTI_CLEANUP_TYPE,
  
!     CPTI_TI_DESC_TYPE,
      CPTI_BLTN_DESC_TYPE,
      CPTI_PTR_DESC_TYPE,
!     CPTI_REF_DESC_TYPE,
!     CPTI_ARY_DESC_TYPE,
      CPTI_FUNC_DESC_TYPE,
!     CPTI_ENUM_DESC_TYPE,
!     CPTI_CLASS_DESC_TYPE,
!     CPTI_SI_CLASS_DESC_TYPE,
!     CPTI_VMI_CLASS_DESC_TYPE,
      CPTI_PTMD_DESC_TYPE,
+     CPTI_BASE_DESC_TYPE,
      
      CPTI_CLASS_STAR_TYPE,
      CPTI_CLASS_TYPE,
*************** enum cp_tree_index
*** 517,524 ****
      CPTI_VTBL_PTR_TYPE,
      CPTI_STD,
      CPTI_TYPE_INFO_TYPE,
!     CPTI_TINFO_FN_ID,
!     CPTI_TINFO_FN_TYPE,
      CPTI_ABORT_FNDECL,
      CPTI_GLOBAL_DELETE_FNDECL,
  
--- 519,527 ----
      CPTI_VTBL_PTR_TYPE,
      CPTI_STD,
      CPTI_TYPE_INFO_TYPE,
!     CPTI_TINFO_DECL_ID,
!     CPTI_TINFO_DECL_TYPE,
!     CPTI_TINFO_VAR_ID,
      CPTI_ABORT_FNDECL,
      CPTI_GLOBAL_DELETE_FNDECL,
  
*************** extern tree cp_global_trees[CPTI_MAX];
*** 573,588 ****
  #define wchar_decl_node			cp_global_trees[CPTI_WCHAR_DECL]
  #define vtable_entry_type		cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
  #define delta_type_node			cp_global_trees[CPTI_DELTA_TYPE]
! #define __tp_desc_type_node		cp_global_trees[CPTI_TP_DESC_TYPE]
! #define __access_mode_type_node		cp_global_trees[CPTI_ACCESS_MODE_TYPE]
! #define __bltn_desc_type_node		cp_global_trees[CPTI_BLTN_DESC_TYPE]
! #define __user_desc_type_node		cp_global_trees[CPTI_USER_DESC_TYPE]
! #define __class_desc_type_node		cp_global_trees[CPTI_CLASS_DESC_TYPE]
! #define __ptr_desc_type_node		cp_global_trees[CPTI_PTR_DESC_TYPE]
! #define __attr_desc_type_node		cp_global_trees[CPTI_ATTR_DESC_TYPE]
! #define __func_desc_type_node		cp_global_trees[CPTI_FUNC_DESC_TYPE]
! #define __ptmf_desc_type_node		cp_global_trees[CPTI_PTMF_DESC_TYPE]
! #define __ptmd_desc_type_node		cp_global_trees[CPTI_PTMD_DESC_TYPE]
  #define class_star_type_node		cp_global_trees[CPTI_CLASS_STAR_TYPE]
  #define class_type_node			cp_global_trees[CPTI_CLASS_TYPE]
  #define record_type_node		cp_global_trees[CPTI_RECORD_TYPE]
--- 576,595 ----
  #define wchar_decl_node			cp_global_trees[CPTI_WCHAR_DECL]
  #define vtable_entry_type		cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
  #define delta_type_node			cp_global_trees[CPTI_DELTA_TYPE]
! 
! #define ti_desc_type_node		cp_global_trees[CPTI_TI_DESC_TYPE]
! #define bltn_desc_type_node		cp_global_trees[CPTI_BLTN_DESC_TYPE]
! #define ptr_desc_type_node		cp_global_trees[CPTI_PTR_DESC_TYPE]
! #define ref_desc_type_node		cp_global_trees[CPTI_REF_DESC_TYPE]
! #define ary_desc_type_node		cp_global_trees[CPTI_ARY_DESC_TYPE]
! #define func_desc_type_node		cp_global_trees[CPTI_FUNC_DESC_TYPE]
! #define enum_desc_type_node		cp_global_trees[CPTI_ENUM_DESC_TYPE]
! #define class_desc_type_node		cp_global_trees[CPTI_CLASS_DESC_TYPE]
! #define si_class_desc_type_node		cp_global_trees[CPTI_SI_CLASS_DESC_TYPE]
! #define vmi_class_desc_type_node	cp_global_trees[CPTI_VMI_CLASS_DESC_TYPE]
! #define ptmd_desc_type_node		cp_global_trees[CPTI_PTMD_DESC_TYPE]
! #define base_desc_type_node		cp_global_trees[CPTI_BASE_DESC_TYPE]
! 
  #define class_star_type_node		cp_global_trees[CPTI_CLASS_STAR_TYPE]
  #define class_type_node			cp_global_trees[CPTI_CLASS_TYPE]
  #define record_type_node		cp_global_trees[CPTI_RECORD_TYPE]
*************** extern tree cp_global_trees[CPTI_MAX];
*** 593,600 ****
  #define vtbl_ptr_type_node		cp_global_trees[CPTI_VTBL_PTR_TYPE]
  #define std_node			cp_global_trees[CPTI_STD]
  #define type_info_type_node		cp_global_trees[CPTI_TYPE_INFO_TYPE]
! #define tinfo_fn_id			cp_global_trees[CPTI_TINFO_FN_ID]
! #define tinfo_fn_type			cp_global_trees[CPTI_TINFO_FN_TYPE]
  #define abort_fndecl			cp_global_trees[CPTI_ABORT_FNDECL]
  #define global_delete_fndecl		cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
  
--- 600,608 ----
  #define vtbl_ptr_type_node		cp_global_trees[CPTI_VTBL_PTR_TYPE]
  #define std_node			cp_global_trees[CPTI_STD]
  #define type_info_type_node		cp_global_trees[CPTI_TYPE_INFO_TYPE]
! #define tinfo_decl_id			cp_global_trees[CPTI_TINFO_DECL_ID]
! #define tinfo_decl_type			cp_global_trees[CPTI_TINFO_DECL_TYPE]
! #define tinfo_var_id                    cp_global_trees[CPTI_TINFO_VAR_ID]
  #define abort_fndecl			cp_global_trees[CPTI_ABORT_FNDECL]
  #define global_delete_fndecl		cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
  
*************** struct lang_decl
*** 1830,1836 ****
     for an object with virtual baseclasses.  */
  #define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
  
! /* Non-zero for a FUNCTION_DECL that declares a type-info function.  */
  #define DECL_TINFO_FN_P(NODE) 					\
    (TREE_CODE (NODE) == FUNCTION_DECL				\
     && DECL_ARTIFICIAL (NODE)					\
--- 1838,1845 ----
     for an object with virtual baseclasses.  */
  #define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
  
! /* Non-zero for a FUNCTION_DECL that declares a type-info function.
!    This only happens in the old abi.  */
  #define DECL_TINFO_FN_P(NODE) 					\
    (TREE_CODE (NODE) == FUNCTION_DECL				\
     && DECL_ARTIFICIAL (NODE)					\
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.534
diff -c -3 -p -r1.534 decl.c
*** decl.c	2000/01/17 20:18:39	1.534
--- decl.c	2000/01/22 12:02:44
*************** tree error_mark_list;
*** 209,218 ****
  #if 0
  	tree __tp_desc_type_node;
  #endif
! 	tree __access_mode_type_node;
! 	tree __bltn_desc_type_node, __user_desc_type_node, __class_desc_type_node;
! 	tree __ptr_desc_type_node, __attr_desc_type_node, __func_desc_type_node;
! 	tree __ptmf_desc_type_node, __ptmd_desc_type_node;
  #if 0
     Not needed yet?  May be needed one day?
  	tree __bltn_desc_array_type, __user_desc_array_type, __class_desc_array_type;
--- 209,220 ----
  #if 0
  	tree __tp_desc_type_node;
  #endif
!         tree ti_desc_type_node;
! 	tree bltn_desc_type_node, ptr_desc_type_node, ref_desc_type_node;
! 	tree ary_desc_type_node, func_desc_type_node, enum_desc_type_node;
! 	tree class_desc_type_node, si_class_desc_type_node, vmi_class_desc_type_node;
! 	tree ptmd_desc_type_node;
! 	tree base_desc_type_node;
  #if 0
     Not needed yet?  May be needed one day?
  	tree __bltn_desc_array_type, __user_desc_array_type, __class_desc_array_type;
*************** tree error_mark_list;
*** 244,250 ****
  	tree global_delete_fndecl;
  
     Used by RTTI
! 	tree type_info_type_node, tinfo_fn_id, tinfo_fn_type;
  
  */
  
--- 246,253 ----
  	tree global_delete_fndecl;
  
     Used by RTTI
! 	tree type_info_type_node, tinfo_decl_id, tinfo_decl_type;
! 	tree tinfo_var_id;
  
  */
  
Index: cp/rtti.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/rtti.c,v
retrieving revision 1.55
diff -c -3 -p -r1.55 rtti.c
*** rtti.c	2000/01/18 10:23:31	1.55
--- rtti.c	2000/01/22 12:02:45
*************** static tree build_headof_sub PROTO((tree
*** 40,45 ****
--- 40,47 ----
  static tree build_headof PROTO((tree));
  static tree get_tinfo_var PROTO((tree));
  static tree ifnonnull PROTO((tree, tree));
+ static tree tinfo_name PROTO((tree));
+ static tree get_base_offset PROTO((tree, tree));
  static tree build_dynamic_cast_1 PROTO((tree, tree));
  static void expand_si_desc PROTO((tree, tree));
  static void expand_class_desc PROTO((tree, tree));
*************** init_rtti_processing ()
*** 60,70 ****
      (class_type_node, get_identifier ("type_info"), 1);
    if (flag_honor_std)
      pop_namespace ();
!   tinfo_fn_id = get_identifier ("__tf");
!   tinfo_fn_type = build_function_type
!     (build_reference_type (build_qualified_type (type_info_type_node, 
! 						 TYPE_QUAL_CONST)),
!      void_list_node);
  }
  
  /* Given a pointer to an object with at least one virtual table
--- 62,75 ----
      (class_type_node, get_identifier ("type_info"), 1);
    if (flag_honor_std)
      pop_namespace ();
! 
!   tinfo_decl_id = get_identifier ("__tf");
!   tinfo_decl_type = build_function_type
!         (build_reference_type
!           (build_qualified_type
!             (type_info_type_node, TYPE_QUAL_CONST)),
!          void_list_node);
!   tinfo_var_id = get_identifier ("__ti");
  }
  
  /* Given a pointer to an object with at least one virtual table
*************** get_tinfo_decl_dynamic (exp)
*** 224,230 ****
  	t = build_vfn_ref ((tree *) 0, exp, integer_one_node);
        else
  	t = build_vfn_ref ((tree *) 0, exp, integer_zero_node);
!       TREE_TYPE (t) = build_pointer_type (tinfo_fn_type);
        return t;
      }
  
--- 229,235 ----
  	t = build_vfn_ref ((tree *) 0, exp, integer_one_node);
        else
  	t = build_vfn_ref ((tree *) 0, exp, integer_zero_node);
!       TREE_TYPE (t) = build_pointer_type (tinfo_decl_type);
        return t;
      }
  
*************** build_typeid (exp)
*** 238,244 ****
       tree exp;
  {
    tree cond = NULL_TREE;
-   tree type;
    int nonnull = 0;
  
    if (! flag_rtti)
--- 243,248 ----
*************** static tree
*** 287,293 ****
  get_tinfo_var (type)
       tree type;
  {
!   tree tname = build_overload_with_type (get_identifier ("__ti"), type);
    tree arrtype;
    int size;
  
--- 291,297 ----
  get_tinfo_var (type)
       tree type;
  {
!   tree tname = build_overload_with_type (tinfo_var_id, type);
    tree arrtype;
    int size;
  
*************** get_tinfo_var (type)
*** 325,335 ****
    return declare_global_var (tname, arrtype);
  }
  
  /* Returns a decl for a function or variable which can be used to obtain a
     type_info object for TYPE.  The old-abi uses functions, the new-abi will
     use the type_info object directly.  You can take the address of the
!    returned decl, to save the decl.  To use the generator call
!    tinfo_from_generator.  You must arrange that the decl is mark_used, if
     actually use it --- decls in vtables are only used if the vtable is
     output.  */
  
--- 329,349 ----
    return declare_global_var (tname, arrtype);
  }
  
+ /* Generate the NTBS name of a type.  */
+ static tree
+ tinfo_name (type)
+      tree type;
+ {
+   const char *name = build_overload_name (type, 1, 1);
+   tree name_string = combine_strings (build_string (strlen (name) + 1, name));
+   return name_string;
+ }
+ 
  /* Returns a decl for a function or variable which can be used to obtain a
     type_info object for TYPE.  The old-abi uses functions, the new-abi will
     use the type_info object directly.  You can take the address of the
!    returned decl, to save the decl.  To use the decl call
!    tinfo_from_decl.  You must arrange that the decl is mark_used, if
     actually use it --- decls in vtables are only used if the vtable is
     output.  */
  
*************** get_tinfo_decl (type)
*** 346,357 ****
      type = build_function_type (TREE_TYPE (type),
  				TREE_CHAIN (TYPE_ARG_TYPES (type)));
  
!   name = build_overload_with_type (tinfo_fn_id, type);
  
    if (IDENTIFIER_GLOBAL_VALUE (name))
      return IDENTIFIER_GLOBAL_VALUE (name);
  
!   d = build_lang_decl (FUNCTION_DECL, name, tinfo_fn_type);
    DECL_EXTERNAL (d) = 1;
    TREE_PUBLIC (d) = 1;
    DECL_ARTIFICIAL (d) = 1;
--- 360,371 ----
      type = build_function_type (TREE_TYPE (type),
  				TREE_CHAIN (TYPE_ARG_TYPES (type)));
  
!   name = build_overload_with_type (tinfo_decl_id, type);
  
    if (IDENTIFIER_GLOBAL_VALUE (name))
      return IDENTIFIER_GLOBAL_VALUE (name);
  
!   d = build_lang_decl (FUNCTION_DECL, name, tinfo_decl_type);
    DECL_EXTERNAL (d) = 1;
    TREE_PUBLIC (d) = 1;
    DECL_ARTIFICIAL (d) = 1;
*************** static tree
*** 373,379 ****
  tinfo_from_decl (expr)
       tree expr;
  {
!   tree t = build_call (expr, TREE_TYPE (tinfo_fn_type), NULL_TREE);
    
    return t;
  }
--- 387,393 ----
  tinfo_from_decl (expr)
       tree expr;
  {
!   tree t = build_call (expr, TREE_TYPE (tinfo_decl_type), NULL_TREE);
    
    return t;
  }
*************** ifnonnull (test, result)
*** 439,444 ****
--- 453,494 ----
  		result);
  }
  
+ /* Generate the constant expression describing where direct base BINFO
+    appears within the PARENT. How to interpret this expression depends on
+    details of the ABI, which the runtime must be aware of.  */
+ 
+ static tree
+ get_base_offset (binfo, parent)
+      tree binfo;
+      tree parent;
+ {
+   tree offset;
+   
+   if (!TREE_VIA_VIRTUAL (binfo))
+     offset = BINFO_OFFSET (binfo);
+   else if (!vbase_offsets_in_vtable_p ())
+     {
+       tree t = BINFO_TYPE (binfo);
+       const char *name;
+       tree field;
+     
+       FORMAT_VBASE_NAME (name, t);
+       field = lookup_field (parent, get_identifier (name), 0, 0);
+       offset = size_binop (FLOOR_DIV_EXPR, 
+     		           DECL_FIELD_BITPOS (field), 
+     		           size_int (BITS_PER_UNIT));
+       offset = convert (sizetype, offset);
+     }
+   else
+     {
+       /* Under the new ABI, we store the vtable offset at which
+          the virtual base offset can be found.  */
+       tree vbase = BINFO_FOR_VBASE (BINFO_TYPE (binfo), parent);
+       offset = convert (sizetype, BINFO_VPTR_FIELD (vbase));
+     }
+   return offset;
+ }
+ 
  /* Execute a dynamic cast, as described in section 5.2.6 of the 9/93 working
     paper.  */
  
*************** expand_si_desc (tdecl, type)
*** 710,717 ****
       tree type;
  {
    tree t, elems, fn;
!   const char *name = build_overload_name (type, 1, 1);
!   tree name_string = combine_strings (build_string (strlen (name)+1, name));
  
    type = BINFO_TYPE (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), 0));
    finish_expr_stmt (get_typeid_1 (type));
--- 760,766 ----
       tree type;
  {
    tree t, elems, fn;
!   tree name_string = tinfo_name (type);
  
    type = BINFO_TYPE (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), 0));
    finish_expr_stmt (get_typeid_1 (type));
*************** expand_class_desc (tdecl, type)
*** 756,762 ****
  {
    tree name_string;
    tree fn, tmp;
-   const char *name;
  
    int i = CLASSTYPE_N_BASECLASSES (type);
    int base_cnt = 0;
--- 805,810 ----
*************** expand_class_desc (tdecl, type)
*** 768,782 ****
  #endif
    tree base, elems, access, offset, isvir;
    tree elt, elts = NULL_TREE;
-   static tree base_info_type_node;
  
!   if (base_info_type_node == NULL_TREE)
      {
        tree fields [4];
  
        /* A reasonably close approximation of __class_type_info::base_info */
  
!       base_info_type_node = make_aggr_type (RECORD_TYPE);
  
        /* Actually const __user_type_info * */
        fields [0] = build_lang_decl
--- 816,829 ----
  #endif
    tree base, elems, access, offset, isvir;
    tree elt, elts = NULL_TREE;
  
!   if (base_desc_type_node == NULL_TREE)
      {
        tree fields [4];
  
        /* A reasonably close approximation of __class_type_info::base_info */
  
!       base_desc_type_node = make_aggr_type (RECORD_TYPE);
  
        /* Actually const __user_type_info * */
        fields [0] = build_lang_decl
*************** expand_class_desc (tdecl, type)
*** 801,807 ****
        DECL_BIT_FIELD (fields[3]) = 1;
        DECL_FIELD_SIZE (fields[3]) = 2;
  
!       finish_builtin_type (base_info_type_node, "__base_info", fields,
  			   3, ptr_type_node);
      }
  
--- 848,854 ----
        DECL_BIT_FIELD (fields[3]) = 1;
        DECL_FIELD_SIZE (fields[3]) = 2;
  
!       finish_builtin_type (base_desc_type_node, "__base_info", fields,
  			   3, ptr_type_node);
      }
  
*************** expand_class_desc (tdecl, type)
*** 811,843 ****
  
        finish_expr_stmt (get_typeid_1 (BINFO_TYPE (binfo)));
        base = decay_conversion (get_tinfo_var (BINFO_TYPE (binfo)));
! 
!       if (TREE_VIA_VIRTUAL (binfo))
! 	{
! 	  if (!vbase_offsets_in_vtable_p ())
! 	    {
! 	      tree t = BINFO_TYPE (binfo);
! 	      const char *name;
! 	      tree field;
! 
! 	      FORMAT_VBASE_NAME (name, t);
! 	      field = lookup_field (type, get_identifier (name), 0, 0);
! 	      offset = size_binop (FLOOR_DIV_EXPR, 
! 				   DECL_FIELD_BITPOS (field), 
! 				   size_int (BITS_PER_UNIT));
! 	      offset = convert (sizetype, offset);
! 	    }
! 	  else
! 	    {
! 	      /* Under the new ABI, we store the vtable offset at which
! 		 the virtual base offset can be found.  */
! 	      tree vbase = BINFO_FOR_VBASE (BINFO_TYPE (binfo), type);
! 	      offset = convert (sizetype, BINFO_VPTR_FIELD (vbase));
! 	    }
! 	}
!       else
! 	offset = BINFO_OFFSET (binfo);
! 
        if (TREE_VIA_PUBLIC (binfo))
          access = access_public_node;
        else if (TREE_VIA_PROTECTED (binfo))
--- 858,865 ----
  
        finish_expr_stmt (get_typeid_1 (BINFO_TYPE (binfo)));
        base = decay_conversion (get_tinfo_var (BINFO_TYPE (binfo)));
!       offset = get_base_offset (binfo, type);
!       
        if (TREE_VIA_PUBLIC (binfo))
          access = access_public_node;
        else if (TREE_VIA_PROTECTED (binfo))
*************** expand_class_desc (tdecl, type)
*** 850,856 ****
  	isvir = boolean_false_node;
  
        elt = build
! 	(CONSTRUCTOR, base_info_type_node, NULL_TREE, tree_cons
  	 (NULL_TREE, base, tree_cons
  	  (NULL_TREE, offset, tree_cons
  	   (NULL_TREE, isvir, tree_cons
--- 872,878 ----
  	isvir = boolean_false_node;
  
        elt = build
! 	(CONSTRUCTOR, base_desc_type_node, NULL_TREE, tree_cons
  	 (NULL_TREE, base, tree_cons
  	  (NULL_TREE, offset, tree_cons
  	   (NULL_TREE, isvir, tree_cons
*************** expand_class_desc (tdecl, type)
*** 893,903 ****
      }
  #endif
  
!   name = build_overload_name (type, 1, 1);
!   name_string = combine_strings (build_string (strlen (name)+1, name));
  
    {
!     tree arrtype = build_array_type (base_info_type_node, NULL_TREE);
      elts = build (CONSTRUCTOR, arrtype, NULL_TREE, elts);
      TREE_HAS_CONSTRUCTOR (elts) = TREE_CONSTANT (elts)
        = TREE_STATIC (elts) = 1;
--- 915,924 ----
      }
  #endif
  
!   name_string = tinfo_name (type);
  
    {
!     tree arrtype = build_array_type (base_desc_type_node, NULL_TREE);
      elts = build (CONSTRUCTOR, arrtype, NULL_TREE, elts);
      TREE_HAS_CONSTRUCTOR (elts) = TREE_CONSTANT (elts)
        = TREE_STATIC (elts) = 1;
*************** expand_class_desc (tdecl, type)
*** 919,925 ****
        tmp = tree_cons
  	(NULL_TREE, ptr_type_node, tree_cons
  	 (NULL_TREE, const_string_type_node, tree_cons
! 	  (NULL_TREE, build_pointer_type (base_info_type_node), tree_cons
  	   (NULL_TREE, sizetype, void_list_node))));
        tmp = build_function_type	(void_type_node, tmp);
    
--- 940,946 ----
        tmp = tree_cons
  	(NULL_TREE, ptr_type_node, tree_cons
  	 (NULL_TREE, const_string_type_node, tree_cons
! 	  (NULL_TREE, build_pointer_type (base_desc_type_node), tree_cons
  	   (NULL_TREE, sizetype, void_list_node))));
        tmp = build_function_type	(void_type_node, tmp);
    
*************** expand_ptr_desc (tdecl, type)
*** 944,951 ****
       tree type;
  {
    tree t, elems, fn;
!   const char *name = build_overload_name (type, 1, 1);
!   tree name_string = combine_strings (build_string (strlen (name)+1, name));
  
    type = TREE_TYPE (type);
    finish_expr_stmt (get_typeid_1 (type));
--- 965,971 ----
       tree type;
  {
    tree t, elems, fn;
!   tree name_string = tinfo_name (type);
  
    type = TREE_TYPE (type);
    finish_expr_stmt (get_typeid_1 (type));
*************** expand_attr_desc (tdecl, type)
*** 989,996 ****
       tree type;
  {
    tree elems, t, fn;
!   const char *name = build_overload_name (type, 1, 1);
!   tree name_string = combine_strings (build_string (strlen (name)+1, name));
    tree attrval = build_int_2 (TYPE_QUALS (type), 0);
  
    finish_expr_stmt (get_typeid_1 (TYPE_MAIN_VARIANT (type)));
--- 1009,1015 ----
       tree type;
  {
    tree elems, t, fn;
!   tree name_string = tinfo_name (type);
    tree attrval = build_int_2 (TYPE_QUALS (type), 0);
  
    finish_expr_stmt (get_typeid_1 (TYPE_MAIN_VARIANT (type)));
*************** expand_generic_desc (tdecl, type, fnname
*** 1035,1042 ****
       tree type;
       const char *fnname;
  {
!   const char *name = build_overload_name (type, 1, 1);
!   tree name_string = combine_strings (build_string (strlen (name)+1, name));
    tree elems = tree_cons
      (NULL_TREE, decay_conversion (tdecl), tree_cons
       (NULL_TREE, decay_conversion (name_string), NULL_TREE));
--- 1054,1060 ----
       tree type;
       const char *fnname;
  {
!   tree name_string = tinfo_name (type);
    tree elems = tree_cons
      (NULL_TREE, decay_conversion (tdecl), tree_cons
       (NULL_TREE, decay_conversion (name_string), NULL_TREE));
Index: cp/tinfo.cc
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/tinfo.cc,v
retrieving revision 1.14
diff -c -3 -p -r1.14 tinfo.cc
*** tinfo.cc	2000/01/20 11:05:19	1.14
--- tinfo.cc	2000/01/22 12:02:46
*************** convert_to_base (void *addr, bool is_vir
*** 44,50 ****
    if (!is_virtual)
      return (char *) addr + offset;
  
! #ifdef __GXX_ABI_VERSION
    // Under the new ABI, the offset gives us an index into the vtable,
    // which contains an offset to the virtual base.  The vptr is always
    // the first thing in the object.
--- 44,50 ----
    if (!is_virtual)
      return (char *) addr + offset;
  
! #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
    // Under the new ABI, the offset gives us an index into the vtable,
    // which contains an offset to the virtual base.  The vptr is always
    // the first thing in the object.
Index: cp/tinfo.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/tinfo.h,v
retrieving revision 1.9
diff -c -3 -p -r1.9 tinfo.h
*** tinfo.h	2000/01/20 11:05:19	1.9
--- tinfo.h	2000/01/22 12:02:46
*************** public:
*** 167,173 ****
  
  // type_info for a general class.
  
! #ifdef __GXX_ABI_VERSION
  typedef int USItype __attribute__ ((mode (SI)));
  #else
  typedef unsigned int USItype	__attribute__ ((mode (SI)));
--- 167,173 ----
  
  // type_info for a general class.
  
! #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
  typedef int USItype __attribute__ ((mode (SI)));
  #else
  typedef unsigned int USItype	__attribute__ ((mode (SI)));

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