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]

Patch: GGC-ify type hashtable


The hashtable for types in c_common_alias_set is not ggc'd, because I thought
type nodes would always be pointed to from somewhere else. After our latest
merge it appears that this is no longer true (if it ever was), leading to an ICE
building SPEC with IMA. I have no idea how to construct a small testcase.
The fix is obvious. I am not planning to investigate how the type node became
otherwise unreferenced unless somebody thinks this really shouldn't happen.
Bootstrapped on Darwin.


2004-10-16 Dale Johannesen <dalej@apple.com>

* c-common.c (c_common_get_alias_set): Use GGC for type_hash_table.

Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.577
diff -u -d -b -w -p -c -3 -p -r1.577 c-common.c
cvs diff: conflicting specifications of output style
*** c-common.c  13 Oct 2004 23:31:19 -0000      1.577
--- c-common.c  16 Oct 2004 20:08:04 -0000
*************** c_type_hash (const void *p)
*** 2592,2597 ****
--- 2592,2599 ----
    return ((size << 24) | (i << shift));
  }

+ static GTY((param_is (union tree_node))) htab_t type_hash_table;
+
  /* Return the typed-based alias set for T, which may be an expression
     or a type.  Return -1 if we don't do anything special.  */

*************** c_common_get_alias_set (tree t)
*** 2600,2606 ****
  {
    tree u;
    PTR *slot;
-   static htab_t type_hash_table;

/* Permit type-punning when accessing a union, provided the access
is directly through the union. For example, this code does not
--- 2602,2607 ----
*************** c_common_get_alias_set (tree t)
*** 2719,2725 ****
/* Look up t in hash table. Only one of the compatible types within each
alias set is recorded in the table. */
if (!type_hash_table)
! type_hash_table = htab_create (1021, c_type_hash,
(htab_eq) lang_hooks.types_compatible_p,
NULL);
slot = htab_find_slot (type_hash_table, t, INSERT);
--- 2720,2726 ----
/* Look up t in hash table. Only one of the compatible types within each
alias set is recorded in the table. */
if (!type_hash_table)
! type_hash_table = htab_create_ggc (1021, c_type_hash,
(htab_eq) lang_hooks.types_compatible_p,
NULL);
slot = htab_find_slot (type_hash_table, t, INSERT);



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