src/share/vm/utilities/hashtable.hpp

changeset 7207
152cf4afc11f
parent 6351
f9e35a9dc8c7
child 7535
7ae4e26cb1e0
child 8766
ce9a710b0f63
     1.1 --- a/src/share/vm/utilities/hashtable.hpp	Tue Sep 23 17:24:34 2014 -0700
     1.2 +++ b/src/share/vm/utilities/hashtable.hpp	Fri Aug 29 13:08:01 2014 +0200
     1.3 @@ -178,11 +178,6 @@
     1.4    void verify_lookup_length(double load);
     1.5  #endif
     1.6  
     1.7 -  enum {
     1.8 -    rehash_count = 100,
     1.9 -    rehash_multiple = 60
    1.10 -  };
    1.11 -
    1.12    void initialize(int table_size, int entry_size, int number_of_entries);
    1.13  
    1.14    // Accessor
    1.15 @@ -194,12 +189,12 @@
    1.16    // The following method is not MT-safe and must be done under lock.
    1.17    BasicHashtableEntry<F>** bucket_addr(int i) { return _buckets[i].entry_addr(); }
    1.18  
    1.19 +  // Attempt to get an entry from the free list
    1.20 +  BasicHashtableEntry<F>* new_entry_free_list();
    1.21 +
    1.22    // Table entry management
    1.23    BasicHashtableEntry<F>* new_entry(unsigned int hashValue);
    1.24  
    1.25 -  // Check that the table is unbalanced
    1.26 -  bool check_rehash_table(int count);
    1.27 -
    1.28    // Used when moving the entry to another table
    1.29    // Clean up links, but do not add to free_list
    1.30    void unlink_entry(BasicHashtableEntry<F>* entry) {
    1.31 @@ -277,8 +272,30 @@
    1.32      return (HashtableEntry<T, F>**)BasicHashtable<F>::bucket_addr(i);
    1.33    }
    1.34  
    1.35 +};
    1.36 +
    1.37 +template <class T, MEMFLAGS F> class RehashableHashtable : public Hashtable<T, F> {
    1.38 + protected:
    1.39 +
    1.40 +  enum {
    1.41 +    rehash_count = 100,
    1.42 +    rehash_multiple = 60
    1.43 +  };
    1.44 +
    1.45 +  // Check that the table is unbalanced
    1.46 +  bool check_rehash_table(int count);
    1.47 +
    1.48 + public:
    1.49 +  RehashableHashtable(int table_size, int entry_size)
    1.50 +    : Hashtable<T, F>(table_size, entry_size) { }
    1.51 +
    1.52 +  RehashableHashtable(int table_size, int entry_size,
    1.53 +                   HashtableBucket<F>* buckets, int number_of_entries)
    1.54 +    : Hashtable<T, F>(table_size, entry_size, buckets, number_of_entries) { }
    1.55 +
    1.56 +
    1.57    // Function to move these elements into the new table.
    1.58 -  void move_to(Hashtable<T, F>* new_table);
    1.59 +  void move_to(RehashableHashtable<T, F>* new_table);
    1.60    static bool use_alternate_hashcode()  { return _seed != 0; }
    1.61    static juint seed()                    { return _seed; }
    1.62  
    1.63 @@ -292,7 +309,6 @@
    1.64    static int literal_size(ConstantPool *cp) {Unimplemented(); return 0;}
    1.65    static int literal_size(Klass *k)         {Unimplemented(); return 0;}
    1.66  
    1.67 -public:
    1.68    void dump_table(outputStream* st, const char *table_name);
    1.69  
    1.70   private:

mercurial