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 // Bitmap and hash code used by hashed secondary supers.
163 uintx _bitmap;
164 uint8_t _hash_slot;
165
166 static uint8_t compute_hash_slot(Symbol* s);
167
168 int _vtable_len; // vtable length. This field may be read very often when we
169 // have lots of itable dispatches (e.g., lambdas and streams).
170 // Keep it away from the beginning of a Klass to avoid cacheline
171 // contention that may happen when a nearby object is modified.
172 AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here.
173
174 JFR_ONLY(DEFINE_TRACE_ID_FIELD;)
175
176 private:
177 // This is an index into FileMapHeader::_shared_path_table[], to
178 // associate this class with the JAR file where it's loaded from during
179 // dump time. If a class is not loaded from the shared archive, this field is
180 // -1.
181 s2 _shared_class_path_index;
182
183 #if INCLUDE_CDS
184 // Various attributes for shared classes. Should be zero for a non-shared class.
185 u2 _shared_class_flags;
186 enum CDSSharedClassFlags {
187 _is_shared_class = 1 << 0, // shadows MetaspaceObj::is_shared
188 _archived_lambda_proxy_is_available = 1 << 1,
189 _has_value_based_class_annotation = 1 << 2,
190 _verified_at_dump_time = 1 << 3,
191 _has_archived_enum_objs = 1 << 4,
192 // This class was not loaded from a classfile in the module image
193 // or classpath.
687
688 bool is_public() const { return _access_flags.is_public(); }
689 bool is_final() const { return _access_flags.is_final(); }
690 bool is_interface() const { return _access_flags.is_interface(); }
691 bool is_abstract() const { return _access_flags.is_abstract(); }
692 bool is_super() const { return _access_flags.is_super(); }
693 bool is_synthetic() const { return _access_flags.is_synthetic(); }
694 void set_is_synthetic() { _access_flags.set_is_synthetic(); }
695 bool has_finalizer() const { return _access_flags.has_finalizer(); }
696 void set_has_finalizer() { _access_flags.set_has_finalizer(); }
697 bool is_hidden() const { return access_flags().is_hidden_class(); }
698 void set_is_hidden() { _access_flags.set_is_hidden_class(); }
699 bool is_value_based() { return _access_flags.is_value_based_class(); }
700 void set_is_value_based() { _access_flags.set_is_value_based_class(); }
701
702 inline bool is_non_strong_hidden() const;
703
704 bool is_cloneable() const;
705 void set_is_cloneable();
706
707 JFR_ONLY(DEFINE_TRACE_ID_METHODS;)
708
709 virtual void metaspace_pointers_do(MetaspaceClosure* iter);
710 virtual MetaspaceObj::Type type() const { return ClassType; }
711
712 inline bool is_loader_alive() const;
713
714 void clean_subklass();
715
716 static void clean_weak_klass_links(bool unloading_occurred, bool clean_alive_klasses = true);
717 static void clean_subklass_tree() {
718 clean_weak_klass_links(/*unloading_occurred*/ true , /* clean_alive_klasses */ false);
719 }
720
721 // Return self, except for abstract classes with exactly 1
722 // implementor. Then return the 1 concrete implementation.
723 Klass *up_cast_abstract();
724
725 // klass name
726 Symbol* name() const { return _name; }
|
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 // Bitmap and hash code used by hashed secondary supers.
163 uintx _bitmap;
164 uint8_t _hash_slot;
165
166 static uint8_t compute_hash_slot(Symbol* s);
167
168 int _vtable_len; // vtable length. This field may be read very often when we
169 // have lots of itable dispatches (e.g., lambdas and streams).
170 // Keep it away from the beginning of a Klass to avoid cacheline
171 // contention that may happen when a nearby object is modified.
172 AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here.
173
174 markWord _prototype_header; // Used to initialize objects' header
175
176 JFR_ONLY(DEFINE_TRACE_ID_FIELD;)
177
178 private:
179 // This is an index into FileMapHeader::_shared_path_table[], to
180 // associate this class with the JAR file where it's loaded from during
181 // dump time. If a class is not loaded from the shared archive, this field is
182 // -1.
183 s2 _shared_class_path_index;
184
185 #if INCLUDE_CDS
186 // Various attributes for shared classes. Should be zero for a non-shared class.
187 u2 _shared_class_flags;
188 enum CDSSharedClassFlags {
189 _is_shared_class = 1 << 0, // shadows MetaspaceObj::is_shared
190 _archived_lambda_proxy_is_available = 1 << 1,
191 _has_value_based_class_annotation = 1 << 2,
192 _verified_at_dump_time = 1 << 3,
193 _has_archived_enum_objs = 1 << 4,
194 // This class was not loaded from a classfile in the module image
195 // or classpath.
689
690 bool is_public() const { return _access_flags.is_public(); }
691 bool is_final() const { return _access_flags.is_final(); }
692 bool is_interface() const { return _access_flags.is_interface(); }
693 bool is_abstract() const { return _access_flags.is_abstract(); }
694 bool is_super() const { return _access_flags.is_super(); }
695 bool is_synthetic() const { return _access_flags.is_synthetic(); }
696 void set_is_synthetic() { _access_flags.set_is_synthetic(); }
697 bool has_finalizer() const { return _access_flags.has_finalizer(); }
698 void set_has_finalizer() { _access_flags.set_has_finalizer(); }
699 bool is_hidden() const { return access_flags().is_hidden_class(); }
700 void set_is_hidden() { _access_flags.set_is_hidden_class(); }
701 bool is_value_based() { return _access_flags.is_value_based_class(); }
702 void set_is_value_based() { _access_flags.set_is_value_based_class(); }
703
704 inline bool is_non_strong_hidden() const;
705
706 bool is_cloneable() const;
707 void set_is_cloneable();
708
709 markWord prototype_header() const {
710 assert(UseCompactObjectHeaders, "only use with compact object headers");
711 return _prototype_header;
712 }
713 inline void set_prototype_header(markWord header);
714 static ByteSize prototype_header_offset() { return in_ByteSize(offset_of(Klass, _prototype_header)); }
715
716 JFR_ONLY(DEFINE_TRACE_ID_METHODS;)
717
718 virtual void metaspace_pointers_do(MetaspaceClosure* iter);
719 virtual MetaspaceObj::Type type() const { return ClassType; }
720
721 inline bool is_loader_alive() const;
722
723 void clean_subklass();
724
725 static void clean_weak_klass_links(bool unloading_occurred, bool clean_alive_klasses = true);
726 static void clean_subklass_tree() {
727 clean_weak_klass_links(/*unloading_occurred*/ true , /* clean_alive_klasses */ false);
728 }
729
730 // Return self, except for abstract classes with exactly 1
731 // implementor. Then return the 1 concrete implementation.
732 Klass *up_cast_abstract();
733
734 // klass name
735 Symbol* name() const { return _name; }
|