From 2a22f99cb12d82712dd93cfef808b1cef543601b Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Sun, 12 Oct 2014 22:22:53 +0000 Subject: 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 --- gcc/java/expr.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'gcc/java/expr.c') diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 51b8f0f..877f1b0 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -398,22 +398,19 @@ pop_type (tree type) /* Return true if two type assertions are equal. */ -static int -type_assertion_eq (const void * k1_p, const void * k2_p) +bool +type_assertion_hasher::equal (type_assertion *k1, type_assertion *k2) { - const type_assertion k1 = *(const type_assertion *)k1_p; - const type_assertion k2 = *(const type_assertion *)k2_p; - return (k1.assertion_code == k2.assertion_code - && k1.op1 == k2.op1 - && k1.op2 == k2.op2); + return (k1->assertion_code == k2->assertion_code + && k1->op1 == k2->op1 + && k1->op2 == k2->op2); } /* Hash a type assertion. */ -static hashval_t -type_assertion_hash (const void *p) +hashval_t +type_assertion_hasher::hash (type_assertion *k_p) { - const type_assertion *k_p = (const type_assertion *) p; hashval_t hash = iterative_hash (&k_p->assertion_code, sizeof k_p->assertion_code, 0); @@ -449,15 +446,14 @@ type_assertion_hash (const void *p) void add_type_assertion (tree klass, int assertion_code, tree op1, tree op2) { - htab_t assertions_htab; + hash_table *assertions_htab; type_assertion as; - void **as_pp; + type_assertion **as_pp; assertions_htab = TYPE_ASSERTIONS (klass); if (assertions_htab == NULL) { - assertions_htab = htab_create_ggc (7, type_assertion_hash, - type_assertion_eq, NULL); + assertions_htab = hash_table::create_ggc (7); TYPE_ASSERTIONS (current_class) = assertions_htab; } @@ -465,14 +461,14 @@ add_type_assertion (tree klass, int assertion_code, tree op1, tree op2) as.op1 = op1; as.op2 = op2; - as_pp = htab_find_slot (assertions_htab, &as, INSERT); + as_pp = assertions_htab->find_slot (&as, INSERT); /* Don't add the same assertion twice. */ if (*as_pp) return; *as_pp = ggc_alloc (); - **(type_assertion **)as_pp = as; + **as_pp = as; } @@ -1946,10 +1942,9 @@ pop_arguments (tree method_type) /* Attach to PTR (a block) the declaration found in ENTRY. */ int -attach_init_test_initialization_flags (void **entry, void *ptr) +attach_init_test_initialization_flags (treetreehash_entry **slot, tree block) { - tree block = (tree)ptr; - struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry; + treetreehash_entry *ite = *slot; if (block != error_mark_node) { -- cgit v1.1