Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8251560: Remove excessive header file inclusion from systemDictionary…
….hpp and others

Reviewed-by: coleenp
  • Loading branch information
iklam committed Aug 31, 2020
1 parent d4ef7fa commit 208b1206fe40045ddd551f2a1018018b2ef29f7f
Showing with 187 additions and 141 deletions.
  1. +1 −0 src/hotspot/share/aot/aotCodeHeap.cpp
  2. +1 −0 src/hotspot/share/ci/ciField.cpp
  3. +1 −0 src/hotspot/share/ci/ciReplay.cpp
  4. +1 −0 src/hotspot/share/classfile/classFileParser.cpp
  5. +1 −0 src/hotspot/share/classfile/classListParser.cpp
  6. +99 −0 src/hotspot/share/classfile/classLoadInfo.hpp
  7. +1 −0 src/hotspot/share/classfile/classLoader.cpp
  8. +1 −0 src/hotspot/share/classfile/classLoaderExt.cpp
  9. +18 −0 src/hotspot/share/classfile/dictionary.cpp
  10. +2 −19 src/hotspot/share/classfile/dictionary.hpp
  11. +1 −0 src/hotspot/share/classfile/javaClasses.cpp
  12. +1 −0 src/hotspot/share/classfile/javaClasses.hpp
  13. +1 −0 src/hotspot/share/classfile/klassFactory.cpp
  14. +18 −40 src/hotspot/share/classfile/systemDictionary.cpp
  15. +10 −68 src/hotspot/share/classfile/systemDictionary.hpp
  16. +1 −1 src/hotspot/share/classfile/systemDictionaryShared.hpp
  17. +2 −1 src/hotspot/share/gc/g1/g1Arguments.cpp
  18. +1 −0 src/hotspot/share/gc/g1/g1CollectedHeap.cpp
  19. +2 −1 src/hotspot/share/gc/parallel/mutableNUMASpace.cpp
  20. +1 −0 src/hotspot/share/gc/parallel/psParallelCompact.cpp
  21. +1 −0 src/hotspot/share/gc/shared/gcVMOperations.cpp
  22. +1 −0 src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp
  23. +1 −0 src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
  24. +2 −1 src/hotspot/share/jvmci/jvmciJavaClasses.cpp
  25. +2 −0 src/hotspot/share/jvmci/jvmciRuntime.cpp
  26. +1 −0 src/hotspot/share/memory/virtualspace.cpp
  27. +1 −0 src/hotspot/share/oops/instanceKlass.cpp
  28. +1 −3 src/hotspot/share/oops/klass.inline.hpp
  29. +1 −0 src/hotspot/share/prims/jvm.cpp
  30. +2 −1 src/hotspot/share/prims/jvmtiRedefineClasses.cpp
  31. +1 −0 src/hotspot/share/prims/methodHandles.cpp
  32. +1 −0 src/hotspot/share/prims/unsafe.cpp
  33. +1 −0 src/hotspot/share/runtime/fieldDescriptor.inline.hpp
  34. +6 −0 src/hotspot/share/runtime/signature.cpp
  35. +1 −6 src/hotspot/share/runtime/signature.hpp
@@ -44,6 +44,7 @@
#include "runtime/deoptimization.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/os.hpp"
#include "runtime/java.hpp"
#include "runtime/safepointVerifiers.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/vmOperations.hpp"
@@ -32,6 +32,7 @@
#include "oops/oop.inline.hpp"
#include "runtime/fieldDescriptor.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/reflectionUtils.hpp"

