8246340: Move SystemDictionary GC roots into OopStorage

Use vm_global() OopStorage for system dictionary roots

Reviewed-by: eosterlund, lfoltan
This commit is contained in:
Coleen Phillimore 2020-06-05 09:55:31 -04:00
parent 06e47d05b6
commit 498b0e61ed
31 changed files with 149 additions and 167 deletions

View File

@ -33,6 +33,7 @@
#include "memory/metaspaceClosure.hpp"
#include "memory/resourceArea.hpp"
#include "oops/oop.inline.hpp"
#include "oops/oopHandle.inline.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/safepointVerifiers.hpp"
#include "utilities/hashtable.inline.hpp"
@ -400,6 +401,20 @@ void Dictionary::clean_cached_protection_domains() {
}
}
oop SymbolPropertyEntry::method_type() const {
return _method_type.resolve();
}
void SymbolPropertyEntry::set_method_type(oop p) {
_method_type = OopHandle::create(p);
}
void SymbolPropertyEntry::free_entry() {
// decrement Symbol refcount here because hashtable doesn't.
literal()->decrement_refcount();
// Free OopHandle
_method_type.release();
}
SymbolPropertyTable::SymbolPropertyTable(int table_size)
: Hashtable<Symbol*, mtSymbol>(table_size, sizeof(SymbolPropertyEntry))
@ -436,16 +451,6 @@ SymbolPropertyEntry* SymbolPropertyTable::add_entry(int index, unsigned int hash
return p;
}
void SymbolPropertyTable::oops_do(OopClosure* f) {
for (int index = 0; index < table_size(); index++) {
for (SymbolPropertyEntry* p = bucket(index); p != NULL; p = p->next()) {
if (p->method_type() != NULL) {
f->do_oop(p->method_type_addr());
}
}
}
}
void SymbolPropertyTable::methods_do(void f(Method*)) {
for (int index = 0; index < table_size(); index++) {
for (SymbolPropertyEntry* p = bucket(index); p != NULL; p = p->next()) {
@ -457,6 +462,11 @@ void SymbolPropertyTable::methods_do(void f(Method*)) {
}
}
void SymbolPropertyTable::free_entry(SymbolPropertyEntry* entry) {
entry->free_entry();
Hashtable<Symbol*, mtSymbol>::free_entry(entry);
}
void DictionaryEntry::verify_protection_domain_set() {
MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
for (ProtectionDomainEntry* current = pd_set(); // accessed at a safepoint

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@ -29,6 +29,7 @@
#include "classfile/systemDictionary.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/oop.hpp"
#include "oops/oopHandle.hpp"
#include "utilities/hashtable.hpp"
#include "utilities/ostream.hpp"
@ -180,7 +181,7 @@ class SymbolPropertyEntry : public HashtableEntry<Symbol*, mtSymbol> {
private:
intptr_t _symbol_mode; // secondary key
Method* _method;
oop _method_type;
OopHandle _method_type;
public:
Symbol* symbol() const { return literal(); }
@ -191,9 +192,10 @@ class SymbolPropertyEntry : public HashtableEntry<Symbol*, mtSymbol> {
Method* method() const { return _method; }
void set_method(Method* p) { _method = p; }
oop method_type() const { return _method_type; }
oop* method_type_addr() { return &_method_type; }
void set_method_type(oop p) { _method_type = p; }
oop method_type() const;
void set_method_type(oop p);
void free_entry();
SymbolPropertyEntry* next() const {
return (SymbolPropertyEntry*)HashtableEntry<Symbol*, mtSymbol>::next();
@ -253,11 +255,7 @@ public:
SymbolPropertyTable(int table_size);
SymbolPropertyTable(int table_size, HashtableBucket<mtSymbol>* t, int number_of_entries);
void free_entry(SymbolPropertyEntry* entry) {
// decrement Symbol refcount here because hashtable doesn't.
entry->literal()->decrement_refcount();
Hashtable<Symbol*, mtSymbol>::free_entry(entry);
}
void free_entry(SymbolPropertyEntry* entry);
unsigned int compute_hash(Symbol* sym, intptr_t symbol_mode) {
// Use the regular identity_hash.
@ -274,9 +272,6 @@ public:
// must be done under SystemDictionary_lock
SymbolPropertyEntry* add_entry(int index, unsigned int hash, Symbol* name, intptr_t name_mode);
// GC support
void oops_do(OopClosure* f);
void methods_do(void f(Method*));
void verify();

View File

@ -46,8 +46,6 @@
#include "code/codeCache.hpp"
#include "compiler/compileBroker.hpp"
#include "gc/shared/gcTraceTime.inline.hpp"
#include "gc/shared/oopStorage.inline.hpp"
#include "gc/shared/oopStorageSet.hpp"
#include "interpreter/bytecodeStream.hpp"
#include "interpreter/interpreter.hpp"
#include "jfr/jfrEvents.hpp"
@ -68,6 +66,7 @@
#include "oops/objArrayKlass.hpp"
#include "oops/objArrayOop.inline.hpp"
#include "oops/oop.inline.hpp"
#include "oops/oopHandle.inline.hpp"
#include "oops/symbol.hpp"
#include "oops/typeArrayKlass.hpp"
#include "prims/jvmtiExport.hpp"
@ -98,15 +97,15 @@ ResolutionErrorTable* SystemDictionary::_resolution_errors = NULL;
SymbolPropertyTable* SystemDictionary::_invoke_method_table = NULL;
ProtectionDomainCacheTable* SystemDictionary::_pd_cache_table = NULL;
oop SystemDictionary::_system_loader_lock_obj = NULL;
InstanceKlass* SystemDictionary::_well_known_klasses[SystemDictionary::WKID_LIMIT]
= { NULL /*, NULL...*/ };
InstanceKlass* SystemDictionary::_box_klasses[T_VOID+1] = { NULL /*, NULL...*/ };
oop SystemDictionary::_java_system_loader = NULL;
oop SystemDictionary::_java_platform_loader = NULL;
OopHandle SystemDictionary::_system_loader_lock_obj;
OopHandle SystemDictionary::_java_system_loader;
OopHandle SystemDictionary::_java_platform_loader;
// Default ProtectionDomainCacheSize value
@ -155,12 +154,16 @@ ClassLoadInfo::ClassLoadInfo(Handle protection_domain,
// ----------------------------------------------------------------------------
// Java-level SystemLoader and PlatformLoader
oop SystemDictionary::system_loader_lock() {
return _system_loader_lock_obj.resolve();
}
oop SystemDictionary::java_system_loader() {
return _java_system_loader;
return _java_system_loader.resolve();
}
oop SystemDictionary::java_platform_loader() {
return _java_platform_loader;
return _java_platform_loader.resolve();
}
void SystemDictionary::compute_java_loaders(TRAPS) {
@ -172,7 +175,7 @@ void SystemDictionary::compute_java_loaders(TRAPS) {
vmSymbols::void_classloader_signature(),
CHECK);
_java_system_loader = (oop)result.get_jobject();
_java_system_loader = OopHandle::create((oop)result.get_jobject());
JavaCalls::call_static(&result,
class_loader_klass,
@ -180,7 +183,7 @@ void SystemDictionary::compute_java_loaders(TRAPS) {
vmSymbols::void_classloader_signature(),
CHECK);
_java_platform_loader = (oop)result.get_jobject();
_java_platform_loader = OopHandle::create((oop)result.get_jobject());
}
ClassLoaderData* SystemDictionary::register_loader(Handle class_loader, bool create_mirror_cld) {
@ -219,7 +222,7 @@ bool SystemDictionary::is_system_class_loader(oop class_loader) {
return false;
}
return (class_loader->klass() == SystemDictionary::jdk_internal_loader_ClassLoaders_AppClassLoader_klass() ||
class_loader == _java_system_loader);
class_loader == _java_system_loader.peek());
}
// Returns true if the passed class loader is the platform class loader.
@ -603,7 +606,8 @@ void SystemDictionary::double_lock_wait(Handle lockObject, TRAPS) {
bool calledholdinglock
= ObjectSynchronizer::current_thread_holds_lock((JavaThread*)THREAD, lockObject);
assert(calledholdinglock,"must hold lock for notify");
assert((lockObject() != _system_loader_lock_obj && !is_parallelCapable(lockObject)), "unexpected double_lock_wait");
assert((lockObject() != _system_loader_lock_obj.resolve() &&
!is_parallelCapable(lockObject)), "unexpected double_lock_wait");
ObjectSynchronizer::notifyall(lockObject, THREAD);
intx recursions = ObjectSynchronizer::complete_exit(lockObject, THREAD);
SystemDictionary_lock->wait();
@ -1820,7 +1824,7 @@ InstanceKlass* SystemDictionary::find_or_define_instance_class(Symbol* class_nam
Handle SystemDictionary::compute_loader_lock_object(Handle class_loader, TRAPS) {
// If class_loader is NULL we synchronize on _system_loader_lock_obj
if (class_loader.is_null()) {
return Handle(THREAD, _system_loader_lock_obj);
return Handle(THREAD, _system_loader_lock_obj.resolve());
} else {
return class_loader;
}
@ -1841,7 +1845,7 @@ void SystemDictionary::check_loader_lock_contention(Handle loader_lock, TRAPS) {
== ObjectSynchronizer::owner_other) {
// contention will likely happen, so increment the corresponding
// contention counter.
if (loader_lock() == _system_loader_lock_obj) {
if (loader_lock() == _system_loader_lock_obj.resolve()) {
ClassLoader::sync_systemLoaderLockContentionRate()->inc();
} else {
ClassLoader::sync_nonSystemLoaderLockContentionRate()->inc();
@ -1958,20 +1962,6 @@ bool SystemDictionary::do_unloading(GCTimer* gc_timer) {
return unloading_occurred;
}
void SystemDictionary::oops_do(OopClosure* f, bool include_handles) {
f->do_oop(&_java_system_loader);
f->do_oop(&_java_platform_loader);
f->do_oop(&_system_loader_lock_obj);
CDS_ONLY(SystemDictionaryShared::oops_do(f);)
// Visit extra methods
invoke_method_table()->oops_do(f);
if (include_handles) {
OopStorageSet::vm_global()->oops_do(f);
}
}
// CDS: scan and relocate all classes referenced by _well_known_klasses[].
void SystemDictionary::well_known_klasses_do(MetaspaceClosure* it) {
for (int id = FIRST_WKID; id < WKID_LIMIT; id++) {
@ -1999,7 +1989,9 @@ void SystemDictionary::initialize(TRAPS) {
_pd_cache_table = new ProtectionDomainCacheTable(defaultProtectionDomainCacheSize);
// Allocate private object used as system class loader lock
_system_loader_lock_obj = oopFactory::new_intArray(0, CHECK);
oop lock_obj = oopFactory::new_intArray(0, CHECK);
_system_loader_lock_obj = OopHandle::create(lock_obj);
// Initialize basic classes
resolve_well_known_classes(CHECK);
}

View File

@ -27,6 +27,7 @@
#include "classfile/classLoaderData.hpp"
#include "oops/objArrayOop.hpp"
#include "oops/oopHandle.hpp"
#include "oops/symbol.hpp"
#include "runtime/java.hpp"
#include "runtime/mutexLocker.hpp"
@ -381,13 +382,8 @@ public:
// loaders. Returns "true" iff something was unloaded.
static bool do_unloading(GCTimer* gc_timer);
// Applies "f->do_oop" to all root oops in the system dictionary.
// If include_handles is true (the default), then the handles in the
// vm_global OopStorage object are included.
static void oops_do(OopClosure* f, bool include_handles = true);
// System loader lock
static oop system_loader_lock() { return _system_loader_lock_obj; }
static oop system_loader_lock();
// Protection Domain Table
static ProtectionDomainCacheTable* pd_cache_table() { return _pd_cache_table; }
@ -585,7 +581,7 @@ public:
static PlaceholderTable* _placeholders;
// Lock object for system class loader
static oop _system_loader_lock_obj;
static OopHandle _system_loader_lock_obj;
// Constraints on class loaders
static LoaderConstraintTable* _loader_constraints;
@ -703,8 +699,8 @@ protected:
static InstanceKlass* _box_klasses[T_VOID+1];
private:
static oop _java_system_loader;
static oop _java_platform_loader;
static OopHandle _java_system_loader;
static OopHandle _java_platform_loader;
public:
static TableStatistics placeholders_statistics();

View File

@ -61,9 +61,9 @@
#include "utilities/stringUtils.hpp"
objArrayOop SystemDictionaryShared::_shared_protection_domains = NULL;
objArrayOop SystemDictionaryShared::_shared_jar_urls = NULL;
objArrayOop SystemDictionaryShared::_shared_jar_manifests = NULL;
OopHandle SystemDictionaryShared::_shared_protection_domains = NULL;
OopHandle SystemDictionaryShared::_shared_jar_urls = NULL;
OopHandle SystemDictionaryShared::_shared_jar_manifests = NULL;
DEBUG_ONLY(bool SystemDictionaryShared::_no_class_loading_should_happen = false;)
class DumpTimeSharedClassInfo: public CHeapObj<mtClass> {
@ -460,15 +460,15 @@ static RunTimeSharedDictionary _dynamic_builtin_dictionary;
static RunTimeSharedDictionary _dynamic_unregistered_dictionary;
oop SystemDictionaryShared::shared_protection_domain(int index) {
return _shared_protection_domains->obj_at(index);
return ((objArrayOop)_shared_protection_domains.resolve())->obj_at(index);
}
oop SystemDictionaryShared::shared_jar_url(int index) {
return _shared_jar_urls->obj_at(index);
return ((objArrayOop)_shared_jar_urls.resolve())->obj_at(index);
}
oop SystemDictionaryShared::shared_jar_manifest(int index) {
return _shared_jar_manifests->obj_at(index);
return ((objArrayOop)_shared_jar_manifests.resolve())->obj_at(index);
}
Handle SystemDictionaryShared::get_shared_jar_manifest(int shared_path_index, TRAPS) {
@ -926,30 +926,27 @@ InstanceKlass* SystemDictionaryShared::load_shared_class_for_builtin_loader(
return NULL;
}
void SystemDictionaryShared::oops_do(OopClosure* f) {
f->do_oop((oop*)&_shared_protection_domains);
f->do_oop((oop*)&_shared_jar_urls);
f->do_oop((oop*)&_shared_jar_manifests);
}
void SystemDictionaryShared::allocate_shared_protection_domain_array(int size, TRAPS) {
if (_shared_protection_domains == NULL) {
_shared_protection_domains = oopFactory::new_objArray(
if (_shared_protection_domains.resolve() == NULL) {
oop spd = oopFactory::new_objArray(
SystemDictionary::ProtectionDomain_klass(), size, CHECK);
_shared_protection_domains = OopHandle::create(spd);
}
}
void SystemDictionaryShared::allocate_shared_jar_url_array(int size, TRAPS) {
if (_shared_jar_urls == NULL) {
_shared_jar_urls = oopFactory::new_objArray(
if (_shared_jar_urls.resolve() == NULL) {
oop sju = oopFactory::new_objArray(
SystemDictionary::URL_klass(), size, CHECK);
_shared_jar_urls = OopHandle::create(sju);
}
}
void SystemDictionaryShared::allocate_shared_jar_manifest_array(int size, TRAPS) {
if (_shared_jar_manifests == NULL) {
_shared_jar_manifests = oopFactory::new_objArray(
if (_shared_jar_manifests.resolve() == NULL) {
oop sjm = oopFactory::new_objArray(
SystemDictionary::Jar_Manifest_klass(), size, CHECK);
_shared_jar_manifests = OopHandle::create(sjm);
}
}

View File

@ -122,9 +122,9 @@ private:
// java.security.ProtectionDomain objects associated with each shared class.
//
// See SystemDictionaryShared::init_security_info for more info.
static objArrayOop _shared_protection_domains;
static objArrayOop _shared_jar_urls;
static objArrayOop _shared_jar_manifests;
static OopHandle _shared_protection_domains;
static OopHandle _shared_jar_urls;
static OopHandle _shared_jar_manifests;
static InstanceKlass* load_shared_class_for_builtin_loader(
Symbol* class_name,
@ -180,12 +180,12 @@ private:
ModuleEntry* mod, TRAPS);
static Handle init_security_info(Handle class_loader, InstanceKlass* ik, PackageEntry* pkg_entry, TRAPS);
static void atomic_set_array_index(objArrayOop array, int index, oop o) {
static void atomic_set_array_index(OopHandle array, int index, oop o) {
// Benign race condition: array.obj_at(index) may already be filled in.
// The important thing here is that all threads pick up the same result.
// It doesn't matter which racing thread wins, as long as only one
// result is used by all threads, and all future queries.
array->atomic_compare_exchange_oop(index, o, NULL);
((objArrayOop)array.resolve())->atomic_compare_exchange_oop(index, o, NULL);
}
static oop shared_protection_domain(int index);
@ -235,7 +235,6 @@ public:
static void allocate_shared_data_arrays(int size, TRAPS);
static void oops_do(OopClosure* f);
// Check if sharing is supported for the class loader.
static bool is_sharing_possible(ClassLoaderData* loader_data);

View File

@ -62,7 +62,7 @@ G1GCPhaseTimes::G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads) :
_gc_par_phases[JNIRoots] = new WorkerDataArray<double>("JNI Handles Roots (ms):", max_gc_threads);
_gc_par_phases[ObjectSynchronizerRoots] = new WorkerDataArray<double>("ObjectSynchronizer Roots (ms):", max_gc_threads);
_gc_par_phases[ManagementRoots] = new WorkerDataArray<double>("Management Roots (ms):", max_gc_threads);
_gc_par_phases[SystemDictionaryRoots] = new WorkerDataArray<double>("SystemDictionary Roots (ms):", max_gc_threads);
_gc_par_phases[VMGlobalRoots] = new WorkerDataArray<double>("VM Global Roots (ms):", max_gc_threads);
_gc_par_phases[CLDGRoots] = new WorkerDataArray<double>("CLDG Roots (ms):", max_gc_threads);
_gc_par_phases[JVMTIRoots] = new WorkerDataArray<double>("JVMTI Roots (ms):", max_gc_threads);
AOT_ONLY(_gc_par_phases[AOTCodeRoots] = new WorkerDataArray<double>("AOT Root Scan (ms):", max_gc_threads);)
@ -561,7 +561,7 @@ const char* G1GCPhaseTimes::phase_name(GCParPhases phase) {
"JNIRoots",
"ObjectSynchronizerRoots",
"ManagementRoots",
"SystemDictionaryRoots",
"VMGlobalRoots",
"CLDGRoots",
"JVMTIRoots",
AOT_ONLY("AOTCodeRoots" COMMA)

View File

@ -51,7 +51,7 @@ class G1GCPhaseTimes : public CHeapObj<mtGC> {
JNIRoots,
ObjectSynchronizerRoots,
ManagementRoots,
SystemDictionaryRoots,
VMGlobalRoots,
CLDGRoots,
JVMTIRoots,
AOT_ONLY(AOTCodeRoots COMMA)

View File

@ -26,7 +26,6 @@
#include "aot/aotLoader.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/stringTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "code/codeCache.hpp"
#include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1CodeBlobClosure.hpp"
@ -39,6 +38,8 @@
#include "gc/g1/g1RootClosures.hpp"
#include "gc/g1/g1RootProcessor.hpp"
#include "gc/g1/heapRegion.inline.hpp"
#include "gc/shared/oopStorage.inline.hpp"
#include "gc/shared/oopStorageSet.hpp"
#include "gc/shared/referenceProcessor.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/universe.hpp"
@ -225,9 +226,9 @@ void G1RootProcessor::process_vm_roots(G1RootClosures* closures,
#endif
{
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_id);
if (_process_strong_tasks.try_claim_task(G1RP_PS_SystemDictionary_oops_do)) {
SystemDictionary::oops_do(strong_roots);
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::VMGlobalRoots, worker_id);
if (_process_strong_tasks.try_claim_task(G1RP_PS_VMGlobal_oops_do)) {
OopStorageSet::vm_global()->oops_do(strong_roots);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -55,7 +55,7 @@ class G1RootProcessor : public StackObj {
G1RP_PS_JNIHandles_oops_do,
G1RP_PS_ObjectSynchronizer_oops_do,
G1RP_PS_Management_oops_do,
G1RP_PS_SystemDictionary_oops_do,
G1RP_PS_VMGlobal_oops_do,
G1RP_PS_ClassLoaderDataGraph_oops_do,
G1RP_PS_jvmti_oops_do,
G1RP_PS_CodeCache_oops_do,

View File

@ -49,6 +49,8 @@
#include "gc/shared/gcTrace.hpp"
#include "gc/shared/gcTraceTime.inline.hpp"
#include "gc/shared/isGCActiveMark.hpp"
#include "gc/shared/oopStorage.inline.hpp"
#include "gc/shared/oopStorageSet.hpp"
#include "gc/shared/referencePolicy.hpp"
#include "gc/shared/referenceProcessor.hpp"
#include "gc/shared/referenceProcessorPhaseTimes.hpp"
@ -2029,8 +2031,8 @@ static void mark_from_roots_work(ParallelRootType::Value root_type, uint worker_
JvmtiExport::oops_do(&mark_and_push_closure);
break;
case ParallelRootType::system_dictionary:
SystemDictionary::oops_do(&mark_and_push_closure);
case ParallelRootType::vm_global:
OopStorageSet::vm_global()->oops_do(&mark_and_push_closure);
break;
case ParallelRootType::class_loader_data:
@ -2238,7 +2240,7 @@ void PSParallelCompact::adjust_roots(ParCompactionManager* cm) {
ObjectSynchronizer::oops_do(&oop_closure);
Management::oops_do(&oop_closure);
JvmtiExport::oops_do(&oop_closure);
SystemDictionary::oops_do(&oop_closure);
OopStorageSet::vm_global()->oops_do(&oop_closure);
CLDToOopClosure cld_closure(&oop_closure, ClassLoaderData::_claim_strong);
ClassLoaderDataGraph::cld_do(&cld_closure);

View File

@ -38,7 +38,7 @@ public:
jni_handles,
object_synchronizer,
management,
system_dictionary,
vm_global,
class_loader_data,
jvmti,
code_cache,

View File

@ -43,6 +43,8 @@
#include "gc/shared/gcTrace.hpp"
#include "gc/shared/gcTraceTime.inline.hpp"
#include "gc/shared/isGCActiveMark.hpp"
#include "gc/shared/oopStorage.inline.hpp"
#include "gc/shared/oopStorageSet.hpp"
#include "gc/shared/referencePolicy.hpp"
#include "gc/shared/referenceProcessor.hpp"
#include "gc/shared/referenceProcessorPhaseTimes.hpp"
@ -102,8 +104,8 @@ static void scavenge_roots_work(ParallelRootType::Value root_type, uint worker_i
ObjectSynchronizer::oops_do(&roots_closure);
break;
case ParallelRootType::system_dictionary:
SystemDictionary::oops_do(&roots_closure);
case ParallelRootType::vm_global:
OopStorageSet::vm_global()->oops_do(&roots_closure);
break;
case ParallelRootType::class_loader_data:

View File

@ -27,7 +27,6 @@
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/stringTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "code/codeCache.hpp"
#include "code/icBuffer.hpp"
@ -49,6 +48,8 @@
#include "gc/shared/generationSpec.hpp"
#include "gc/shared/gcInitLogger.hpp"
#include "gc/shared/locationPrinter.inline.hpp"
#include "gc/shared/oopStorage.inline.hpp"
#include "gc/shared/oopStorageSet.hpp"
#include "gc/shared/oopStorageParState.inline.hpp"
#include "gc/shared/scavengableNMethods.hpp"
#include "gc/shared/space.hpp"
@ -843,8 +844,8 @@ void GenCollectedHeap::process_roots(StrongRootsScope* scope,
AOTLoader::oops_do(strong_roots);
}
#endif
if (_process_strong_tasks->try_claim_task(GCH_PS_SystemDictionary_oops_do)) {
SystemDictionary::oops_do(strong_roots);
if (_process_strong_tasks->try_claim_task(GCH_PS_VMGlobal_oops_do)) {
OopStorageSet::vm_global()->oops_do(strong_roots);
}
if (_process_strong_tasks->try_claim_task(GCH_PS_CodeCache_oops_do)) {

View File

@ -110,7 +110,7 @@ protected:
GCH_PS_ObjectSynchronizer_oops_do,
GCH_PS_FlatProfiler_oops_do,
GCH_PS_Management_oops_do,
GCH_PS_SystemDictionary_oops_do,
GCH_PS_VMGlobal_oops_do,
GCH_PS_ClassLoaderDataGraph_oops_do,
GCH_PS_jvmti_oops_do,
GCH_PS_CodeCache_oops_do,

View File

@ -48,7 +48,6 @@ class outputStream;
f(CNT_PREFIX ## VMWeakRoots, DESC_PREFIX "VM Weak Roots") \
f(CNT_PREFIX ## ObjectSynchronizerRoots, DESC_PREFIX "Synchronizer Roots") \
f(CNT_PREFIX ## ManagementRoots, DESC_PREFIX "Management Roots") \
f(CNT_PREFIX ## SystemDictionaryRoots, DESC_PREFIX "System Dict Roots") \
f(CNT_PREFIX ## CLDGRoots, DESC_PREFIX "CLDG Roots") \
f(CNT_PREFIX ## JVMTIRoots, DESC_PREFIX "JVMTI Roots") \
f(CNT_PREFIX ## StringDedupTableRoots, DESC_PREFIX "Dedup Table Roots") \

View File

@ -26,7 +26,6 @@
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/stringTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "code/codeCache.hpp"
#include "code/nmethod.hpp"
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
@ -55,16 +54,10 @@ void ShenandoahSerialRoot::oops_do(OopClosure* cl, uint worker_id) {
}
}
// Overwrite the second argument for SD::oops_do, don't include vm global oop storage.
static void system_dictionary_oops_do(OopClosure* cl) {
SystemDictionary::oops_do(cl, false);
}
ShenandoahSerialRoots::ShenandoahSerialRoots(ShenandoahPhaseTimings::Phase phase) :
_universe_root(&Universe::oops_do, phase, ShenandoahPhaseTimings::UniverseRoots),
_object_synchronizer_root(&ObjectSynchronizer::oops_do, phase, ShenandoahPhaseTimings::ObjectSynchronizerRoots),
_management_root(&Management::oops_do, phase, ShenandoahPhaseTimings::ManagementRoots),
_system_dictionary_root(&system_dictionary_oops_do, phase, ShenandoahPhaseTimings::SystemDictionaryRoots),
_jvmti_root(&JvmtiExport::oops_do, phase, ShenandoahPhaseTimings::JVMTIRoots) {
}
@ -72,7 +65,6 @@ void ShenandoahSerialRoots::oops_do(OopClosure* cl, uint worker_id) {
_universe_root.oops_do(cl, worker_id);
_object_synchronizer_root.oops_do(cl, worker_id);
_management_root.oops_do(cl, worker_id);
_system_dictionary_root.oops_do(cl, worker_id);
_jvmti_root.oops_do(cl, worker_id);
}

View File

@ -54,7 +54,6 @@ private:
ShenandoahSerialRoot _universe_root;
ShenandoahSerialRoot _object_synchronizer_root;
ShenandoahSerialRoot _management_root;
ShenandoahSerialRoot _system_dictionary_root;
ShenandoahSerialRoot _jvmti_root;
public:
ShenandoahSerialRoots(ShenandoahPhaseTimings::Phase phase);

View File

@ -27,7 +27,6 @@
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/systemDictionary.hpp"
#include "code/codeCache.hpp"
#include "gc/shenandoah/shenandoahAsserts.hpp"
#include "gc/shenandoah/shenandoahHeap.hpp"
@ -35,6 +34,8 @@
#include "gc/shenandoah/shenandoahRootVerifier.hpp"
#include "gc/shenandoah/shenandoahStringDedup.hpp"
#include "gc/shenandoah/shenandoahUtils.hpp"
#include "gc/shared/oopStorage.inline.hpp"
#include "gc/shared/oopStorageSet.hpp"
#include "gc/shared/weakProcessor.inline.hpp"
#include "memory/universe.hpp"
#include "runtime/thread.hpp"
@ -78,12 +79,12 @@ void ShenandoahRootVerifier::oops_do(OopClosure* oops) {
Management::oops_do(oops);
JvmtiExport::oops_do(oops);
ObjectSynchronizer::oops_do(oops);
SystemDictionary::oops_do(oops);
}
if (verify(JNIHandleRoots)) {
shenandoah_assert_safepoint();
JNIHandles::oops_do(oops);
OopStorageSet::vm_global()->oops_do(oops);
}
if (verify(WeakRoots)) {
@ -125,7 +126,7 @@ void ShenandoahRootVerifier::roots_do(OopClosure* oops) {
JvmtiExport::oops_do(oops);
JNIHandles::oops_do(oops);
ObjectSynchronizer::oops_do(oops);
SystemDictionary::oops_do(oops);
OopStorageSet::vm_global()->oops_do(oops);
AlwaysTrueClosure always_true;
WeakProcessor::weak_oops_do(&always_true, oops);
@ -153,7 +154,7 @@ void ShenandoahRootVerifier::strong_roots_do(OopClosure* oops) {
JvmtiExport::oops_do(oops);
JNIHandles::oops_do(oops);
ObjectSynchronizer::oops_do(oops);
SystemDictionary::oops_do(oops);
OopStorageSet::vm_global()->oops_do(oops);
// Do thread roots the last. This allows verification code to find
// any broken objects from those special roots first, not the accidental

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -24,7 +24,6 @@
#include "precompiled.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/stringTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "code/codeCache.hpp"
#include "compiler/oopMap.hpp"
#include "gc/shared/barrierSet.hpp"
@ -63,7 +62,6 @@ static const ZStatSubPhase ZSubPhasePauseRootsObjectSynchronizer("Pause Roots Ob
static const ZStatSubPhase ZSubPhasePauseRootsManagement("Pause Roots Management");
static const ZStatSubPhase ZSubPhasePauseRootsJVMTIExport("Pause Roots JVMTIExport");
static const ZStatSubPhase ZSubPhasePauseRootsJVMTIWeakExport("Pause Roots JVMTIWeakExport");
static const ZStatSubPhase ZSubPhasePauseRootsSystemDictionary("Pause Roots SystemDictionary");
static const ZStatSubPhase ZSubPhasePauseRootsVMThread("Pause Roots VM Thread");
static const ZStatSubPhase ZSubPhasePauseRootsJavaThreads("Pause Roots Java Threads");
static const ZStatSubPhase ZSubPhasePauseRootsCodeCache("Pause Roots CodeCache");
@ -202,7 +200,6 @@ ZRootsIterator::ZRootsIterator(bool visit_jvmti_weak_export) :
_management(this),
_jvmti_export(this),
_jvmti_weak_export(this),
_system_dictionary(this),
_vm_thread(this),
_java_threads(this),
_code_cache(this) {
@ -254,12 +251,6 @@ void ZRootsIterator::do_jvmti_weak_export(ZRootsIteratorClosure* cl) {
JvmtiExport::weak_oops_do(&always_alive, cl);
}
void ZRootsIterator::do_system_dictionary(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhasePauseRootsSystemDictionary);
// Handles are processed via _vm_handles.
SystemDictionary::oops_do(cl, false /* include_handles */);
}
void ZRootsIterator::do_vm_thread(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhasePauseRootsVMThread);
ZRootsIteratorThreadClosure thread_cl(cl);
@ -283,7 +274,6 @@ void ZRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
_object_synchronizer.oops_do(cl);
_management.oops_do(cl);
_jvmti_export.oops_do(cl);
_system_dictionary.oops_do(cl);
_vm_thread.oops_do(cl);
_java_threads.oops_do(cl);
if (!ClassUnloading) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -112,7 +112,6 @@ private:
void do_management(ZRootsIteratorClosure* cl);
void do_jvmti_export(ZRootsIteratorClosure* cl);
void do_jvmti_weak_export(ZRootsIteratorClosure* cl);
void do_system_dictionary(ZRootsIteratorClosure* cl);
void do_vm_thread(ZRootsIteratorClosure* cl);
void do_java_threads(ZRootsIteratorClosure* cl);
void do_code_cache(ZRootsIteratorClosure* cl);
@ -122,7 +121,6 @@ private:
ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_management> _management;
ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_export> _jvmti_export;
ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_weak_export> _jvmti_weak_export;
ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_system_dictionary> _system_dictionary;
ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_vm_thread> _vm_thread;
ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_java_threads> _java_threads;
ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_code_cache> _code_cache;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, 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
@ -26,7 +26,8 @@
#include "aot/aotLoader.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/stringTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "gc/shared/oopStorage.inline.hpp"
#include "gc/shared/oopStorageSet.hpp"
#include "gc/shared/strongRootsScope.hpp"
#include "jfr/leakprofiler/chains/bfsClosure.hpp"
#include "jfr/leakprofiler/chains/dfsClosure.hpp"
@ -77,7 +78,7 @@ void RootSetClosure<Delegate>::process() {
Universe::oops_do(this);
JNIHandles::oops_do(this);
JvmtiExport::oops_do(this);
SystemDictionary::oops_do(this);
OopStorageSet::vm_global()->oops_do(this);
Management::oops_do(this);
AOTLoader::oops_do(this);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, 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
@ -26,6 +26,8 @@
#include "aot/aotLoader.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/stringTable.hpp"
#include "gc/shared/oopStorage.inline.hpp"
#include "gc/shared/oopStorageSet.hpp"
#include "gc/shared/strongRootsScope.hpp"
#include "jfr/leakprofiler/utilities/unifiedOopRef.inline.hpp"
#include "jfr/leakprofiler/checkpoint/rootResolver.hpp"
@ -98,7 +100,7 @@ class ReferenceToRootClosure : public StackObj {
bool do_universe_roots();
bool do_jni_handle_roots();
bool do_jvmti_roots();
bool do_system_dictionary_roots();
bool do_vm_global_roots();
bool do_management_roots();
bool do_string_table_roots();
bool do_aot_loader_roots();
@ -160,10 +162,10 @@ bool ReferenceToRootClosure::do_jvmti_roots() {
return rlc.complete();
}
bool ReferenceToRootClosure::do_system_dictionary_roots() {
bool ReferenceToRootClosure::do_vm_global_roots() {
assert(!complete(), "invariant");
ReferenceLocateClosure rlc(_callback, OldObjectRoot::_system_dictionary, OldObjectRoot::_type_undetermined, NULL);
SystemDictionary::oops_do(&rlc);
ReferenceLocateClosure rlc(_callback, OldObjectRoot::_vm_global, OldObjectRoot::_type_undetermined, NULL);
OopStorageSet::vm_global()->oops_do(&rlc);
return rlc.complete();
}
@ -211,7 +213,7 @@ bool ReferenceToRootClosure::do_roots() {
return true;
}
if (do_system_dictionary_roots()) {
if (do_vm_global_roots()) {
_complete = true;
return true;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020, 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
@ -36,7 +36,7 @@ class OldObjectRoot : public AllStatic {
_global_jni_handles,
_threads,
_object_synchronizer,
_system_dictionary,
_vm_global,
_class_loader_data,
_management,
_jvmti,
@ -67,8 +67,8 @@ class OldObjectRoot : public AllStatic {
return "Threads";
case _object_synchronizer:
return "Object Monitor";
case _system_dictionary:
return "System Dictionary";
case _vm_global:
return "VM Global";
case _class_loader_data:
return "Class Loader Data";
case _management:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020, 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
@ -44,9 +44,13 @@ public:
OopHandle() : _obj(NULL) {}
OopHandle(oop* w) : _obj(w) {}
inline static OopHandle create(oop obj);
inline oop resolve() const;
inline oop peek() const;
inline void release();
// Used only for removing handle.
oop* ptr_raw() const { return _obj; }
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020, 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
@ -27,6 +27,8 @@
#include "oops/access.inline.hpp"
#include "oops/oopHandle.hpp"
#include "gc/shared/oopStorage.inline.hpp"
#include "gc/shared/oopStorageSet.hpp"
inline oop OopHandle::resolve() const {
return (_obj == NULL) ? (oop)NULL : NativeAccess<>::oop_load(_obj);
@ -36,4 +38,21 @@ inline oop OopHandle::peek() const {
return (_obj == NULL) ? (oop)NULL : NativeAccess<AS_NO_KEEPALIVE>::oop_load(_obj);
}
// Allocate a global handle and return
inline OopHandle OopHandle::create(oop obj) {
oop* handle = OopStorageSet::vm_global()->allocate();
if (handle == NULL) {
vm_exit_out_of_memory(sizeof(oop), OOM_MALLOC_ERROR,
"Cannot create oop handle");
}
NativeAccess<>::oop_store(handle, obj);
return OopHandle(handle);
}
inline void OopHandle::release() {
// Clear the OopHandle first
NativeAccess<>::oop_store(_obj, (oop)NULL);
OopStorageSet::vm_global()->release(_obj);
}
#endif // SHARE_OOPS_OOPHANDLE_INLINE_HPP

View File

@ -2582,14 +2582,6 @@ class SimpleRootsClosure : public OopClosure {
assert(Universe::heap()->is_in(o), "should be impossible");
jvmtiHeapReferenceKind kind = root_kind();
if (kind == JVMTI_HEAP_REFERENCE_SYSTEM_CLASS) {
// SystemDictionary::oops_do reports the application
// class loader as a root. We want this root to be reported as
// a root kind of "OTHER" rather than "SYSTEM_CLASS".
if (!o->is_instance() || !InstanceKlass::cast(o->klass())->is_mirror_instance_klass()) {
kind = JVMTI_HEAP_REFERENCE_OTHER;
}
}
// invoke the callback
_continue = CallbackInvoker::report_simple_root(kind, o);
@ -3021,7 +3013,6 @@ inline bool VM_HeapWalkOperation::collect_simple_roots() {
// Preloaded classes and loader from the system dictionary
blk.set_kind(JVMTI_HEAP_REFERENCE_SYSTEM_CLASS);
SystemDictionary::oops_do(&blk);
CLDToOopClosure cld_closure(&blk, false);
ClassLoaderDataGraph::always_strong_cld_do(&cld_closure);
if (blk.stopped()) {

View File

@ -470,7 +470,6 @@ typedef HashtableEntry<InstanceKlass*, mtClass> KlassHashtableEntry;
/* SystemDictionary */ \
/********************/ \
\
static_field(SystemDictionary, _system_loader_lock_obj, oop) \
static_field(SystemDictionary, WK_KLASS(Object_klass), InstanceKlass*) \
static_field(SystemDictionary, WK_KLASS(String_klass), InstanceKlass*) \
static_field(SystemDictionary, WK_KLASS(Class_klass), InstanceKlass*) \
@ -479,7 +478,6 @@ typedef HashtableEntry<InstanceKlass*, mtClass> KlassHashtableEntry;
static_field(SystemDictionary, WK_KLASS(Thread_klass), InstanceKlass*) \
static_field(SystemDictionary, WK_KLASS(ThreadGroup_klass), InstanceKlass*) \
static_field(SystemDictionary, WK_KLASS(MethodHandle_klass), InstanceKlass*) \
static_field(SystemDictionary, _java_system_loader, oop) \
\
/*************/ \
/* vmSymbols */ \

View File

@ -34,7 +34,6 @@ import sun.jvm.hotspot.utilities.Observable;
import sun.jvm.hotspot.utilities.Observer;
public class SystemDictionary {
private static sun.jvm.hotspot.types.OopField javaSystemLoaderField;
private static AddressField objectKlassField;
private static AddressField classLoaderKlassField;
@ -55,8 +54,6 @@ public class SystemDictionary {
private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("SystemDictionary");
javaSystemLoaderField = type.getOopField("_java_system_loader");
objectKlassField = type.getAddressField(WK_KLASS("Object_klass"));
classLoaderKlassField = type.getAddressField(WK_KLASS("ClassLoader_klass"));
stringKlassField = type.getAddressField(WK_KLASS("String_klass"));
@ -111,10 +108,6 @@ public class SystemDictionary {
return (InstanceKlass) cldg.find("java/util/concurrent/locks/AbstractOwnableSynchronizer");
}
public static Oop javaSystemLoader() {
return newOop(javaSystemLoaderField.getValue());
}
private static Oop newOop(OopHandle handle) {
return VM.getVM().getObjectHeap().newOop(handle);
}

View File

@ -126,7 +126,7 @@ public class TestGCLogMessages {
new LogMessageWithLevel("JNI Handles Roots", Level.TRACE),
new LogMessageWithLevel("ObjectSynchronizer Roots", Level.TRACE),
new LogMessageWithLevel("Management Roots", Level.TRACE),
new LogMessageWithLevel("SystemDictionary Roots", Level.TRACE),
new LogMessageWithLevel("VM Global Roots", Level.TRACE),
new LogMessageWithLevel("CLDG Roots", Level.TRACE),
new LogMessageWithLevel("JVMTI Roots", Level.TRACE),
new LogMessageWithLevel("CM RefProcessor Roots", Level.TRACE),

View File

@ -95,7 +95,7 @@ public class TestG1ParallelPhases {
"JNIRoots",
"ObjectSynchronizerRoots",
"ManagementRoots",
"SystemDictionaryRoots",
"VMGlobalRoots",
"CLDGRoots",
"JVMTIRoots",
"CMRefRoots",