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: [jh@suse.cz: Re: 6 GCC regressions, 2 new, with your patch on 2003-06-24T13:15:02Z.]


> On Wed, Jun 25, 2003 at 07:19:41PM +0200, Jan Hubicka wrote:
> > 	* c-common.c (handle_used_attribute): Use mark_referenced.
> > 	* varasm.c (mark_referenced): Break out from ...
> > 	(assemble_name): ... here.
> > 	* tree.h (mark_referenced): Declare.
> 
> Ok.
Thanks!  The PCH failure is actually more dificult to fix.
Storing callgraph into PCH hits the problem with hashtables using
pointers.  To avoid it we would have to hash the strings themselves that
is slow.  Another way is to re-construct the hashtable once we are
restored, for that I had to reinvent the linked chain of varpool nodes.
regtested i386, bootstrap in progress OK? 

Wed Jun 25 20:26:51 CEST 2003  Jan Hubicka  <jh@suse.cz>
	* Makefile.in (GTFILES): Add cgraph.h.
	* cgraph.c (known_decls): Remove.
	(cgraph_hash, cgraph_nodes, cgraph_nodes_queue,
	cgraph_varpool_hash, cgraph_varpool_nodes_queue): GTYize.
	(cgraph_node): Do not allocate known_decls; use polutate hashtable.
	(cgraph_varpool_node): Likewise; add next pointer.
	(cgraph_varpool_nodes): New static variable.
	* cgraph.h (cgraph_local_info, cgraph_global_info, cgraph_rtl_info,
	cgraph_node, cgraph_edge, cgraph_varpool_node, cgraph_nodes, cgraph_n_nodes,
	cgraph_varpool_n_nodes, cgraph_varpool_nodes_queue): GTYize.
	* gengtype.c (open_base_files): Include cgraph.h
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1089
diff -c -3 -p -r1.1089 Makefile.in
*** Makefile.in	25 Jun 2003 15:53:06 -0000	1.1089
--- Makefile.in	25 Jun 2003 20:28:38 -0000
*************** GTFILES = $(srcdir)/input.h $(srcdir)/co
*** 1992,1998 ****
    $(srcdir)/bitmap.h $(srcdir)/coverage.c $(srcdir)/function.h  $(srcdir)/rtl.h \
    $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h $(srcdir)/hashtable.h \
    $(srcdir)/real.h $(srcdir)/varray.h $(srcdir)/ssa.h $(srcdir)/insn-addr.h \
!   $(srcdir)/cselib.h $(srcdir)/basic-block.h \
    $(srcdir)/c-common.h $(srcdir)/c-tree.h \
    $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \
    $(srcdir)/dbxout.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \
--- 1992,1998 ----
    $(srcdir)/bitmap.h $(srcdir)/coverage.c $(srcdir)/function.h  $(srcdir)/rtl.h \
    $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h $(srcdir)/hashtable.h \
    $(srcdir)/real.h $(srcdir)/varray.h $(srcdir)/ssa.h $(srcdir)/insn-addr.h \
!   $(srcdir)/cselib.h $(srcdir)/basic-block.h  $(srcdir)/cgraph.h \
    $(srcdir)/c-common.h $(srcdir)/c-tree.h \
    $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \
    $(srcdir)/dbxout.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \
Index: cgraph.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraph.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 cgraph.c
*** cgraph.c	24 Jun 2003 16:50:26 -0000	1.13
--- cgraph.c	25 Jun 2003 20:28:38 -0000
*************** Software Foundation, 59 Temple Place - S
*** 35,46 ****
  #include "varray.h"
  #include "output.h"
  
- /* The known declarations must not get garbage collected.  Callgraph
-    datastructures should not get saved via PCH code since this would
-    make it difficult to extend into intra-module optimizer later.  So
-    we store only the references into the array to prevent gabrage
-    collector from deleting live data.  */
- static GTY(()) varray_type known_decls;
  
  /* Hash table used to convert declarations into nodes.  */
  static htab_t cgraph_hash = 0;
--- 35,40 ----
*************** struct cgraph_varpool_node *cgraph_varpo
*** 66,71 ****
--- 60,68 ----
  /* Number of nodes in existence.  */
  int cgraph_varpool_n_nodes;
  
+ /* The linked list of cgraph varpool nodes.  */
+ static GTY(())  struct cgraph_varpool_node *cgraph_varpool_nodes;
+ 
  static struct cgraph_edge *create_edge PARAMS ((struct cgraph_node *,
  						struct cgraph_node *));
  static void cgraph_remove_edge PARAMS ((struct cgraph_node *, struct cgraph_node *));
*************** cgraph_node (decl)
*** 108,114 ****
    if (!cgraph_hash)
      {
        cgraph_hash = htab_create (10, hash_node, eq_node, NULL);
!       VARRAY_TREE_INIT (known_decls, 32, "known_decls");
      }
  
    slot =
