< prev index next >

src/hotspot/share/oops/klass.hpp

Print this page

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.

659 
660   bool is_public() const                { return _access_flags.is_public(); }
661   bool is_final() const                 { return _access_flags.is_final(); }
662   bool is_interface() const             { return _access_flags.is_interface(); }
663   bool is_abstract() const              { return _access_flags.is_abstract(); }
664   bool is_super() const                 { return _access_flags.is_super(); }
665   bool is_synthetic() const             { return _access_flags.is_synthetic(); }
666   void set_is_synthetic()               { _access_flags.set_is_synthetic(); }
667   bool has_finalizer() const            { return _access_flags.has_finalizer(); }
668   void set_has_finalizer()              { _access_flags.set_has_finalizer(); }
669   bool is_hidden() const                { return access_flags().is_hidden_class(); }
670   void set_is_hidden()                  { _access_flags.set_is_hidden_class(); }
671   bool is_value_based()                 { return _access_flags.is_value_based_class(); }
672   void set_is_value_based()             { _access_flags.set_is_value_based_class(); }
673 
674   inline bool is_non_strong_hidden() const;
675 
676   bool is_cloneable() const;
677   void set_is_cloneable();
678 







679   JFR_ONLY(DEFINE_TRACE_ID_METHODS;)
680 
681   virtual void metaspace_pointers_do(MetaspaceClosure* iter);
682   virtual MetaspaceObj::Type type() const { return ClassType; }
683 
684   inline bool is_loader_alive() const;
685 
686   void clean_subklass();
687 
688   static void clean_weak_klass_links(bool unloading_occurred, bool clean_alive_klasses = true);
689   static void clean_subklass_tree() {
690     clean_weak_klass_links(/*unloading_occurred*/ true , /* clean_alive_klasses */ false);
691   }
692 
693   // Return self, except for abstract classes with exactly 1
694   // implementor.  Then return the 1 concrete implementation.
695   Klass *up_cast_abstract();
696 
697   // klass name
698   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.

661 
662   bool is_public() const                { return _access_flags.is_public(); }
663   bool is_final() const                 { return _access_flags.is_final(); }
664   bool is_interface() const             { return _access_flags.is_interface(); }
665   bool is_abstract() const              { return _access_flags.is_abstract(); }
666   bool is_super() const                 { return _access_flags.is_super(); }
667   bool is_synthetic() const             { return _access_flags.is_synthetic(); }
668   void set_is_synthetic()               { _access_flags.set_is_synthetic(); }
669   bool has_finalizer() const            { return _access_flags.has_finalizer(); }
670   void set_has_finalizer()              { _access_flags.set_has_finalizer(); }
671   bool is_hidden() const                { return access_flags().is_hidden_class(); }
672   void set_is_hidden()                  { _access_flags.set_is_hidden_class(); }
673   bool is_value_based()                 { return _access_flags.is_value_based_class(); }
674   void set_is_value_based()             { _access_flags.set_is_value_based_class(); }
675 
676   inline bool is_non_strong_hidden() const;
677 
678   bool is_cloneable() const;
679   void set_is_cloneable();
680 
681   markWord prototype_header() const {
682     assert(UseCompactObjectHeaders, "only use with compact object headers");
683     return _prototype_header;
684   }
685   inline void set_prototype_header(markWord header);
686   static ByteSize prototype_header_offset() { return in_ByteSize(offset_of(Klass, _prototype_header)); }
687 
688   JFR_ONLY(DEFINE_TRACE_ID_METHODS;)
689 
690   virtual void metaspace_pointers_do(MetaspaceClosure* iter);
691   virtual MetaspaceObj::Type type() const { return ClassType; }
692 
693   inline bool is_loader_alive() const;
694 
695   void clean_subklass();
696 
697   static void clean_weak_klass_links(bool unloading_occurred, bool clean_alive_klasses = true);
698   static void clean_subklass_tree() {
699     clean_weak_klass_links(/*unloading_occurred*/ true , /* clean_alive_klasses */ false);
700   }
701 
702   // Return self, except for abstract classes with exactly 1
703   // implementor.  Then return the 1 concrete implementation.
704   Klass *up_cast_abstract();
705 
706   // klass name
707   Symbol* name() const                   { return _name; }
< prev index next >