Skip to content
Permalink
Browse files
8246837: Rename WeakHandle<vm_class_loader_data> to better reflect it…
…s OopStorage association

Reviewed-by: coleenp
  • Loading branch information
fisk committed Jun 9, 2020
1 parent 6e43cdd commit 9a8ace2c0a6d9b895d493ddfd5af16614230398d
Showing 7 changed files with 26 additions and 22 deletions.
@@ -487,7 +487,7 @@ void ClassLoaderData::add_class(Klass* k, bool publicize /* true */) {
void ClassLoaderData::initialize_holder(Handle loader_or_mirror) {
if (loader_or_mirror() != NULL) {
assert(_holder.is_null(), "never replace holders");
_holder = WeakHandle<vm_class_loader_data>::create(loader_or_mirror);
_holder = WeakHandle<vm_weak_data>::create(loader_or_mirror);
}
}

@@ -109,9 +109,9 @@ class ClassLoaderData : public CHeapObj<mtClass> {

static ClassLoaderData * _the_null_class_loader_data;

WeakHandle<vm_class_loader_data> _holder; // The oop that determines lifetime of this class loader
OopHandle _class_loader; // The instance of java/lang/ClassLoader associated with
// this ClassLoaderData
WeakHandle<vm_weak_data> _holder; // The oop that determines lifetime of this class loader
OopHandle _class_loader; // The instance of java/lang/ClassLoader associated with
// this ClassLoaderData

ClassLoaderMetaspace * volatile _metaspace; // Meta-space where meta-data defined by the
// classes in the class loader are allocated.
@@ -45,7 +45,7 @@ int ProtectionDomainCacheTable::index_for(Handle protection_domain) {
}

ProtectionDomainCacheTable::ProtectionDomainCacheTable(int table_size)
: Hashtable<WeakHandle<vm_class_loader_data>, mtClass>(table_size, sizeof(ProtectionDomainCacheEntry))
: Hashtable<WeakHandle<vm_weak_data>, mtClass>(table_size, sizeof(ProtectionDomainCacheEntry))
{ _dead_entries = false;
_total_oops_removed = 0;
}
@@ -180,8 +180,8 @@ ProtectionDomainCacheEntry* ProtectionDomainCacheTable::add_entry(int index, uns
protection_domain->print_value_on(&ls);
ls.cr();
}
WeakHandle<vm_class_loader_data> w = WeakHandle<vm_class_loader_data>::create(protection_domain);
WeakHandle<vm_weak_data> w = WeakHandle<vm_weak_data>::create(protection_domain);
ProtectionDomainCacheEntry* p = new_entry(hash, w);
Hashtable<WeakHandle<vm_class_loader_data>, mtClass>::add_entry(index, p);
Hashtable<WeakHandle<vm_weak_data>, mtClass>::add_entry(index, p);
return p;
}
@@ -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<WeakHandle<vm_class_loader_data>, mtClass> {
class ProtectionDomainCacheEntry : public HashtableEntry<WeakHandle<vm_weak_data>, mtClass> {
friend class VMStructs;
public:
oop object();
oop object_no_keepalive();

ProtectionDomainCacheEntry* next() {
return (ProtectionDomainCacheEntry*)HashtableEntry<WeakHandle<vm_class_loader_data>, mtClass>::next();
return (ProtectionDomainCacheEntry*)HashtableEntry<WeakHandle<vm_weak_data>, mtClass>::next();
}

ProtectionDomainCacheEntry** next_addr() {
return (ProtectionDomainCacheEntry**)HashtableEntry<WeakHandle<vm_class_loader_data>, mtClass>::next_addr();
return (ProtectionDomainCacheEntry**)HashtableEntry<WeakHandle<vm_weak_data>, mtClass>::next_addr();
}

void verify();
@@ -61,21 +61,21 @@ class ProtectionDomainCacheEntry : public HashtableEntry<WeakHandle<vm_class_loa
// 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<WeakHandle<vm_class_loader_data>, mtClass> {
class ProtectionDomainCacheTable : public Hashtable<WeakHandle<vm_weak_data>, mtClass> {
friend class VMStructs;
private:
ProtectionDomainCacheEntry* bucket(int i) const {
return (ProtectionDomainCacheEntry*) Hashtable<WeakHandle<vm_class_loader_data>, mtClass>::bucket(i);
return (ProtectionDomainCacheEntry*) Hashtable<WeakHandle<vm_weak_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<WeakHandle<vm_class_loader_data>, mtClass>::bucket_addr(i);
return (ProtectionDomainCacheEntry**) Hashtable<WeakHandle<vm_weak_data>, mtClass>::bucket_addr(i);
}

ProtectionDomainCacheEntry* new_entry(unsigned int hash, WeakHandle<vm_class_loader_data> protection_domain) {
ProtectionDomainCacheEntry* new_entry(unsigned int hash, WeakHandle<vm_weak_data> protection_domain) {
ProtectionDomainCacheEntry* entry = (ProtectionDomainCacheEntry*)
Hashtable<WeakHandle<vm_class_loader_data>, mtClass>::new_entry(hash, protection_domain);
Hashtable<WeakHandle<vm_weak_data>, mtClass>::new_entry(hash, protection_domain);
return entry;
}

@@ -31,7 +31,7 @@
#include "utilities/debug.hpp"
#include "utilities/ostream.hpp"

template <> OopStorage* WeakHandle<vm_class_loader_data>::get_storage() {
template <> OopStorage* WeakHandle<vm_weak_data>::get_storage() {
return OopStorageSet::vm_weak();
}

@@ -77,6 +77,6 @@ void WeakHandle<T>::print_on(outputStream* st) const {
}

// Provide instantiation.
template class WeakHandle<vm_class_loader_data>;
template class WeakHandle<vm_weak_data>;
template class WeakHandle<vm_string_table_data>;
template class WeakHandle<vm_resolved_method_table_data>;
@@ -39,7 +39,11 @@ class OopStorage;
// This is the vm version of jweak but has different GC lifetimes and policies,
// depending on the type.

enum WeakHandleType { vm_class_loader_data, vm_string_table_data, vm_resolved_method_table_data };
enum WeakHandleType {
vm_weak_data,
vm_string_table_data,
vm_resolved_method_table_data
};

template <WeakHandleType T>
class WeakHandle {
@@ -128,7 +128,7 @@ static int literal_size(oop obj) {
}
}

static int literal_size(WeakHandle<vm_class_loader_data> v) {
static int literal_size(WeakHandle<vm_weak_data> v) {
return literal_size(v.peek());
}

@@ -223,7 +223,7 @@ template <class T> void print_literal(T l) {
l->print();
}

static void print_literal(WeakHandle<vm_class_loader_data> l) {
static void print_literal(WeakHandle<vm_weak_data> l) {
l.print();
}

@@ -287,14 +287,14 @@ template class Hashtable<ConstantPool*, mtClass>;
template class Hashtable<Symbol*, mtSymbol>;
template class Hashtable<Klass*, mtClass>;
template class Hashtable<InstanceKlass*, mtClass>;
template class Hashtable<WeakHandle<vm_class_loader_data>, mtClass>;
template class Hashtable<WeakHandle<vm_weak_data>, mtClass>;
template class Hashtable<Symbol*, mtModule>;
template class Hashtable<oop, mtSymbol>;
template class Hashtable<Symbol*, mtClass>;
template class HashtableEntry<Symbol*, mtSymbol>;
template class HashtableEntry<Symbol*, mtClass>;
template class HashtableEntry<oop, mtSymbol>;
template class HashtableEntry<WeakHandle<vm_class_loader_data>, mtClass>;
template class HashtableEntry<WeakHandle<vm_weak_data>, mtClass>;
template class HashtableBucket<mtClass>;
template class BasicHashtableEntry<mtSymbol>;
template class BasicHashtableEntry<mtCode>;

0 comments on commit 9a8ace2

Please sign in to comment.