This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ patch] one more missed mark_used


> > We don't, but I think we also don't care.  If a template argument is
> > relevant to the generated code, it will appear in an expression.  If a VLA
> > type is used in a decl, we catch it that way because we also walk the size
> > of a decl from the DECL_STMT.
> 
> OK.  If you're comfortable with that, it's OK by me.
Actually situation is even more complicated.  We have to deal with Java
tinfos and eh_spec_block.  Is the updated patch OK?

Thu Aug 14 12:19:25 CEST 2003  Jan Hubicka  <jh@suse.cz>

	* decl2.c (mark_member_pointers): Rename to...
	(mark_member_pointers_and_eh_tinfos): ... this one; deal with eh
	tinfos
	(lower_function): Update call.
	* except.c (eh_type_info): Break out from ...
	(build_eh_type): ... here; tinfo is already used.
	(finish_eh_spec_block): Mark tinfos as used.
	* semantics.c (finish_handler_params):  Mark tinfo as used.
	* cp-tree.h (eh_type_info): Declare.

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/ChangeLog,v
retrieving revision 1.3598
diff -c -3 -p -r1.3598 ChangeLog
*** ChangeLog	12 Aug 2003 22:26:19 -0000	1.3598
--- ChangeLog	14 Aug 2003 13:25:35 -0000
***************
*** 1,3 ****
--- 1,14 ----
+ Thu Aug 14 12:19:25 CEST 2003  Jan Hubicka  <jh@suse.cz>
+ 
+ 	* method.c (use_thunk): Expand body directly.
+ 
+ 	* decl2.c (mark_member_pointers): Rename to...
+ 	(mark_member_pointers_and_eh_handlers): ... this one; deal with eh
+ 	handlers
+ 	(lower_function): Update call.
+ 	* except.c (build_eh_type): tinfo is already used.
+ 	* semantics.c (finish_handler_params):  Mark tinfo as used.
+ 
  2003-08-12  Mark Mitchell  <mark@codesourcery.com>
  
  	PR c++/11703
Index: cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.901
diff -c -3 -p -r1.901 cp-tree.h
*** cp-tree.h	12 Aug 2003 22:26:20 -0000	1.901
--- cp-tree.h	14 Aug 2003 13:25:35 -0000
*************** extern void mark_all_runtime_matches    
*** 3829,3834 ****
--- 3829,3835 ----
  extern int nothrow_libfn_p			(tree);
  extern void check_handlers			(tree);
  extern void choose_personality_routine		(enum languages);