--- 105,119 ----
    if (!cgraph_hash)
      {
        cgraph_hash = htab_create (10, hash_node, eq_node, NULL);
! 
!       /* We can not save hash table into PCH as it contains pointers.  Repolutate
!          it once we are restored.  */
!       for (node = cgraph_nodes; node; node = node->next)
! 	{
! 	  slot =
! 	    (struct cgraph_node **) htab_find_slot (cgraph_hash, node, 1);
! 	  *slot = node;
! 	}
      }
  
    slot =
*************** cgraph_node (decl)
*** 119,125 ****
  						       (decl)), 1);
    if (*slot)
      return *slot;
!   node = xcalloc (sizeof (*node), 1);
    node->decl = decl;
    node->next = cgraph_nodes;
    if (cgraph_nodes)
--- 124,130 ----
  						       (decl)), 1);
    if (*slot)
      return *slot;
!   node = ggc_alloc_cleared (sizeof (*node));
    node->decl = decl;
    node->next = cgraph_nodes;
    if (cgraph_nodes)
*************** cgraph_node (decl)
*** 134,140 ****
        node->next_nested = node->origin->nested;
        node->origin->nested = node;
      }
-   VARRAY_PUSH_TREE (known_decls, decl);
    return node;
  }
  
--- 139,144 ----
*************** static struct cgraph_edge *
*** 165,171 ****
  create_edge (caller, callee)
       struct cgraph_node *caller, *callee;
  {
!   struct cgraph_edge *edge = xmalloc (sizeof (struct cgraph_edge));
  
    edge->caller = caller;
    edge->callee = callee;
--- 169,175 ----
  create_edge (caller, callee)
       struct cgraph_node *caller, *callee;
  {
!   struct cgraph_edge *edge = ggc_alloc (sizeof (struct cgraph_edge));
  
    edge->caller = caller;
    edge->callee = callee;
*************** cgraph_varpool_node (tree decl)
*** 393,400 ****
  
    if (!cgraph_varpool_hash)
      {
!       cgraph_varpool_hash = htab_create (10, cgraph_varpool_hash_node, eq_cgraph_varpool_node, NULL);
!       VARRAY_TREE_INIT (known_decls, 32, "known_decls");
      }
  
    slot =
--- 397,414 ----
  
    if (!cgraph_varpool_hash)
      {
!       cgraph_varpool_hash = htab_create (10, cgraph_varpool_hash_node,
! 		      			 eq_cgraph_varpool_node, NULL);
! 
!       /* We can not save hash table into PCH as it contains pointers.  Repolutate
!          it once we are restored.  */
!       for (node = cgraph_varpool_nodes; node; node = node->next)
! 	{
! 	  slot =
! 	    (struct cgraph_varpool_node **) htab_find_slot (cgraph_varpool_hash,
! 							    node, 1);
! 	  *slot = node;
! 	}
      }
  
    slot =
*************** cgraph_varpool_node (tree decl)
*** 405,415 ****
  						       (decl)), 1);
    if (*slot)
      return *slot;
!   node = xcalloc (sizeof (*node), 1);
    node->decl = decl;
    cgraph_varpool_n_nodes++;
    *slot = node;
-   VARRAY_PUSH_TREE (known_decls, decl);
    return node;
  }
  
--- 419,430 ----
  						       (decl)), 1);
    if (*slot)
      return *slot;
!   node = ggc_alloc_cleared (sizeof (*node));
    node->decl = decl;
    cgraph_varpool_n_nodes++;
+   node->next = cgraph_varpool_nodes;
+   cgraph_varpool_nodes = node;
    *slot = node;
    return node;
  }
  
Index: cgraph.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraph.h,v
retrieving revision 1.6
diff -c -3 -p -r1.6 cgraph.h
*** cgraph.h	24 Jun 2003 16:50:26 -0000	1.6
--- cgraph.h	25 Jun 2003 20:28:38 -0000
*************** Software Foundation, 59 Temple Place - S
*** 25,31 ****
  /* Information about the function collected locally.
     Available after function is lowered  */
  
