Skip to content

Commit

Permalink
8310494: Do not include constantPool.hpp from instanceKlass.hpp
Browse files Browse the repository at this point in the history
Reviewed-by: stefank, coleenp
  • Loading branch information
iklam committed Jun 23, 2023
1 parent 0314292 commit bfcca5e
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 25 deletions.
2 changes: 2 additions & 0 deletions src/hotspot/share/classfile/javaClasses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
29 changes: 29 additions & 0 deletions src/hotspot/share/oops/instanceKlass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
38 changes: 16 additions & 22 deletions src/hotspot/share/oops/instanceKlass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -645,15 +648,15 @@ class InstanceKlass: public Klass {
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; }
Expand Down Expand Up @@ -690,14 +693,7 @@ class InstanceKlass: public Klass {
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); }
Expand Down Expand Up @@ -773,9 +769,9 @@ class InstanceKlass: public Klass {
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 {
Expand Down Expand Up @@ -995,9 +991,7 @@ class InstanceKlass: public Klass {
void static deallocate_record_components(ClassLoaderData* loader_data,
Array<RecordComponent*>* 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);
Expand Down
3 changes: 0 additions & 3 deletions src/hotspot/share/oops/instanceKlass.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/utilities/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

1 comment on commit bfcca5e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.