public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][LTO] Remove odd decl freeing code
@ 2009-10-22 11:38 Richard Guenther
  0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2009-10-22 11:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Diego Novillo


This was on my radar for some while.  We try hard to free decls after
fixup, but it was only removing them from the symtab where they are
removed from anyway after merging.

Bootstrap and regtest in progress, I'll apply this as obvious after
that succeeded.

Richard.

2009-10-22  Richard Guenther  <rguenther@suse.de>

	* lto-streamer.h (lto_symtab_clear_resolution): Remove.
	* lto-symtab.c (lto_symtab_clear_resolution): Likewise.

	lto/
	* lto.c (lto_fixup_data_t): Remove free_list member.
	(lto_fixup_tree): Do not insert into free_list.
	(free_decl): Remove.
	(lto_fixup_decls): Remove free-list handling.

Index: gcc/lto-streamer.h
===================================================================
*** gcc/lto-streamer.h	(revision 153445)
--- gcc/lto-streamer.h	(working copy)
*************** void input_cgraph (void);
*** 843,851 ****
  extern void lto_symtab_register_decl (tree, ld_plugin_symbol_resolution_t,
  				      struct lto_file_decl_data *);
  extern void lto_symtab_merge_decls (void);
  extern tree lto_symtab_prevailing_decl (tree decl);
  extern enum ld_plugin_symbol_resolution lto_symtab_get_resolution (tree decl);
- extern void lto_symtab_clear_resolution (tree decl);
  
  
  /* In lto-opts.c.  */
Index: gcc/lto-symtab.c
===================================================================
*** gcc/lto-symtab.c	(revision 153445)
--- gcc/lto-symtab.c	(working copy)
*************** lto_symtab_prevailing_decl (tree decl)
*** 641,693 ****
    return ret->decl;
  }
  
- /* Remove any storage used to store resolution of DECL.  */
- 
- void
- lto_symtab_clear_resolution (tree decl)
- {
-   struct lto_symtab_entry_def temp;
-   lto_symtab_entry_t head;
-   void **slot;
- 
-   if (!TREE_PUBLIC (decl))
-     return;
- 
-   /* LTO FIXME: There should be no DECL_ABSTRACT in the middle end. */
-   if (TREE_CODE (decl) == FUNCTION_DECL && DECL_ABSTRACT (decl))
-     return;
- 
-   gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl));
- 
-   lto_symtab_maybe_init_hash_table ();
-   temp.id = DECL_ASSEMBLER_NAME (decl);
-   slot = htab_find_slot (lto_symtab_identifiers, &temp, NO_INSERT);
-   if (!*slot)
-     return;
- 
-   head = (lto_symtab_entry_t) *slot;
-   if (head->decl == decl)
-     {
-       if (head->next)
- 	{
- 	  *slot = head->next;
- 	  head->next = NULL;
- 	}
-       else
- 	htab_remove_elt (lto_symtab_identifiers, &temp);
-     }
-   else
-     {
-       lto_symtab_entry_t e;
-       while (head->next && head->next->decl != decl)
- 	head = head->next;
-       if (head->next)
- 	{
- 	  e = head->next;
- 	  head->next = e->next;
- 	  e->next = NULL;
- 	}
-     }
- }
- 
  #include "gt-lto-symtab.h"
--- 673,676 ----
Index: gcc/lto/lto.c
===================================================================
*** gcc/lto/lto.c	(revision 153445)
--- gcc/lto/lto.c	(working copy)
*************** lto_execute_ltrans (char *const *files)
*** 1193,1199 ****
  
  
  typedef struct {
-   struct pointer_set_t *free_list;
    struct pointer_set_t *seen;
  } lto_fixup_data_t;
  
--- 1193,1198 ----
*************** lto_fixup_tree (tree *tp, int *walk_subt
*** 1528,1535 ****
  		lto_mark_nothrow_fndecl (prevailing);
  	    }
  
- 	  pointer_set_insert (fixup_data->free_list, t);
- 
  	   /* Also replace t with prevailing defintion.  We don't want to
  	      insert the other defintion in the seen set as we want to
  	      replace all instances of it.  */
--- 1527,1532 ----
*************** lto_fixup_state_aux (void **slot, void *
*** 1638,1657 ****
    return 1;
  }
  
- /* A callback to pointer_set_traverse. Frees the tree pointed by p. Removes
-    from it from the UID -> DECL mapping. */
- 
- static bool
- free_decl (const void *p, void *data ATTRIBUTE_UNUSED)
- {
-   const_tree ct = (const_tree) p;
-   tree t = CONST_CAST_TREE (ct);
- 
-   lto_symtab_clear_resolution (t);
- 
-   return true;
- }
- 
  /* Fix the decls from all FILES. Replaces each decl with the corresponding
     prevailing one.  */
  
--- 1635,1640 ----
*************** lto_fixup_decls (struct lto_file_decl_da
*** 1660,1670 ****
  {
    unsigned int i;
    tree decl;
-   struct pointer_set_t *free_list = pointer_set_create ();
    struct pointer_set_t *seen = pointer_set_create ();
    lto_fixup_data_t data;
  
-   data.free_list = free_list;
    data.seen = seen;
    for (i = 0; files[i]; i++)
      {
--- 1643,1651 ----
*************** lto_fixup_decls (struct lto_file_decl_da
*** 1683,1690 ****
  	VEC_replace (tree, lto_global_var_decls, i, decl);
      }
  
-   pointer_set_traverse (free_list, free_decl, NULL);
-   pointer_set_destroy (free_list);
    pointer_set_destroy (seen);
  }
  
--- 1664,1669 ----

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-10-22 10:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-22 11:38 [PATCH][LTO] Remove odd decl freeing code Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).