< prev index next >

src/share/vm/utilities/hashtable.hpp

Print this page




 248 
 249   Hashtable(int table_size, int entry_size,
 250                    HashtableBucket<F>* buckets, int number_of_entries)
 251     : BasicHashtable<F>(table_size, entry_size, buckets, number_of_entries) { }
 252 
 253   // Debugging
 254   void print()               PRODUCT_RETURN;
 255 
 256   unsigned int compute_hash(const Symbol* name) const {
 257     return (unsigned int) name->identity_hash();
 258   }
 259 
 260   int index_for(const Symbol* name) const {
 261     return this->hash_to_index(compute_hash(name));
 262   }
 263 
 264 protected:
 265 
 266   // Table entry management
 267   HashtableEntry<T, F>* new_entry(unsigned int hashValue, T obj);
 268   // Don't create and use freelist
 269   HashtableEntry<T, F>* allocate_new_entry(unsigned int hashValue, T obj);
 270 
 271   // The following method is MT-safe and may be used with caution.
 272   HashtableEntry<T, F>* bucket(int i) const {
 273     return (HashtableEntry<T, F>*)BasicHashtable<F>::bucket(i);
 274   }
 275 
 276   // The following method is not MT-safe and must be done under lock.
 277   HashtableEntry<T, F>** bucket_addr(int i) {
 278     return (HashtableEntry<T, F>**)BasicHashtable<F>::bucket_addr(i);
 279   }
 280 
 281 };
 282 
 283 template <class T, MEMFLAGS F> class RehashableHashtable : public Hashtable<T, F> {
 284  friend class VMStructs;
 285  protected:
 286 
 287   enum {
 288     rehash_count = 100,




 248 
 249   Hashtable(int table_size, int entry_size,
 250                    HashtableBucket<F>* buckets, int number_of_entries)
 251     : BasicHashtable<F>(table_size, entry_size, buckets, number_of_entries) { }
 252 
 253   // Debugging
 254   void print()               PRODUCT_RETURN;
 255 
 256   unsigned int compute_hash(const Symbol* name) const {
 257     return (unsigned int) name->identity_hash();
 258   }
 259 
 260   int index_for(const Symbol* name) const {
 261     return this->hash_to_index(compute_hash(name));
 262   }
 263 
 264 protected:
 265 
 266   // Table entry management
 267   HashtableEntry<T, F>* new_entry(unsigned int hashValue, T obj);
 268   // Don't create and use freelist of HashtableEntry.
 269   HashtableEntry<T, F>* allocate_new_entry(unsigned int hashValue, T obj);
 270 
 271   // The following method is MT-safe and may be used with caution.
 272   HashtableEntry<T, F>* bucket(int i) const {
 273     return (HashtableEntry<T, F>*)BasicHashtable<F>::bucket(i);
 274   }
 275 
 276   // The following method is not MT-safe and must be done under lock.
 277   HashtableEntry<T, F>** bucket_addr(int i) {
 278     return (HashtableEntry<T, F>**)BasicHashtable<F>::bucket_addr(i);
 279   }
 280 
 281 };
 282 
 283 template <class T, MEMFLAGS F> class RehashableHashtable : public Hashtable<T, F> {
 284  friend class VMStructs;
 285  protected:
 286 
 287   enum {
 288     rehash_count = 100,


< prev index next >