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


Hi,
I've installed the attached patch which tweaks the new-abi rtti emission
machinery.
1) the optimization to not emit a polymorphic's rtti when not emitting the vtable
is not always safe. I've removed that
2) we emit the exception table late in the compilation. this causes type_info's
to be needed, but it's too late. Mark them needed earlier
3) we were a little too eager in deciding that a tinfo wasn't needed

no functional changes to old-abi land


booted and tested on i686-pc-linux-gnu (old-abi)

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
gcc
2000-03-25  Nathan Sidwell  <nathan@codesourcery.com>

	* except.c (add_eh_table_entry): Mark type_info's as referenced.

gcc/cp	
2000-03-25  Nathan Sidwell  <nathan@codesourcery.com>

	* rtti.c (get_tinfo_decl): Mark used.
	(emit_tinfo_decl): Don't optimize polymorphic type_info. Only
	mark as dealt with, if we output it.

Index: except.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/except.c,v
retrieving revision 1.126
diff -c -3 -p -r1.126 except.c
*** except.c	2000/03/23 00:29:54	1.126
--- except.c	2000/03/25 10:33:35
*************** add_eh_table_entry (n)
*** 2162,2167 ****
--- 2162,2185 ----
  	}
      }
    eh_table[eh_table_size++] = n;
+   
+   if (flag_new_exceptions)
+     {
+       /* We will output the exception table late in the compilation. That
+          references type_info objects which should have already been output
+          by that time. We explicitly mark those objects as being
+          referenced now so we know to emit them.  */
+       struct handler_info *handler = get_first_handler (n);
+       
+       for (; handler; handler = handler->next)
+         if (handler->type_info && handler->type_info != CATCH_ALL_TYPE)
+           {
+             tree tinfo = (tree)handler->type_info;
+ 
+             tinfo = TREE_OPERAND (tinfo, 0);
+             TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo)) = 1;
+           }
+     }
  #endif
  }
  
Index: cp/rtti.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/rtti.c,v
retrieving revision 1.74
diff -c -3 -p -r1.74 rtti.c
*** rtti.c	2000/03/24 16:36:06	1.74
--- rtti.c	2000/03/25 10:33:39
*************** get_tinfo_decl (type)
*** 420,425 ****
--- 420,426 ----
        pushdecl_top_level (d);
        /* Remember the type it is for.  */
        TREE_TYPE (name) = type;
+       TREE_USED (name) = 1;
      }
    return d;
  }
*************** emit_tinfo_decl (decl_ptr, data)
*** 1915,1930 ****
    tinfo_type = TREE_TYPE (DECL_NAME (tinfo_decl));
    my_friendly_assert (tinfo_type != NULL_TREE, 20000120);
    
    /* Say we've dealt with it.  */
    TREE_TYPE (DECL_NAME (tinfo_decl)) = NULL_TREE;
    
-   if (!DECL_NEEDED_P (tinfo_decl))
-     return 0;
-   if (TREE_CODE (tinfo_type) == RECORD_TYPE && TYPE_POLYMORPHIC_P (tinfo_type)
-       && !CLASSTYPE_VTABLE_NEEDS_WRITING (tinfo_type))
-     /* A polymorphic type only needs its type_info emitted when the vtable
-        is.  */
-     return 0;
    create_tinfo_types ();
    decl = synthesize_tinfo_var (tinfo_type, DECL_ASSEMBLER_NAME (tinfo_decl));
    
--- 1918,1928 ----
    tinfo_type = TREE_TYPE (DECL_NAME (tinfo_decl));
    my_friendly_assert (tinfo_type != NULL_TREE, 20000120);
    
+   if (!DECL_NEEDED_P (tinfo_decl))
+     return 0;
    /* Say we've dealt with it.  */
    TREE_TYPE (DECL_NAME (tinfo_decl)) = NULL_TREE;
    
    create_tinfo_types ();
    decl = synthesize_tinfo_var (tinfo_type, DECL_ASSEMBLER_NAME (tinfo_decl));
    

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