Mercurial > hg > truffle
diff src/share/vm/utilities/hashtable.hpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | 5e2dc722e70d |
children | a5d6f0c3585f |
line wrap: on
line diff
--- a/src/share/vm/utilities/hashtable.hpp Fri Aug 31 16:39:35 2012 -0700 +++ b/src/share/vm/utilities/hashtable.hpp Sat Sep 01 13:25:18 2012 -0400 @@ -25,6 +25,7 @@ #ifndef SHARE_VM_UTILITIES_HASHTABLE_HPP #define SHARE_VM_UTILITIES_HASHTABLE_HPP +#include "classfile/classLoaderData.hpp" #include "memory/allocation.hpp" #include "oops/oop.hpp" #include "oops/symbol.hpp" @@ -283,9 +284,6 @@ private: static jint _seed; - - unsigned int new_hash(Symbol* s); - unsigned int new_hash(oop string); }; @@ -302,18 +300,17 @@ : Hashtable<T, F>(table_size, entry_size, t, number_of_entries) {} public: - unsigned int compute_hash(Symbol* name, Handle loader) { - // Be careful with identity_hash(), it can safepoint and if this - // were one expression, the compiler could choose to unhandle each - // oop before calling identity_hash() for either of them. If the first - // causes a GC, the next would fail. + unsigned int compute_hash(Symbol* name, ClassLoaderData* loader_data) { unsigned int name_hash = name->identity_hash(); - unsigned int loader_hash = loader.is_null() ? 0 : loader->identity_hash(); + // loader is null with CDS + assert(loader_data != NULL || UseSharedSpaces || DumpSharedSpaces, + "only allowed with shared spaces"); + unsigned int loader_hash = loader_data == NULL ? 0 : loader_data->identity_hash(); return name_hash ^ loader_hash; } - int index_for(Symbol* name, Handle loader) { - return this->hash_to_index(compute_hash(name, loader)); + int index_for(Symbol* name, ClassLoaderData* loader_data) { + return this->hash_to_index(compute_hash(name, loader_data)); } };