+ extern tree eh_type_info			(tree);
  
  /* in expr.c */
  extern rtx cxx_expand_expr			(tree, rtx,
Index: decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.659
diff -c -3 -p -r1.659 decl2.c
*** decl2.c	12 Aug 2003 22:26:21 -0000	1.659
--- decl2.c	14 Aug 2003 13:25:36 -0000
*************** generate_ctor_and_dtor_functions_for_pri
*** 2562,2573 ****
  /* Callgraph code does not understand the member pointers.  Mark the methods
     referenced as used.  */
  static tree
! mark_member_pointers (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
! 		      void *data ATTRIBUTE_UNUSED)
  {
!   if (TREE_CODE (*tp) == PTRMEM_CST
!       && TYPE_PTRMEMFUNC_P (TREE_TYPE (*tp)))
!     cgraph_mark_needed_node (cgraph_node (PTRMEM_CST_MEMBER (*tp)), 1);
    return 0;
  }
  
--- 2562,2610 ----
  /* Callgraph code does not understand the member pointers.  Mark the methods
     referenced as used.  */
  static tree
! mark_member_pointers_and_eh_handlers (tree *tp,
! 				      int *walk_subtrees,
! 		      		      void *data ATTRIBUTE_UNUSED)
  {
!   /* Avoid useless walking of complex type and declaration nodes.  */
!   if (TYPE_P (*tp) || DECL_P (*tp))
!     {
!       *walk_subtrees = 0;
!       return 0;
!     }
!   switch (TREE_CODE (*tp))
!     {
!     case PTRMEM_CST:
!       if (TYPE_PTRMEMFUNC_P (TREE_TYPE (*tp)))
! 	cgraph_mark_needed_node (cgraph_node (PTRMEM_CST_MEMBER (*tp)), 1);
!       break;
! 
!     /* EH handlers will emit EH tables referencing typeinfo.  */
!     case HANDLER:
!       if (HANDLER_TYPE (*tp))
! 	{
! 	  tree tinfo = eh_type_info (HANDLER_TYPE (*tp));
! 
! 	  cgraph_varpool_mark_needed_node (cgraph_varpool_node (tinfo));
! 	}
!       break;
! 
!     case EH_SPEC_BLOCK:
! 	{
! 	  tree type;
! 
! 	  for (type = EH_SPEC_RAISES ((*tp)); type;
! 	       type = TREE_CHAIN (type))
! 	    {
! 	       tree tinfo = eh_type_info (TREE_VALUE (type));
! 
! 	       cgraph_varpool_mark_needed_node (cgraph_varpool_node (tinfo));
! 	    }
! 	}
!       break;
!     default:
!       break;
!     }
    return 0;
  }
  
*************** mark_member_pointers (tree *tp, int *wal
*** 2576,2582 ****
  void
  lower_function (tree fn)
  {
!   walk_tree_without_duplicates (&DECL_SAVED_TREE (fn), mark_member_pointers,
  				NULL);
  }
  
--- 2613,2620 ----
  void
  lower_function (tree fn)
  {
!   walk_tree_without_duplicates (&DECL_SAVED_TREE (fn),
! 		  		mark_member_pointers_and_eh_handlers,
  				NULL);
  }
  
Index: except.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/except.c,v
retrieving revision 1.157
diff -c -3 -p -r1.157 except.c
*** except.c	8 Jul 2003 01:38:44 -0000	1.157
--- except.c	14 Aug 2003 13:25:36 -0000
*************** prepare_eh_type (tree type)
*** 115,125 ****
    return type;
  }
  
! /* Build the address of a typeinfo decl for use in the runtime
!    matching field of the exception model.  */
! 
! static tree
! build_eh_type_type (tree type)
  {
    tree exp;
  
--- 115,123 ----
    return type;
  }
  
! /* Return the type info for TYPE as used by EH machinery.  */
! tree
! eh_type_info (tree type)
  {
    tree exp;
  
*************** build_eh_type_type (tree type)
*** 131,142 ****
    else
      exp = get_tinfo_decl (type);
  
-   mark_used (exp);
-   exp = build1 (ADDR_EXPR, ptr_type_node, exp);
- 
    return exp;
  }
  
  tree
  build_exc_ptr (void)
  {
--- 129,151 ----
    else
      exp = get_tinfo_decl (type);
  
    return exp;
  }
  
+ /* Build the address of a typeinfo decl for use in the runtime
+    matching field of the exception model.  */
+ 
+ static tree
+ build_eh_type_type (tree type)
+ {
+   tree exp = eh_type_info (type);
+ 
+   if (!exp)
+     return NULL;
+ 
+   return build1 (ADDR_EXPR, ptr_type_node, exp);
+ }
+ 
  tree
  build_exc_ptr (void)
  {
*************** finish_eh_spec_block (tree raw_raises, t
*** 470,477 ****
    for (raises = NULL_TREE;
         raw_raises && TREE_VALUE (raw_raises);
         raw_raises = TREE_CHAIN (raw_raises))
!     raises = tree_cons (NULL_TREE, prepare_eh_type (TREE_VALUE (raw_raises)),
! 			raises);
  
    EH_SPEC_RAISES (eh_spec_block) = raises;
  }
--- 479,491 ----
    for (raises = NULL_TREE;
         raw_raises && TREE_VALUE (raw_raises);
         raw_raises = TREE_CHAIN (raw_raises))
!     {
!       tree type = prepare_eh_type (TREE_VALUE (raw_raises));
!       tree tinfo = eh_type_info (type);
! 
!       mark_used (tinfo);
!       raises = tree_cons (NULL_TREE, type, raises);
!     }
  
    EH_SPEC_RAISES (eh_spec_block) = raises;
  }
Index: method.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/method.c,v
retrieving revision 1.265
diff -c -3 -p -r1.265 method.c
*** method.c	30 Jul 2003 23:47:59 -0000	1.265
--- method.c	14 Aug 2003 13:25:36 -0000
*************** use_thunk (tree thunk_fndecl, bool emit_
*** 468,474 ****
        /* Re-enable access control.  */
        pop_deferring_access_checks ();
  
!       expand_or_defer_fn (finish_function (0));
      }
  
    pop_from_top_level ();
--- 468,474 ----
        /* Re-enable access control.  */
        pop_deferring_access_checks ();
  
!       expand_body (finish_function (0));
      }
  
    pop_from_top_level ();
Index: semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.345
diff -c -3 -p -r1.345 semantics.c
*** semantics.c	12 Aug 2003 22:26:22 -0000	1.345
--- semantics.c	14 Aug 2003 13:25:37 -0000
*************** finish_handler_parms (tree decl, tree ha
*** 956,961 ****
--- 956,966 ----
      type = expand_start_catch_block (decl);
  
    HANDLER_TYPE (handler) = type;
+   if (type)
+     {
+       tree tinfo = eh_type_info (type);
+       mark_used (tinfo);
+     }
  }
  
  /* Finish a handler, which may be given by HANDLER.  The BLOCKs are


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