mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8295964: Move InstanceKlass::_misc_flags
Reviewed-by: sspitsyn, dholmes
This commit is contained in:
parent
91072ee393
commit
7e88209e6c
9 changed files with 192 additions and 196 deletions
|
@ -29,6 +29,7 @@
|
|||
#include "oops/annotations.hpp"
|
||||
#include "oops/constMethod.hpp"
|
||||
#include "oops/fieldInfo.hpp"
|
||||
#include "oops/instanceKlassMiscStatus.hpp"
|
||||
#include "oops/instanceOop.hpp"
|
||||
#include "runtime/handles.hpp"
|
||||
#include "utilities/accessFlags.hpp"
|
||||
|
@ -222,33 +223,15 @@ class InstanceKlass: public Klass {
|
|||
volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change
|
||||
|
||||
// _is_marked_dependent can be set concurrently, thus cannot be part of the
|
||||
// _misc_flags.
|
||||
// _misc_status right now.
|
||||
bool _is_marked_dependent; // used for marking during flushing and deoptimization
|
||||
|
||||
ClassState _init_state; // state of class
|
||||
|
||||
u1 _reference_type; // reference type
|
||||
|
||||
enum {
|
||||
_misc_rewritten = 1 << 0, // methods rewritten.
|
||||
_misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops
|
||||
_misc_should_verify_class = 1 << 2, // allow caching of preverification
|
||||
_misc_unused = 1 << 3, // not currently used
|
||||
_misc_is_contended = 1 << 4, // marked with contended annotation
|
||||
_misc_has_nonstatic_concrete_methods = 1 << 5, // class/superclass/implemented interfaces has non-static, concrete methods
|
||||
_misc_declares_nonstatic_concrete_methods = 1 << 6, // directly declares non-static, concrete methods
|
||||
_misc_has_been_redefined = 1 << 7, // class has been redefined
|
||||
_misc_shared_loading_failed = 1 << 8, // class has been loaded from shared archive
|
||||
_misc_is_scratch_class = 1 << 9, // class is the redefined scratch class
|
||||
_misc_is_shared_boot_class = 1 << 10, // defining class loader is boot class loader
|
||||
_misc_is_shared_platform_class = 1 << 11, // defining class loader is platform class loader
|
||||
_misc_is_shared_app_class = 1 << 12, // defining class loader is app class loader
|
||||
_misc_has_contended_annotations = 1 << 13 // has @Contended annotation
|
||||
};
|
||||
u2 shared_loader_type_bits() const {
|
||||
return _misc_is_shared_boot_class|_misc_is_shared_platform_class|_misc_is_shared_app_class;
|
||||
}
|
||||
u2 _misc_flags; // There is more space in access_flags for more flags.
|
||||
// State is set while executing, eventually atomically to not disturb other state
|
||||
InstanceKlassMiscStatus _misc_status;
|
||||
|
||||
Monitor* _init_monitor; // mutual exclusion to _init_state and _init_thread.
|
||||
Thread* _init_thread; // Pointer to current thread doing initialization (to handle recursive initialization)
|
||||
|
@ -332,44 +315,26 @@ class InstanceKlass: public Klass {
|
|||
static void set_finalization_enabled(bool val) { _finalization_enabled = val; }
|
||||
|
||||
// The three BUILTIN class loader types
|
||||
bool is_shared_boot_class() const {
|
||||
return (_misc_flags & _misc_is_shared_boot_class) != 0;
|
||||
}
|
||||
bool is_shared_platform_class() const {
|
||||
return (_misc_flags & _misc_is_shared_platform_class) != 0;
|
||||
}
|
||||
bool is_shared_app_class() const {
|
||||
return (_misc_flags & _misc_is_shared_app_class) != 0;
|
||||
}
|
||||
bool is_shared_boot_class() const { return _misc_status.is_shared_boot_class(); }
|
||||
bool is_shared_platform_class() const { return _misc_status.is_shared_platform_class(); }
|
||||
bool is_shared_app_class() const { return _misc_status.is_shared_app_class(); }
|
||||
// The UNREGISTERED class loader type
|
||||
bool is_shared_unregistered_class() const {
|
||||
return (_misc_flags & shared_loader_type_bits()) == 0;
|
||||
}
|
||||
bool is_shared_unregistered_class() const { return _misc_status.is_shared_unregistered_class(); }
|
||||
|
||||
// Check if the class can be shared in CDS
|
||||
bool is_shareable() const;
|
||||
|
||||
bool shared_loading_failed() const {
|
||||
return (_misc_flags & _misc_shared_loading_failed) != 0;
|
||||
}
|
||||
bool shared_loading_failed() const { return _misc_status.shared_loading_failed(); }
|
||||
|
||||
void set_shared_loading_failed() {
|
||||
_misc_flags |= _misc_shared_loading_failed;
|
||||
}
|
||||
void set_shared_loading_failed() { _misc_status.set_shared_loading_failed(true); }
|
||||
|
||||
void set_shared_class_loader_type(s2 loader_type);
|
||||
#if INCLUDE_CDS
|
||||
void set_shared_class_loader_type(s2 loader_type) { _misc_status.set_shared_class_loader_type(loader_type); }
|
||||
void assign_class_loader_type() { _misc_status.assign_class_loader_type(_class_loader_data); }
|
||||
#endif
|
||||
|
||||
void assign_class_loader_type();
|
||||
|
||||
bool has_nonstatic_fields() const {
|
||||
return (_misc_flags & _misc_has_nonstatic_fields) != 0;
|
||||
}
|
||||
void set_has_nonstatic_fields(bool b) {
|
||||
assert(!has_nonstatic_fields(), "set once");
|
||||
if (b) {
|
||||
_misc_flags |= _misc_has_nonstatic_fields;
|
||||
}
|
||||
}
|
||||
bool has_nonstatic_fields() const { return _misc_status.has_nonstatic_fields(); }
|
||||
void set_has_nonstatic_fields(bool b) { _misc_status.set_has_nonstatic_fields(b); }
|
||||
|
||||
// field sizes
|
||||
int nonstatic_field_size() const { return _nonstatic_field_size; }
|
||||
|
@ -546,7 +511,7 @@ public:
|
|||
bool is_init_thread(Thread *thread) { return thread == _init_thread; }
|
||||
ClassState init_state() const { return Atomic::load(&_init_state); }
|
||||
const char* init_state_name() const;
|
||||
bool is_rewritten() const { return (_misc_flags & _misc_rewritten) != 0; }
|
||||
bool is_rewritten() const { return _misc_status.rewritten(); }
|
||||
|
||||
class LockLinkState : public StackObj {
|
||||
InstanceKlass* _ik;
|
||||
|
@ -567,15 +532,8 @@ public:
|
|||
bool is_sealed() const;
|
||||
|
||||
// defineClass specified verification
|
||||
bool should_verify_class() const {
|
||||
return (_misc_flags & _misc_should_verify_class) != 0;
|
||||
}
|
||||
void set_should_verify_class(bool value) {
|
||||
assert(!should_verify_class(), "set once");
|
||||
if (value) {
|
||||
_misc_flags |= _misc_should_verify_class;
|
||||
}
|
||||
}
|
||||
bool should_verify_class() const { return _misc_status.should_verify_class(); }
|
||||
void set_should_verify_class(bool value) { _misc_status.set_should_verify_class(value); }
|
||||
|
||||
// marking
|
||||
bool is_marked_dependent() const { return _is_marked_dependent; }
|
||||
|
@ -691,15 +649,8 @@ public:
|
|||
// signers
|
||||
objArrayOop signers() const;
|
||||
|
||||
bool is_contended() const {
|
||||
return (_misc_flags & _misc_is_contended) != 0;
|
||||
}
|
||||
void set_is_contended(bool value) {
|
||||
assert(!is_contended(), "set once");
|
||||
if (value) {
|
||||
_misc_flags |= _misc_is_contended;
|
||||
}
|
||||
}
|
||||
bool is_contended() const { return _misc_status.is_contended(); }
|
||||
void set_is_contended(bool value) { _misc_status.set_is_contended(value); }
|
||||
|
||||
// source file name
|
||||
Symbol* source_file_name() const { return _constants->source_file_name(); }
|
||||
|
@ -728,15 +679,8 @@ public:
|
|||
_nonstatic_oop_map_size = words;
|
||||
}
|
||||
|
||||
bool has_contended_annotations() const {
|
||||
return ((_misc_flags & _misc_has_contended_annotations) != 0);
|
||||
}
|
||||
void set_has_contended_annotations(bool value) {
|
||||
assert(!has_contended_annotations(), "set once");
|
||||
if (value) {
|
||||
_misc_flags |= _misc_has_contended_annotations;
|
||||
}
|
||||
}
|
||||
bool has_contended_annotations() const { return _misc_status.has_contended_annotations(); }
|
||||
void set_has_contended_annotations(bool value) { _misc_status.set_has_contended_annotations(value); }
|
||||
|
||||
#if INCLUDE_JVMTI
|
||||
// Redefinition locking. Class can only be redefined by one thread at a time.
|
||||
|
@ -771,20 +715,11 @@ public:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool has_been_redefined() const {
|
||||
return (_misc_flags & _misc_has_been_redefined) != 0;
|
||||
}
|
||||
void set_has_been_redefined() {
|
||||
_misc_flags |= _misc_has_been_redefined;
|
||||
}
|
||||
bool has_been_redefined() const { return _misc_status.has_been_redefined(); }
|
||||
void set_has_been_redefined() { _misc_status.set_has_been_redefined(true); }
|
||||
|
||||
bool is_scratch_class() const {
|
||||
return (_misc_flags & _misc_is_scratch_class) != 0;
|
||||
}
|
||||
|
||||
void set_is_scratch_class() {
|
||||
_misc_flags |= _misc_is_scratch_class;
|
||||
}
|
||||
bool is_scratch_class() const { return _misc_status.is_scratch_class(); }
|
||||
void set_is_scratch_class() { _misc_status.set_is_scratch_class(true); }
|
||||
|
||||
bool has_resolved_methods() const {
|
||||
return _access_flags.has_resolved_methods();
|
||||
|
@ -840,25 +775,11 @@ public:
|
|||
|
||||
#endif // INCLUDE_JVMTI
|
||||
|
||||
bool has_nonstatic_concrete_methods() const {
|
||||
return (_misc_flags & _misc_has_nonstatic_concrete_methods) != 0;
|
||||
}
|
||||
void set_has_nonstatic_concrete_methods(bool b) {
|
||||
assert(!has_nonstatic_concrete_methods(), "set once");
|
||||
if (b) {
|
||||
_misc_flags |= _misc_has_nonstatic_concrete_methods;
|
||||
}
|
||||
}
|
||||
bool has_nonstatic_concrete_methods() const { return _misc_status.has_nonstatic_concrete_methods(); }
|
||||
void set_has_nonstatic_concrete_methods(bool b) { _misc_status.set_has_nonstatic_concrete_methods(b); }
|
||||
|
||||
bool declares_nonstatic_concrete_methods() const {
|
||||
return (_misc_flags & _misc_declares_nonstatic_concrete_methods) != 0;
|
||||
}
|
||||
void set_declares_nonstatic_concrete_methods(bool b) {
|
||||
assert(!declares_nonstatic_concrete_methods(), "set once");
|
||||
if (b) {
|
||||
_misc_flags |= _misc_declares_nonstatic_concrete_methods;
|
||||
}
|
||||
}
|
||||
bool declares_nonstatic_concrete_methods() const { return _misc_status.declares_nonstatic_concrete_methods(); }
|
||||
void set_declares_nonstatic_concrete_methods(bool b) { _misc_status.set_declares_nonstatic_concrete_methods(b); }
|
||||
|
||||
// for adding methods, ConstMethod::UNSET_IDNUM means no more ids available
|
||||
inline u2 next_method_idnum();
|
||||
|
@ -1152,7 +1073,7 @@ public:
|
|||
private:
|
||||
// initialization state
|
||||
void set_init_state(ClassState state);
|
||||
void set_rewritten() { _misc_flags |= _misc_rewritten; }
|
||||
void set_rewritten() { _misc_status.set_rewritten(true); }
|
||||
void set_init_thread(Thread *thread) {
|
||||
assert(thread == nullptr || _init_thread == nullptr, "Only one thread is allowed to own initialization");
|
||||
_init_thread = thread;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue