8221872: Remove uses of ClassLoaderWeakHandle typedef in protection domain table
authorcoleenp
Wed, 03 Apr 2019 20:39:19 -0400
changeset 54419 5c7418757bad
parent 54418 e998c9effb37
child 54420 724b9e361cb6
8221872: Remove uses of ClassLoaderWeakHandle typedef in protection domain table Summary: Make consistent with StringTable and ResolvedMethodTable Reviewed-by: dholmes
src/hotspot/share/classfile/protectionDomainCache.cpp
src/hotspot/share/classfile/protectionDomainCache.hpp
src/hotspot/share/utilities/hashtable.cpp
--- a/src/hotspot/share/classfile/protectionDomainCache.cpp	Thu Apr 04 01:46:14 2019 +0200
+++ b/src/hotspot/share/classfile/protectionDomainCache.cpp	Wed Apr 03 20:39:19 2019 -0400
@@ -45,7 +45,7 @@
 }
 
 ProtectionDomainCacheTable::ProtectionDomainCacheTable(int table_size)
-  : Hashtable<ClassLoaderWeakHandle, mtClass>(table_size, sizeof(ProtectionDomainCacheEntry))
+  : Hashtable<WeakHandle<vm_class_loader_data>, mtClass>(table_size, sizeof(ProtectionDomainCacheEntry))
 {   _dead_entries = false;
     _total_oops_removed = 0;
 }
@@ -180,8 +180,8 @@
     protection_domain->print_value_on(&ls);
     ls.cr();
   }
-  ClassLoaderWeakHandle w = ClassLoaderWeakHandle::create(protection_domain);
+  WeakHandle<vm_class_loader_data> w = WeakHandle<vm_class_loader_data>::create(protection_domain);
   ProtectionDomainCacheEntry* p = new_entry(hash, w);
-  Hashtable<ClassLoaderWeakHandle, mtClass>::add_entry(index, p);
+  Hashtable<WeakHandle<vm_class_loader_data>, mtClass>::add_entry(index, p);
   return p;
 }
--- a/src/hotspot/share/classfile/protectionDomainCache.hpp	Thu Apr 04 01:46:14 2019 +0200
+++ b/src/hotspot/share/classfile/protectionDomainCache.hpp	Wed Apr 03 20:39:19 2019 -0400
@@ -35,18 +35,18 @@
 // to dictionary.hpp pd_set for more information about how protection domain entries
 // are used.
 // This table is walked during GC, rather than the class loader data graph dictionaries.
-class ProtectionDomainCacheEntry : public HashtableEntry<ClassLoaderWeakHandle, mtClass> {
+class ProtectionDomainCacheEntry : public HashtableEntry<WeakHandle<vm_class_loader_data>, mtClass> {
   friend class VMStructs;
  public:
   oop object();
   oop object_no_keepalive();
 
   ProtectionDomainCacheEntry* next() {
-    return (ProtectionDomainCacheEntry*)HashtableEntry<ClassLoaderWeakHandle, mtClass>::next();
+    return (ProtectionDomainCacheEntry*)HashtableEntry<WeakHandle<vm_class_loader_data>, mtClass>::next();
   }
 
   ProtectionDomainCacheEntry** next_addr() {
-    return (ProtectionDomainCacheEntry**)HashtableEntry<ClassLoaderWeakHandle, mtClass>::next_addr();
+    return (ProtectionDomainCacheEntry**)HashtableEntry<WeakHandle<vm_class_loader_data>, mtClass>::next_addr();
   }
 
   void verify();
@@ -61,21 +61,21 @@
 // we only need to iterate over this set.
 // The amount of different protection domains used is typically magnitudes smaller
 // than the number of system dictionary entries (loaded classes).
-class ProtectionDomainCacheTable : public Hashtable<ClassLoaderWeakHandle, mtClass> {
+class ProtectionDomainCacheTable : public Hashtable<WeakHandle<vm_class_loader_data>, mtClass> {
   friend class VMStructs;
 private:
   ProtectionDomainCacheEntry* bucket(int i) const {
-    return (ProtectionDomainCacheEntry*) Hashtable<ClassLoaderWeakHandle, mtClass>::bucket(i);
+    return (ProtectionDomainCacheEntry*) Hashtable<WeakHandle<vm_class_loader_data>, mtClass>::bucket(i);
   }
 
   // The following method is not MT-safe and must be done under lock.
   ProtectionDomainCacheEntry** bucket_addr(int i) {
-    return (ProtectionDomainCacheEntry**) Hashtable<ClassLoaderWeakHandle, mtClass>::bucket_addr(i);
+    return (ProtectionDomainCacheEntry**) Hashtable<WeakHandle<vm_class_loader_data>, mtClass>::bucket_addr(i);
   }
 
-  ProtectionDomainCacheEntry* new_entry(unsigned int hash, ClassLoaderWeakHandle protection_domain) {
+  ProtectionDomainCacheEntry* new_entry(unsigned int hash, WeakHandle<vm_class_loader_data> protection_domain) {
     ProtectionDomainCacheEntry* entry = (ProtectionDomainCacheEntry*)
-      Hashtable<ClassLoaderWeakHandle, mtClass>::new_entry(hash, protection_domain);
+      Hashtable<WeakHandle<vm_class_loader_data>, mtClass>::new_entry(hash, protection_domain);
     return entry;
   }
 
--- a/src/hotspot/share/utilities/hashtable.cpp	Thu Apr 04 01:46:14 2019 +0200
+++ b/src/hotspot/share/utilities/hashtable.cpp	Wed Apr 03 20:39:19 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -129,7 +129,7 @@
   }
 }
 
-static int literal_size(ClassLoaderWeakHandle v) {
+static int literal_size(WeakHandle<vm_class_loader_data> v) {
   return literal_size(v.peek());
 }
 
@@ -244,7 +244,7 @@
   l->print();
 }
 
-static void print_literal(ClassLoaderWeakHandle l) {
+static void print_literal(WeakHandle<vm_class_loader_data> l) {
   l.print();
 }
 
@@ -308,15 +308,14 @@
 template class Hashtable<Symbol*, mtSymbol>;
 template class Hashtable<Klass*, mtClass>;
 template class Hashtable<InstanceKlass*, mtClass>;
-template class Hashtable<ClassLoaderWeakHandle, mtClass>;
+template class Hashtable<WeakHandle<vm_class_loader_data>, mtClass>;
 template class Hashtable<Symbol*, mtModule>;
 template class Hashtable<oop, 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 HashtableEntry<WeakHandle<vm_class_loader_data>, mtClass>;
 template class HashtableBucket<mtClass>;
 template class BasicHashtableEntry<mtSymbol>;
 template class BasicHashtableEntry<mtCode>;