diff --git a/src/hotspot/share/classfile/javaClasses.hpp b/src/hotspot/share/classfile/javaClasses.hpp index 17064931b9c..b7852caf53e 100644 --- a/src/hotspot/share/classfile/javaClasses.hpp +++ b/src/hotspot/share/classfile/javaClasses.hpp @@ -28,7 +28,9 @@ #include "classfile/vmClasses.hpp" #include "oops/instanceKlass.hpp" #include "oops/oopsHierarchy.hpp" +#include "oops/symbol.hpp" #include "runtime/handles.hpp" +#include "runtime/os.hpp" #include "utilities/macros.hpp" #include "utilities/vmEnums.hpp" diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index d8c67f88c12..12769566a16 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -2846,6 +2846,31 @@ void InstanceKlass::release_C_heap_structures(bool release_sub_metadata) { } } +// The constant pool is on stack if any of the methods are executing or +// referenced by handles. +bool InstanceKlass::on_stack() const { + return _constants->on_stack(); +} + +Symbol* InstanceKlass::source_file_name() const { return _constants->source_file_name(); } +u2 InstanceKlass::source_file_name_index() const { return _constants->source_file_name_index(); } +void InstanceKlass::set_source_file_name_index(u2 sourcefile_index) { _constants->set_source_file_name_index(sourcefile_index); } + +// minor and major version numbers of class file +u2 InstanceKlass::minor_version() const { return _constants->minor_version(); } +void InstanceKlass::set_minor_version(u2 minor_version) { _constants->set_minor_version(minor_version); } +u2 InstanceKlass::major_version() const { return _constants->major_version(); } +void InstanceKlass::set_major_version(u2 major_version) { _constants->set_major_version(major_version); } + +InstanceKlass* InstanceKlass::get_klass_version(int version) { + for (InstanceKlass* ik = this; ik != nullptr; ik = ik->previous_versions()) { + if (ik->constants()->version() == version) { + return ik; + } + } + return nullptr; +} + void InstanceKlass::set_source_debug_extension(const char* array, int length) { if (array == nullptr) { _source_debug_extension = nullptr; @@ -2864,6 +2889,10 @@ void InstanceKlass::set_source_debug_extension(const char* array, int length) { } } +Symbol* InstanceKlass::generic_signature() const { return _constants->generic_signature(); } +u2 InstanceKlass::generic_signature_index() const { return _constants->generic_signature_index(); } +void InstanceKlass::set_generic_signature_index(u2 sig_index) { _constants->set_generic_signature_index(sig_index); } + const char* InstanceKlass::signature_name() const { // Get the internal name as a c string diff --git a/src/hotspot/share/oops/instanceKlass.hpp b/src/hotspot/share/oops/instanceKlass.hpp index ae08a56686f..060073ad7a9 100644 --- a/src/hotspot/share/oops/instanceKlass.hpp +++ b/src/hotspot/share/oops/instanceKlass.hpp @@ -28,20 +28,23 @@ #include "memory/referenceType.hpp" #include "oops/annotations.hpp" #include "oops/constMethod.hpp" -#include "oops/constantPool.hpp" #include "oops/fieldInfo.hpp" #include "oops/instanceKlassFlags.hpp" #include "oops/instanceOop.hpp" #include "runtime/handles.hpp" +#include "runtime/javaThread.hpp" #include "utilities/accessFlags.hpp" #include "utilities/align.hpp" +#include "utilities/growableArray.hpp" #include "utilities/macros.hpp" #if INCLUDE_JFR #include "jfr/support/jfrKlassExtension.hpp" #endif +class ConstantPool; class DeoptimizationScope; class klassItable; +class Monitor; class RecordComponent; // An InstanceKlass is the VM level representation of a Java class. @@ -645,15 +648,15 @@ public: void set_is_contended(bool value) { _misc_flags.set_is_contended(value); } // source file name - Symbol* source_file_name() const { return _constants->source_file_name(); } - u2 source_file_name_index() const { return _constants->source_file_name_index(); } - void set_source_file_name_index(u2 sourcefile_index) { _constants->set_source_file_name_index(sourcefile_index); } + Symbol* source_file_name() const; + u2 source_file_name_index() const; + void set_source_file_name_index(u2 sourcefile_index); // minor and major version numbers of class file - u2 minor_version() const { return _constants->minor_version(); } - void set_minor_version(u2 minor_version) { _constants->set_minor_version(minor_version); } - u2 major_version() const { return _constants->major_version(); } - void set_major_version(u2 major_version) { _constants->set_major_version(major_version); } + u2 minor_version() const; + void set_minor_version(u2 minor_version); + u2 major_version() const; + void set_major_version(u2 major_version); // source debug extension const char* source_debug_extension() const { return _source_debug_extension; } @@ -690,14 +693,7 @@ public: InstanceKlass* previous_versions() const { return nullptr; } #endif - InstanceKlass* get_klass_version(int version) { - for (InstanceKlass* ik = this; ik != nullptr; ik = ik->previous_versions()) { - if (ik->constants()->version() == version) { - return ik; - } - } - return nullptr; - } + InstanceKlass* get_klass_version(int version); bool has_been_redefined() const { return _misc_flags.has_been_redefined(); } void set_has_been_redefined() { _misc_flags.set_has_been_redefined(true); } @@ -773,9 +769,9 @@ public: void set_initial_method_idnum(u2 value) { _idnum_allocated_count = value; } // generics support - Symbol* generic_signature() const { return _constants->generic_signature(); } - u2 generic_signature_index() const { return _constants->generic_signature_index(); } - void set_generic_signature_index(u2 sig_index) { _constants->set_generic_signature_index(sig_index); } + Symbol* generic_signature() const; + u2 generic_signature_index() const; + void set_generic_signature_index(u2 sig_index); u2 enclosing_method_data(int offset) const; u2 enclosing_method_class_index() const { @@ -995,9 +991,7 @@ public: void static deallocate_record_components(ClassLoaderData* loader_data, Array* record_component); - // The constant pool is on stack if any of the methods are executing or - // referenced by handles. - bool on_stack() const { return _constants->on_stack(); } + virtual bool on_stack() const; // callbacks for actions during class unloading static void unload_class(InstanceKlass* ik); diff --git a/src/hotspot/share/oops/instanceKlass.inline.hpp b/src/hotspot/share/oops/instanceKlass.inline.hpp index 8258dd4e093..1b4664f5a4b 100644 --- a/src/hotspot/share/oops/instanceKlass.inline.hpp +++ b/src/hotspot/share/oops/instanceKlass.inline.hpp @@ -27,10 +27,7 @@ #include "oops/instanceKlass.hpp" -#include "classfile/javaClasses.hpp" -#include "classfile/vmSymbols.hpp" #include "memory/memRegion.hpp" -#include "memory/resourceArea.hpp" #include "oops/fieldInfo.inline.hpp" #include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/utilities/events.cpp b/src/hotspot/share/utilities/events.cpp index c47c466372e..dd64c72dd8a 100644 --- a/src/hotspot/share/utilities/events.cpp +++ b/src/hotspot/share/utilities/events.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "oops/instanceKlass.hpp" +#include "oops/symbol.hpp" #include "runtime/javaThread.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/osThread.hpp"