aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/class.c
diff options
context:
space:
mode:
authorTrevor Saunders <tsaunders@mozilla.com>2014-10-12 22:22:53 +0000
committerTrevor Saunders <tbsaunde@gcc.gnu.org>2014-10-12 22:22:53 +0000
commit2a22f99cb12d82712dd93cfef808b1cef543601b (patch)
treec828063f153ceb609ce5c7d44ea9f00391b32950 /gcc/java/class.c
parent7b262a51ea2310bdb6cc901de00f04b0e7be0a4e (diff)
downloadgcc-2a22f99cb12d82712dd93cfef808b1cef543601b.zip
gcc-2a22f99cb12d82712dd93cfef808b1cef543601b.tar.gz
gcc-2a22f99cb12d82712dd93cfef808b1cef543601b.tar.bz2
move many gc hashtab to hash_table
gcc/ * asan.c, cfgloop.c, cfgloop.h, cgraph.c, cgraph.h, config/darwin.c, config/m32c/m32c.c, config/mep/mep.c, config/mips/mips.c, config/rs6000/rs6000.c, dwarf2out.c, function.c, function.h, gimple-ssa.h, libfuncs.h, optabs.c, output.h, rtl.h, sese.c, symtab.c, tree-cfg.c, tree-dfa.c, tree-ssa.c, varasm.c: Use hash-table instead of hashtab. * doc/gty.texi (for_user): Document new option. * gengtype.c (create_user_defined_type): Don't try to get a struct for char. (walk_type): Don't error out on for_user option. (write_func_for_structure): Emit user marking routines if requested by for_user option. (write_local_func_for_structure): Likewise. (main): Mark types with for_user option as used. * ggc.h (gt_pch_nx): Add overload for unsigned int. * hash-map.h (hash_map::hash_entry::pch_nx_helper): AddOverloads. * hash-table.h (ggc_hasher): New struct. (hash_table::create_ggc): New function. (gt_pch_nx): New overload for hash_table. java/ * class.c, decl.c, except.c, expr.c, java-tree.h, lang.c: Use hash_table instead of hashtab. objc/ * objc-act.c: use hash_table instead of hashtab. cp/ * cp-gimplify.c, cp-tree.h, decl.c, mangle.c, name-lookup.c, pt.c, semantics.c, tree.c, typeck2.c: Use hash_table instead of hashtab. fortran/ * trans-decl.c, trans.c, trans.h: Use hash_table instead of hashtab. c-family/ * c-common.c: Use hash_table instead of hashtab. From-SVN: r216127
Diffstat (limited to 'gcc/java/class.c')
-rw-r--r--gcc/java/class.c47
1 files changed, 18 insertions, 29 deletions
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 0d51165..25af697 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -774,7 +774,7 @@ add_method_1 (tree this_class, int access_flags, tree name, tree function_type)
/* Initialize the initialized (static) class table. */
if (access_flags & ACC_STATIC)
DECL_FUNCTION_INITIALIZED_CLASS_TABLE (fndecl) =
- htab_create_ggc (50, htab_hash_pointer, htab_eq_pointer, NULL);
+ hash_table<ict_hasher>::create_ggc (50);
DECL_CHAIN (fndecl) = TYPE_METHODS (this_class);
TYPE_METHODS (this_class) = fndecl;
@@ -3070,14 +3070,12 @@ build_assertion_table_entry (tree code, tree op1, tree op2)
/* Add an entry to the type assertion table. Callback used during hashtable
traversal. */
-static int
-add_assertion_table_entry (void **htab_entry, void *ptr)
+int
+add_assertion_table_entry (type_assertion **slot, vec<constructor_elt, va_gc> **v)
{
tree entry;
tree code_val, op1_utf8, op2_utf8;
- vec<constructor_elt, va_gc> **v
- = ((vec<constructor_elt, va_gc> **) ptr);
- type_assertion *as = (type_assertion *) *htab_entry;
+ type_assertion *as = *slot;
code_val = build_int_cst (NULL_TREE, as->assertion_code);
@@ -3103,11 +3101,12 @@ static tree
emit_assertion_table (tree klass)
{
tree null_entry, ctor, table_decl;
- htab_t assertions_htab = TYPE_ASSERTIONS (klass);
+ hash_table<type_assertion_hasher> *assertions_htab = TYPE_ASSERTIONS (klass);
vec<constructor_elt, va_gc> *v = NULL;
/* Iterate through the hash table. */
- htab_traverse (assertions_htab, add_assertion_table_entry, &v);
+ assertions_htab
+ ->traverse<vec<constructor_elt, va_gc> **, add_assertion_table_entry> (&v);
/* Finish with a null entry. */
null_entry = build_assertion_table_entry (integer_zero_node,
@@ -3146,36 +3145,28 @@ init_class_processing (void)
gcc_obstack_init (&temporary_obstack);
}
-static hashval_t java_treetreehash_hash (const void *);
-static int java_treetreehash_compare (const void *, const void *);
-
/* A hash table mapping trees to trees. Used generally. */
#define JAVA_TREEHASHHASH_H(t) ((hashval_t)TYPE_UID (t))
-static hashval_t
-java_treetreehash_hash (const void *k_p)
+hashval_t
+treetreehasher::hash (treetreehash_entry *k)
{
- const struct treetreehash_entry *const k
- = (const struct treetreehash_entry *) k_p;
return JAVA_TREEHASHHASH_H (k->key);
}
-static int
-java_treetreehash_compare (const void * k1_p, const void * k2_p)
+bool
+treetreehasher::equal (treetreehash_entry *k1, tree k2)
{
- const struct treetreehash_entry *const k1
- = (const struct treetreehash_entry *) k1_p;
- const_tree const k2 = (const_tree) k2_p;
return (k1->key == k2);
}
tree
-java_treetreehash_find (htab_t ht, tree t)
+java_treetreehash_find (hash_table<treetreehasher> *ht, tree t)
{
struct treetreehash_entry *e;
hashval_t hv = JAVA_TREEHASHHASH_H (t);
- e = (struct treetreehash_entry *) htab_find_with_hash (ht, t, hv);
+ e = ht->find_with_hash (t, hv);
if (e == NULL)
return NULL;
else
@@ -3183,13 +3174,12 @@ java_treetreehash_find (htab_t ht, tree t)
}
tree *
-java_treetreehash_new (htab_t ht, tree t)
+java_treetreehash_new (hash_table<treetreehasher> *ht, tree t)
{
- void **e;
struct treetreehash_entry *tthe;
hashval_t hv = JAVA_TREEHASHHASH_H (t);
- e = htab_find_slot_with_hash (ht, t, hv, INSERT);
+ treetreehash_entry **e = ht->find_slot_with_hash (t, hv, INSERT);
if (*e == NULL)
{
tthe = ggc_cleared_alloc<treetreehash_entry> ();
@@ -3197,15 +3187,14 @@ java_treetreehash_new (htab_t ht, tree t)
*e = tthe;
}
else
- tthe = (struct treetreehash_entry *) *e;
+ tthe = *e;
return &tthe->value;
}
-htab_t
+hash_table<treetreehasher> *
java_treetreehash_create (size_t size)
{
- return htab_create_ggc (size, java_treetreehash_hash,
- java_treetreehash_compare, NULL);
+ return hash_table<treetreehasher>::create_ggc (size);
}
/* Break down qualified IDENTIFIER into package and class-name components.