8176863: Remove Hashtable::reverse()
authoriklam
Thu, 04 May 2017 16:04:23 -0700
changeset 46435 3f6cac9867d4
parent 46434 55cc8fa66865
child 46436 755e01cd0b9d
8176863: Remove Hashtable::reverse() Reviewed-by: hseigel, sspitsyn, coleenp
hotspot/src/share/vm/classfile/stringTable.hpp
hotspot/src/share/vm/classfile/systemDictionary.cpp
hotspot/src/share/vm/classfile/systemDictionary.hpp
hotspot/src/share/vm/memory/metaspaceShared.cpp
hotspot/src/share/vm/utilities/hashtable.cpp
hotspot/src/share/vm/utilities/hashtable.hpp
--- a/hotspot/src/share/vm/classfile/stringTable.hpp	Thu May 04 14:32:37 2017 -0400
+++ b/hotspot/src/share/vm/classfile/stringTable.hpp	Thu May 04 16:04:23 2017 -0700
@@ -160,9 +160,6 @@
                                  CompactStringTableWriter* ch_table);
   static void serialize(SerializeClosure* soc, GrowableArray<MemRegion> *string_space,
                         size_t* space_size);
-  static void reverse() {
-    the_table()->Hashtable<oop, mtSymbol>::reverse();
-  }
 
   // Rehash the symbol table if it gets out of balance
   static void rehash_table();
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu May 04 14:32:37 2017 -0400
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu May 04 16:04:23 2017 -0700
@@ -2839,11 +2839,6 @@
   dictionary()->copy_table(top, end);
 }
 
-
-void SystemDictionary::reverse() {
-  dictionary()->reverse();
-}
-
 int SystemDictionary::number_of_classes() {
   return dictionary()->number_of_entries();
 }
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Thu May 04 14:32:37 2017 -0400
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Thu May 04 16:04:23 2017 -0700
@@ -385,7 +385,6 @@
   static void reorder_dictionary();
   static void copy_buckets(char** top, char* end);
   static void copy_table(char** top, char* end);
-  static void reverse();
   static void set_shared_dictionary(HashtableBucket<mtClass>* t, int length,
                                     int number_of_entries);
   // Printing
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Thu May 04 14:32:37 2017 -0400
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Thu May 04 16:04:23 2017 -0700
@@ -795,7 +795,6 @@
 
   SystemDictionary::reorder_dictionary();
   NOT_PRODUCT(SystemDictionary::verify();)
-  SystemDictionary::reverse();
   SystemDictionary::copy_buckets(&md_top, md_end);
 
   SystemDictionary::copy_table(&md_top, md_end);
--- a/hotspot/src/share/vm/utilities/hashtable.cpp	Thu May 04 14:32:37 2017 -0400
+++ b/hotspot/src/share/vm/utilities/hashtable.cpp	Thu May 04 16:04:23 2017 -0700
@@ -156,24 +156,6 @@
 }
 
 
-// Reverse the order of elements in the hash buckets.
-
-template <MEMFLAGS F> void BasicHashtable<F>::reverse() {
-
-  for (int i = 0; i < _table_size; ++i) {
-    BasicHashtableEntry<F>* new_list = NULL;
-    BasicHashtableEntry<F>* p = bucket(i);
-    while (p != NULL) {
-      BasicHashtableEntry<F>* next = p->next();
-      p->set_next(new_list);
-      new_list = p;
-      p = next;
-    }
-    *bucket_addr(i) = new_list;
-  }
-}
-
-
 // Copy the table to the shared space.
 
 template <MEMFLAGS F> void BasicHashtable<F>::copy_table(char** top, char* end) {
@@ -207,39 +189,6 @@
 }
 
 
-
-// Reverse the order of elements in the hash buckets.
-
-template <class T, MEMFLAGS F> void Hashtable<T, F>::reverse(void* boundary) {
-
-  for (int i = 0; i < this->table_size(); ++i) {
-    HashtableEntry<T, F>* high_list = NULL;
-    HashtableEntry<T, F>* low_list = NULL;
-    HashtableEntry<T, F>* last_low_entry = NULL;
-    HashtableEntry<T, F>* p = bucket(i);
-    while (p != NULL) {
-      HashtableEntry<T, F>* next = p->next();
-      if ((void*)p->literal() >= boundary) {
-        p->set_next(high_list);
-        high_list = p;
-      } else {
-        p->set_next(low_list);
-        low_list = p;
-        if (last_low_entry == NULL) {
-          last_low_entry = p;
-        }
-      }
-      p = next;
-    }
-    if (low_list != NULL) {
-      *bucket_addr(i) = low_list;
-      last_low_entry->set_next(high_list);
-    } else {
-      *bucket_addr(i) = high_list;
-    }
-  }
-}
-
 template <class T, MEMFLAGS F> int RehashableHashtable<T, F>::literal_size(Symbol *symbol) {
   return symbol->size() * HeapWordSize;
 }
--- a/hotspot/src/share/vm/utilities/hashtable.hpp	Thu May 04 14:32:37 2017 -0400
+++ b/hotspot/src/share/vm/utilities/hashtable.hpp	Thu May 04 16:04:23 2017 -0700
@@ -166,9 +166,6 @@
     return h;
   }
 
-  // Reverse the order of elements in each of the buckets.
-  void reverse();
-
 private:
   // Instance variables
   int               _table_size;
@@ -262,12 +259,6 @@
   // Debugging
   void print()               PRODUCT_RETURN;
 
-  // Reverse the order of elements in each of the buckets. Hashtable
-  // entries which refer to objects at a lower address than 'boundary'
-  // are separated from those which refer to objects at higher
-  // addresses, and appear first in the list.
-  void reverse(void* boundary = NULL);
-
 protected:
 
   unsigned int compute_hash(Symbol* name) {