// ciField
//
@@ -39,6 +39,7 @@
#include "oops/oop.inline.hpp"
#include "runtime/fieldDescriptor.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/java.hpp"
#include "utilities/copy.hpp"
#include "utilities/macros.hpp"
#include "utilities/utf8.hpp"
@@ -28,6 +28,7 @@
#include "classfile/classFileStream.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/classLoadInfo.hpp"
#include "classfile/defaultMethods.hpp"
#include "classfile/dictionary.hpp"
#include "classfile/fieldLayoutBuilder.hpp"
@@ -36,6 +36,7 @@
#include "memory/metaspaceShared.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "utilities/defaultStream.hpp"
#include "utilities/hashtable.inline.hpp"
@@ -0,0 +1,99 @@
/*
* Copyright (c) 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/

#ifndef SHARE_CLASSFILE_CLASSLOADINFO_HPP
#define SHARE_CLASSFILE_CLASSLOADINFO_HPP

#include "runtime/handles.hpp"

class InstanceKlass;

template <typename T> class GrowableArray;

class ClassInstanceInfo : public StackObj {
private:
InstanceKlass* _dynamic_nest_host;
Handle _class_data;

public:
ClassInstanceInfo() {
_dynamic_nest_host = NULL;
_class_data = Handle();
}
ClassInstanceInfo(InstanceKlass* dynamic_nest_host, Handle class_data) {
_dynamic_nest_host = dynamic_nest_host;
_class_data = class_data;
}

InstanceKlass* dynamic_nest_host() const { return _dynamic_nest_host; }
Handle class_data() const { return _class_data; }
friend class ClassLoadInfo;
};

class ClassLoadInfo : public StackObj {
private:
Handle _protection_domain;
const InstanceKlass* _unsafe_anonymous_host;
GrowableArray<Handle>* _cp_patches;
ClassInstanceInfo _class_hidden_info;
bool _is_hidden;
bool _is_strong_hidden;
bool _can_access_vm_annotations;

public:
ClassLoadInfo(Handle protection_domain) {
_protection_domain = protection_domain;
_unsafe_anonymous_host = NULL;
_cp_patches = NULL;
_class_hidden_info._dynamic_nest_host = NULL;
_class_hidden_info._class_data = Handle();
_is_hidden = false;
_is_strong_hidden = false;
_can_access_vm_annotations = false;
}

ClassLoadInfo(Handle protection_domain, const InstanceKlass* unsafe_anonymous_host,
GrowableArray<Handle>* cp_patches, InstanceKlass* dynamic_nest_host,
Handle class_data, bool is_hidden, bool is_strong_hidden,
bool can_access_vm_annotations) {
_protection_domain = protection_domain;
_unsafe_anonymous_host = unsafe_anonymous_host;
_cp_patches = cp_patches;
_class_hidden_info._dynamic_nest_host = dynamic_nest_host;
_class_hidden_info._class_data = class_data;
_is_hidden = is_hidden;
_is_strong_hidden = is_strong_hidden;
_can_access_vm_annotations = can_access_vm_annotations;
}

Handle protection_domain() const { return _protection_domain; }
const InstanceKlass* unsafe_anonymous_host() const { return _unsafe_anonymous_host; }
GrowableArray<Handle>* cp_patches() const { return _cp_patches; }
const ClassInstanceInfo* class_hidden_info_ptr() const { return &_class_hidden_info; }
bool is_hidden() const { return _is_hidden; }
bool is_strong_hidden() const { return _is_strong_hidden; }
bool can_access_vm_annotations() const { return _can_access_vm_annotations; }
};

#endif // SHARE_CLASSFILE_CLASSLOADINFO_HPP
@@ -29,6 +29,7 @@
#include "classfile/classLoader.inline.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/classLoaderExt.hpp"
#include "classfile/classLoadInfo.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/moduleEntry.hpp"
#include "classfile/modules.hpp"
@@ -28,6 +28,7 @@
#include "classfile/classLoader.inline.hpp"
#include "classfile/classLoaderExt.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/classLoadInfo.hpp"
#include "classfile/klassFactory.hpp"
#include "classfile/modules.hpp"
#include "classfile/systemDictionaryShared.hpp"
@@ -33,6 +33,7 @@
#include "memory/metaspaceClosure.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/method.hpp"
#include "oops/oop.inline.hpp"
#include "oops/oopHandle.inline.hpp"
#include "runtime/arguments.hpp"
@@ -418,6 +419,23 @@ void SymbolPropertyEntry::free_entry() {
_method_type.release(Universe::vm_global());
}

void SymbolPropertyEntry::print_entry(outputStream* st) const {
symbol()->print_value_on(st);
st->print("/mode=" INTX_FORMAT, symbol_mode());
st->print(" -> ");
bool printed = false;
if (method() != NULL) {
method()->print_value_on(st);
printed = true;
}
if (method_type() != NULL) {
if (printed) st->print(" and ");
st->print(INTPTR_FORMAT, p2i((void *)method_type()));
printed = true;
}
st->print_cr(printed ? "" : "(empty)");
}

SymbolPropertyTable::SymbolPropertyTable(int table_size)
: Hashtable<Symbol*, mtSymbol>(table_size, sizeof(SymbolPropertyEntry))
{
@@ -25,16 +25,14 @@
#ifndef SHARE_CLASSFILE_DICTIONARY_HPP
#define SHARE_CLASSFILE_DICTIONARY_HPP

#include "classfile/protectionDomainCache.hpp"
#include "classfile/systemDictionary.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/oop.hpp"
#include "oops/oopHandle.hpp"
#include "utilities/hashtable.hpp"
#include "utilities/ostream.hpp"

class DictionaryEntry;
class BoolObjectClosure;
class ProtectionDomainEntry;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// The data structure for the class loader data dictionaries.
@@ -208,22 +206,7 @@ class SymbolPropertyEntry : public HashtableEntry<Symbol*, mtSymbol> {
return (SymbolPropertyEntry**)HashtableEntry<Symbol*, mtSymbol>::next_addr();
}

void print_entry(outputStream* st) const {
symbol()->print_value_on(st);
st->print("/mode=" INTX_FORMAT, symbol_mode());
st->print(" -> ");
bool printed = false;
if (method() != NULL) {
method()->print_value_on(st);
printed = true;
}
if (method_type() != NULL) {
if (printed) st->print(" and ");
st->print(INTPTR_FORMAT, p2i((void *)method_type()));
printed = true;
}
st->print_cr(printed ? "" : "(empty)");
}
void print_entry(outputStream* st) const;
};

// A system-internal mapping of symbols to pointers, both managed
@@ -62,6 +62,7 @@
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/jniHandles.inline.hpp"
#include "runtime/reflectionUtils.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/safepointVerifiers.hpp"
#include "runtime/thread.inline.hpp"
@@ -28,6 +28,7 @@
#include "classfile/systemDictionary.hpp"
#include "jvmtifiles/jvmti.h"
#include "oops/oop.hpp"
#include "oops/instanceKlass.hpp"
#include "runtime/os.hpp"

class RecordComponent;
@@ -28,6 +28,7 @@
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderData.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/classLoadInfo.hpp"
#include "classfile/klassFactory.hpp"
#include "memory/filemap.hpp"
#include "memory/metaspaceShared.hpp"
@@ -31,6 +31,7 @@
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/classLoaderDataGraph.inline.hpp"
#include "classfile/classLoaderExt.hpp"
#include "classfile/classLoadInfo.hpp"
#include "classfile/dictionary.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "classfile/klassFactory.hpp"
@@ -111,46 +112,6 @@ OopHandle SystemDictionary::_java_platform_loader;

const int defaultProtectionDomainCacheSize = 1009;

ClassLoadInfo::ClassLoadInfo() {
_protection_domain = Handle();
_unsafe_anonymous_host = NULL;
_cp_patches = NULL;
_class_hidden_info._dynamic_nest_host = NULL;
_class_hidden_info._class_data = Handle();
_is_hidden = false;
_is_strong_hidden = false;
_can_access_vm_annotations = false;
}

ClassLoadInfo::ClassLoadInfo(Handle protection_domain) {
_protection_domain = protection_domain;
_unsafe_anonymous_host = NULL;
_cp_patches = NULL;
_class_hidden_info._dynamic_nest_host = NULL;
_class_hidden_info._class_data = Handle();
_is_hidden = false;
_is_strong_hidden = false;
_can_access_vm_annotations = false;
}

ClassLoadInfo::ClassLoadInfo(Handle protection_domain,
const InstanceKlass* unsafe_anonymous_host,
GrowableArray<Handle>* cp_patches,
InstanceKlass* dynamic_nest_host,
Handle class_data,
bool is_hidden,
bool is_strong_hidden,
bool can_access_vm_annotations) {
_protection_domain = protection_domain;
_unsafe_anonymous_host = unsafe_anonymous_host;
_cp_patches = cp_patches;
_class_hidden_info._dynamic_nest_host = dynamic_nest_host;
_class_hidden_info._class_data = class_data;
_is_hidden = is_hidden;
_is_strong_hidden = is_strong_hidden;
_can_access_vm_annotations = can_access_vm_annotations;
}

// ----------------------------------------------------------------------------
// Java-level SystemLoader and PlatformLoader

@@ -2047,6 +2008,10 @@ bool SystemDictionary::is_well_known_klass(Symbol* class_name) {
}
return false;
}

bool SystemDictionary::is_well_known_klass(Klass* k) {
return is_well_known_klass(k->name());
}
#endif

bool SystemDictionary::resolve_wk_klass(WKID id, TRAPS) {
@@ -2951,6 +2916,19 @@ ProtectionDomainCacheEntry* SystemDictionary::cache_get(Handle protection_domain
return _pd_cache_table->get(protection_domain);
}

ClassLoaderData* SystemDictionary::class_loader_data(Handle class_loader) {
return ClassLoaderData::class_loader_data(class_loader());
}

bool SystemDictionary::is_wk_klass_loaded(InstanceKlass* klass) {
return !(klass == NULL || !klass->is_loaded());
}

bool SystemDictionary::is_nonpublic_Object_method(Method* m) {
assert(m != NULL, "Unexpected NULL Method*");
return !m->is_public() && m->method_holder() == SystemDictionary::Object_klass();
}

// ----------------------------------------------------------------------------

void SystemDictionary::print_on(outputStream *st) {

0 comments on commit 208b120

Please sign in to comment.