! struct cgraph_local_info
  {
    /* Set when function function is visiable in current compilation unit only
       and it's address is never taken.  */
--- 25,31 ----
  /* Information about the function collected locally.
     Available after function is lowered  */
  
! struct cgraph_local_info GTY(())
  {
    /* Set when function function is visiable in current compilation unit only
       and it's address is never taken.  */
*************** struct cgraph_local_info
*** 40,46 ****
  /* Information about the function that needs to be computed globally
     once compilation is finished.  Available only with -funit-at-time.  */
  
! struct cgraph_global_info
  {
    /* Set when the function will be inlined exactly once.  */
    bool inline_once;
--- 40,46 ----
  /* Information about the function that needs to be computed globally
     once compilation is finished.  Available only with -funit-at-time.  */
  
! struct cgraph_global_info GTY(())
  {
    /* Set when the function will be inlined exactly once.  */
    bool inline_once;
*************** struct cgraph_global_info
*** 49,57 ****
  /* Information about the function that is propagated by the RTL backend.
     Available only for functions that has been already assembled.  */
  
! struct cgraph_rtl_info
  {
!    bool const_function, pure_function;
     int preferred_incoming_stack_boundary;
  };
  
--- 49,58 ----
  /* Information about the function that is propagated by the RTL backend.
     Available only for functions that has been already assembled.  */
  
! struct cgraph_rtl_info GTY(())
  {
!    bool const_function;
!    bool pure_function;
     int preferred_incoming_stack_boundary;
  };
  
*************** struct cgraph_rtl_info
*** 59,77 ****
  /* The cgraph data strutcture.
     Each function decl has assigned cgraph_node listing calees and callers.  */
  
! struct cgraph_node
  {
    tree decl;
    struct cgraph_edge *callees;
    struct cgraph_edge *callers;
!   struct cgraph_node *next, *previous;
    /* For nested functions points to function the node is nested in.  */
    struct cgraph_node *origin;
    /* Points to first nested function, if any.  */
    struct cgraph_node *nested;
    /* Pointer to the next function with same origin, if any.  */
    struct cgraph_node *next_nested;
!   void *aux;
  
    /* Set when function must be output - it is externally visible
       or it's address is taken.  */
--- 60,79 ----
  /* The cgraph data strutcture.
     Each function decl has assigned cgraph_node listing calees and callers.  */
  
! struct cgraph_node GTY(())
  {
    tree decl;
    struct cgraph_edge *callees;
    struct cgraph_edge *callers;
!   struct cgraph_node *next;
!   struct cgraph_node *previous;
    /* For nested functions points to function the node is nested in.  */
    struct cgraph_node *origin;
    /* Points to first nested function, if any.  */
    struct cgraph_node *nested;
    /* Pointer to the next function with same origin, if any.  */
    struct cgraph_node *next_nested;
!   PTR GTY ((skip (""))) aux;
  
    /* Set when function must be output - it is externally visible
       or it's address is taken.  */
*************** struct cgraph_node
*** 90,98 ****
    struct cgraph_rtl_info rtl;
  };
  
! struct cgraph_edge
  {
!   struct cgraph_node *caller, *callee;
    struct cgraph_edge *next_caller;
    struct cgraph_edge *next_callee;
  };
--- 92,101 ----
    struct cgraph_rtl_info rtl;
  };
  
! struct cgraph_edge GTY(())
  {
!   struct cgraph_node *caller;
!   struct cgraph_node *callee;
    struct cgraph_edge *next_caller;
    struct cgraph_edge *next_callee;
  };
*************** struct cgraph_edge
*** 100,109 ****
  /* The cgraph_varpool data strutcture.
     Each static variable decl has assigned cgraph_varpool_node.  */
  
! struct cgraph_varpool_node
  {
    tree decl;
!   void *aux;
  
    /* Set when function must be output - it is externally visible
       or it's address is taken.  */
--- 103,113 ----
  /* The cgraph_varpool data strutcture.
     Each static variable decl has assigned cgraph_varpool_node.  */
  
! struct cgraph_varpool_node GTY(())
  {
    tree decl;
!   PTR GTY ((skip (""))) aux;
!   struct cgraph_varpool_node *next;
  
    /* Set when function must be output - it is externally visible
       or it's address is taken.  */
*************** struct cgraph_varpool_node
*** 114,126 ****
    bool output;
  };
  
! extern struct cgraph_node *cgraph_nodes;
! extern int cgraph_n_nodes;
  extern bool cgraph_global_info_ready;
! extern struct cgraph_node *cgraph_nodes_queue;
  
! extern int cgraph_varpool_n_nodes;
! extern struct cgraph_varpool_node *cgraph_varpool_nodes_queue;
  
  
  /* In cgraph.c  */
--- 118,130 ----
    bool output;
  };
  
! extern GTY(()) struct cgraph_node *cgraph_nodes;
! extern GTY(()) int cgraph_n_nodes;
  extern bool cgraph_global_info_ready;
! extern GTY(()) struct cgraph_node *cgraph_nodes_queue;
  
! extern GTY(()) int cgraph_varpool_n_nodes;
! extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes_queue;
  
  
  /* In cgraph.c  */
Index: gengtype.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gengtype.c,v
retrieving revision 1.34
diff -c -3 -p -r1.34 gengtype.c
*** gengtype.c	17 Jun 2003 05:09:12 -0000	1.34
--- gengtype.c	25 Jun 2003 20:28:38 -0000
*************** open_base_files (void)
*** 1089,1095 ****
        "hashtab.h", "splay-tree.h", "bitmap.h", "tree.h", "rtl.h",
        "function.h", "insn-config.h", "expr.h", "hard-reg-set.h",
        "basic-block.h", "cselib.h", "insn-addr.h", "ssa.h", "optabs.h",
!       "libfuncs.h", "debug.h", "ggc.h",
        NULL
      };
      const char *const *ifp;
--- 1089,1095 ----
        "hashtab.h", "splay-tree.h", "bitmap.h", "tree.h", "rtl.h",
        "function.h", "insn-config.h", "expr.h", "hard-reg-set.h",
        "basic-block.h", "cselib.h", "insn-addr.h", "ssa.h", "optabs.h",
!       "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
        NULL
      };
      const char *const *ifp;


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