src/hotspot/share/utilities/hashtable.cpp
changeset 49818 e57e6addb978
parent 48794 ea0d0781c63c
child 49982 9042ffe5b7fe
--- a/src/hotspot/share/utilities/hashtable.cpp	Mon Apr 16 12:50:10 2018 +0530
+++ b/src/hotspot/share/utilities/hashtable.cpp	Wed Apr 18 12:06:53 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
 #include "memory/metaspaceShared.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
+#include "oops/weakHandle.inline.hpp"
 #include "runtime/safepoint.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/hashtable.hpp"
@@ -148,7 +149,6 @@
   }
   // give the new table the free list as well
   new_table->copy_freelist(this);
-  assert(new_table->number_of_entries() == saved_entry_count, "lost entry on dictionary copy?");
 
   // Destroy memory used by the buckets in the hashtable.  The memory
   // for the elements has been used in a new table and is not
@@ -263,6 +263,10 @@
   }
 }
 
+static int literal_size(ClassLoaderWeakHandle v) {
+  return literal_size(v.peek());
+}
+
 template <MEMFLAGS F> bool BasicHashtable<F>::resize(int new_size) {
   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
 
@@ -382,6 +386,13 @@
 }
 
 #ifndef PRODUCT
+template <class T> void print_literal(T l) {
+  l->print();
+}
+
+static void print_literal(ClassLoaderWeakHandle l) {
+  l.print();
+}
 
 template <class T, MEMFLAGS F> void Hashtable<T, F>::print() {
   ResourceMark rm;
@@ -390,7 +401,7 @@
     HashtableEntry<T, F>* entry = bucket(i);
     while(entry != NULL) {
       tty->print("%d : ", i);
-      entry->literal()->print();
+      print_literal(entry->literal());
       tty->cr();
       entry = entry->next();
     }
@@ -443,21 +454,19 @@
 #endif
 template class Hashtable<ConstantPool*, mtClass>;
 template class RehashableHashtable<Symbol*, mtSymbol>;
-template class RehashableHashtable<oopDesc*, mtSymbol>;
+template class RehashableHashtable<oop, mtSymbol>;
 template class Hashtable<Symbol*, mtSymbol>;
 template class Hashtable<Klass*, mtClass>;
 template class Hashtable<InstanceKlass*, mtClass>;
-template class Hashtable<oop, mtClass>;
+template class Hashtable<ClassLoaderWeakHandle, mtClass>;
 template class Hashtable<Symbol*, mtModule>;
-#if defined(SOLARIS) || defined(CHECK_UNHANDLED_OOPS)
 template class Hashtable<oop, mtSymbol>;
-template class RehashableHashtable<oop, mtSymbol>;
-#endif // SOLARIS || CHECK_UNHANDLED_OOPS
-template class Hashtable<oopDesc*, mtSymbol>;
+template class Hashtable<ClassLoaderWeakHandle, mtSymbol>;
 template class Hashtable<Symbol*, mtClass>;
 template class HashtableEntry<Symbol*, mtSymbol>;
 template class HashtableEntry<Symbol*, mtClass>;
 template class HashtableEntry<oop, mtSymbol>;
+template class HashtableEntry<ClassLoaderWeakHandle, mtSymbol>;
 template class HashtableBucket<mtClass>;
 template class BasicHashtableEntry<mtSymbol>;
 template class BasicHashtableEntry<mtCode>;