148 // First subclass (null if none); _subklass->next_sibling() is next one
149 Klass* volatile _subklass;
150 // Sibling link (or null); links all subklasses of a klass
151 Klass* volatile _next_sibling;
152
153 // All klasses loaded by a class loader are chained through these links
154 Klass* _next_link;
155
156 // The VM's representation of the ClassLoader used to load this class.
157 // Provide access the corresponding instance java.lang.ClassLoader.
158 ClassLoaderData* _class_loader_data;
159
160 int _vtable_len; // vtable length. This field may be read very often when we
161 // have lots of itable dispatches (e.g., lambdas and streams).
162 // Keep it away from the beginning of a Klass to avoid cacheline
163 // contention that may happen when a nearby object is modified.
164 AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here.
165
166 JFR_ONLY(DEFINE_TRACE_ID_FIELD;)
167
168 private:
169 // This is an index into FileMapHeader::_shared_path_table[], to
170 // associate this class with the JAR file where it's loaded from during
171 // dump time. If a class is not loaded from the shared archive, this field is
172 // -1.
173 jshort _shared_class_path_index;
174
175 #if INCLUDE_CDS
176 // Various attributes for shared classes. Should be zero for a non-shared class.
177 u2 _shared_class_flags;
178 enum CDSSharedClassFlags {
179 _archived_lambda_proxy_is_available = 1 << 1,
180 _has_value_based_class_annotation = 1 << 2,
181 _verified_at_dump_time = 1 << 3,
182 _has_archived_enum_objs = 1 << 4,
183 // This class was not loaded from a classfile in the module image
184 // or classpath.
185 _is_generated_shared_class = 1 << 5
186 };
187 #endif
651 bool has_finalizer() const { return _access_flags.has_finalizer(); }
652 bool has_final_method() const { return _access_flags.has_final_method(); }
653 void set_has_finalizer() { _access_flags.set_has_finalizer(); }
654 void set_has_final_method() { _access_flags.set_has_final_method(); }
655 bool has_vanilla_constructor() const { return _access_flags.has_vanilla_constructor(); }
656 void set_has_vanilla_constructor() { _access_flags.set_has_vanilla_constructor(); }
657 bool has_miranda_methods () const { return access_flags().has_miranda_methods(); }
658 void set_has_miranda_methods() { _access_flags.set_has_miranda_methods(); }
659 bool is_shared() const { return access_flags().is_shared_class(); } // shadows MetaspaceObj::is_shared)()
660 void set_is_shared() { _access_flags.set_is_shared_class(); }
661 bool is_hidden() const { return access_flags().is_hidden_class(); }
662 void set_is_hidden() { _access_flags.set_is_hidden_class(); }
663 bool is_value_based() { return _access_flags.is_value_based_class(); }
664 void set_is_value_based() { _access_flags.set_is_value_based_class(); }
665
666 inline bool is_non_strong_hidden() const;
667
668 bool is_cloneable() const;
669 void set_is_cloneable();
670
671 JFR_ONLY(DEFINE_TRACE_ID_METHODS;)
672
673 virtual void metaspace_pointers_do(MetaspaceClosure* iter);
674 virtual MetaspaceObj::Type type() const { return ClassType; }
675
676 inline bool is_loader_alive() const;
677
678 void clean_subklass();
679
680 static void clean_weak_klass_links(bool unloading_occurred, bool clean_alive_klasses = true);
681 static void clean_subklass_tree() {
682 clean_weak_klass_links(/*unloading_occurred*/ true , /* clean_alive_klasses */ false);
683 }
684
685 // Return self, except for abstract classes with exactly 1
686 // implementor. Then return the 1 concrete implementation.
687 Klass *up_cast_abstract();
688
689 // klass name
690 Symbol* name() const { return _name; }
|
148 // First subclass (null if none); _subklass->next_sibling() is next one
149 Klass* volatile _subklass;
150 // Sibling link (or null); links all subklasses of a klass
151 Klass* volatile _next_sibling;
152
153 // All klasses loaded by a class loader are chained through these links
154 Klass* _next_link;
155
156 // The VM's representation of the ClassLoader used to load this class.
157 // Provide access the corresponding instance java.lang.ClassLoader.
158 ClassLoaderData* _class_loader_data;
159
160 int _vtable_len; // vtable length. This field may be read very often when we
161 // have lots of itable dispatches (e.g., lambdas and streams).
162 // Keep it away from the beginning of a Klass to avoid cacheline
163 // contention that may happen when a nearby object is modified.
164 AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here.
165
166 JFR_ONLY(DEFINE_TRACE_ID_FIELD;)
167
168 markWord _prototype_header; // Used to initialize objects' header
169
170 private:
171 // This is an index into FileMapHeader::_shared_path_table[], to
172 // associate this class with the JAR file where it's loaded from during
173 // dump time. If a class is not loaded from the shared archive, this field is
174 // -1.
175 jshort _shared_class_path_index;
176
177 #if INCLUDE_CDS
178 // Various attributes for shared classes. Should be zero for a non-shared class.
179 u2 _shared_class_flags;
180 enum CDSSharedClassFlags {
181 _archived_lambda_proxy_is_available = 1 << 1,
182 _has_value_based_class_annotation = 1 << 2,
183 _verified_at_dump_time = 1 << 3,
184 _has_archived_enum_objs = 1 << 4,
185 // This class was not loaded from a classfile in the module image
186 // or classpath.
187 _is_generated_shared_class = 1 << 5
188 };
189 #endif
653 bool has_finalizer() const { return _access_flags.has_finalizer(); }
654 bool has_final_method() const { return _access_flags.has_final_method(); }
655 void set_has_finalizer() { _access_flags.set_has_finalizer(); }
656 void set_has_final_method() { _access_flags.set_has_final_method(); }
657 bool has_vanilla_constructor() const { return _access_flags.has_vanilla_constructor(); }
658 void set_has_vanilla_constructor() { _access_flags.set_has_vanilla_constructor(); }
659 bool has_miranda_methods () const { return access_flags().has_miranda_methods(); }
660 void set_has_miranda_methods() { _access_flags.set_has_miranda_methods(); }
661 bool is_shared() const { return access_flags().is_shared_class(); } // shadows MetaspaceObj::is_shared)()
662 void set_is_shared() { _access_flags.set_is_shared_class(); }
663 bool is_hidden() const { return access_flags().is_hidden_class(); }
664 void set_is_hidden() { _access_flags.set_is_hidden_class(); }
665 bool is_value_based() { return _access_flags.is_value_based_class(); }
666 void set_is_value_based() { _access_flags.set_is_value_based_class(); }
667
668 inline bool is_non_strong_hidden() const;
669
670 bool is_cloneable() const;
671 void set_is_cloneable();
672
673 markWord prototype_header() const {
674 assert(UseCompactObjectHeaders, "only use with compact object headers");
675 return _prototype_header;
676 }
677 inline void set_prototype_header(markWord header);
678 static ByteSize prototype_header_offset() { return in_ByteSize(offset_of(Klass, _prototype_header)); }
679
680 JFR_ONLY(DEFINE_TRACE_ID_METHODS;)
681
682 virtual void metaspace_pointers_do(MetaspaceClosure* iter);
683 virtual MetaspaceObj::Type type() const { return ClassType; }
684
685 inline bool is_loader_alive() const;
686
687 void clean_subklass();
688
689 static void clean_weak_klass_links(bool unloading_occurred, bool clean_alive_klasses = true);
690 static void clean_subklass_tree() {
691 clean_weak_klass_links(/*unloading_occurred*/ true , /* clean_alive_klasses */ false);
692 }
693
694 // Return self, except for abstract classes with exactly 1
695 // implementor. Then return the 1 concrete implementation.
696 Klass *up_cast_abstract();
697
698 // klass name
699 Symbol* name() const { return _name; }
|