summaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-25 17:16:23 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-25 17:16:23 +0000
commitcbfc4bfa9965a87780a24f47a72e9849180ab043 (patch)
treeef11c0ce585dd35735de0a607dd716f3fa308d6e /gcc/java
parent22fd03a551df35a59ba22f3f68464a7b25379c32 (diff)
downloadgcc-cbfc4bfa9965a87780a24f47a72e9849180ab043.tar.gz
gcc/
* hash-traits.h (string_hash, nofree_string_hash): New classes. * genmatch.c (capture_id_map_hasher): Use nofree_string_hash. * passes.c (pass_registry_hasher): Likewise. * config/alpha/alpha.c (string_traits): Likewise. * config/i386/winnt.c (i386_find_on_wrapper_list): Likewise. * config/m32c/m32c.c (pragma_traits): Likewise. * config/mep/mep.c (pragma_traits): Likewise. gcc/java/ * jcf-io.c (memoized_class_lookups): Use nofree_string_hash. (find_class): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224971 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/jcf-io.c28
2 files changed, 8 insertions, 25 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 6a9330481e4..96a5c6314fa 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,5 +1,10 @@
2015-06-25 Richard Sandiford <richard.sandiford@arm.com>
+ * jcf-io.c (memoized_class_lookups): Use nofree_string_hash.
+ (find_class): Likewise.
+
+2015-06-25 Richard Sandiford <richard.sandiford@arm.com>
+
* java-tree.h (treetreehasher): Inherit from ggc_ptr_hash
rather than ggc_hasher.
(ict_hasher, type_assertion_hasher): Likewise.
diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c
index 91fe952fdb9..be251d462f1 100644
--- a/gcc/java/jcf-io.c
+++ b/gcc/java/jcf-io.c
@@ -272,33 +272,11 @@ find_classfile (char *filename, JCF *jcf, const char *dep_name)
return open_class (filename, jcf, fd, dep_name);
}
-
-/* Hash table helper. */
-
-struct charstar_hash : nofree_ptr_hash <const char>
-{
- static inline hashval_t hash (const char *candidate);
- static inline bool equal (const char *existing, const char *candidate);
-};
-
-inline hashval_t
-charstar_hash::hash (const char *candidate)
-{
- return htab_hash_string (candidate);
-}
-
-inline bool
-charstar_hash::equal (const char *existing, const char *candidate)
-{
- return strcmp (existing, candidate) == 0;
-}
-
-
/* A hash table keeping track of class names that were not found
during class lookup. (There is no need to cache the values
associated with names that were found; they are saved in
IDENTIFIER_CLASS_VALUE.) */
-static hash_table<charstar_hash> *memoized_class_lookups;
+static hash_table<nofree_string_hash> *memoized_class_lookups;
/* Returns a freshly malloc'd string with the fully qualified pathname
of the .class file for the class CLASSNAME. CLASSNAME must be
@@ -321,11 +299,11 @@ find_class (const char *classname, int classname_length, JCF *jcf)
/* Create the hash table, if it does not already exist. */
if (!memoized_class_lookups)
- memoized_class_lookups = new hash_table<charstar_hash> (37);
+ memoized_class_lookups = new hash_table<nofree_string_hash> (37);
/* Loop for this class in the hashtable. If it is present, we've
already looked for this class and failed to find it. */
- hash = charstar_hash::hash (classname);
+ hash = nofree_string_hash::hash (classname);
if (memoized_class_lookups->find_with_hash (classname, hash))
return NULL;