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