190
191 // Number of heapOopSize words used by non-static fields in this klass
192 // (including inherited fields but after header_size()).
193 int _nonstatic_field_size;
194 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass
195 // Constant pool index to the utf8 entry of the Generic signature,
196 // or 0 if none.
197 u2 _generic_signature_index;
198 // Constant pool index to the utf8 entry for the name of source file
199 // containing this klass, 0 if not specified.
200 u2 _source_file_name_index;
201 u2 _static_oop_field_count;// number of static oop fields in this klass
202 u2 _java_fields_count; // The number of declared Java fields
203 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
204
205 int _itable_len; // length of Java itable (in words)
206 // _is_marked_dependent can be set concurrently, thus cannot be part of the
207 // _misc_flags.
208 bool _is_marked_dependent; // used for marking during flushing and deoptimization
209
210 enum {
211 _extra_is_being_redefined = 1 << 0, // used for locking redefinition
212 _extra_has_value_fields = 1 << 1, // has value fields and related embedded section is not empty
213 _extra_has_vcc_klass = 1 << 2 // has a pointer to its Value Capable Class (MVT)
214 };
215
216 u1 _extra_flags;
217
218 // The low three bits of _misc_flags contains the kind field.
219 // This can be used to quickly discriminate among the five kinds of
220 // InstanceKlass.
221
222 static const unsigned _misc_kind_field_size = 3;
223 static const unsigned _misc_kind_field_pos = 0;
224 static const unsigned _misc_kind_field_mask = (1u << _misc_kind_field_size) - 1u;
225
226 static const unsigned _misc_kind_other = 0; // concrete InstanceKlass
227 static const unsigned _misc_kind_reference = 1; // InstanceRefKlass
228 static const unsigned _misc_kind_class_loader = 2; // InstanceClassLoaderKlass
229 static const unsigned _misc_kind_mirror = 3; // InstanceMirrorKlass
230 static const unsigned _misc_kind_value_type = 4; // ValueKlass
231
232 // Start after _misc_kind field.
233 enum {
234 _misc_rewritten = 1 << 3, // methods rewritten.
235 _misc_has_nonstatic_fields = 1 << 4, // for sizing with UseCompressedOops
525 bool is_in_error_state() const { return _init_state == initialization_error; }
526 bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; }
527 ClassState init_state() { return (ClassState)_init_state; }
528 bool is_rewritten() const { return (_misc_flags & _misc_rewritten) != 0; }
529
530 // defineClass specified verification
531 bool should_verify_class() const {
532 return (_misc_flags & _misc_should_verify_class) != 0;
533 }
534 void set_should_verify_class(bool value) {
535 if (value) {
536 _misc_flags |= _misc_should_verify_class;
537 } else {
538 _misc_flags &= ~_misc_should_verify_class;
539 }
540 }
541
542 // marking
543 bool is_marked_dependent() const { return _is_marked_dependent; }
544 void set_is_marked_dependent(bool value) { _is_marked_dependent = value; }
545
546 // initialization (virtuals from Klass)
547 bool should_be_initialized() const; // means that initialize should be called
548 void initialize(TRAPS);
549 void link_class(TRAPS);
550 bool link_class_or_fail(TRAPS); // returns false on failure
551 void unlink_class();
552 void rewrite_class(TRAPS);
553 void link_methods(TRAPS);
554 Method* class_initializer() const;
555
556 // set the class to initialized if no static initializer is present
557 void eager_initialize(Thread *thread);
558
559 // reference type
560 ReferenceType reference_type() const { return (ReferenceType)_reference_type; }
561 void set_reference_type(ReferenceType t) {
562 assert(t == (u1)t, "overflow");
563 _reference_type = (u1)t;
564 }
|
190
191 // Number of heapOopSize words used by non-static fields in this klass
192 // (including inherited fields but after header_size()).
193 int _nonstatic_field_size;
194 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass
195 // Constant pool index to the utf8 entry of the Generic signature,
196 // or 0 if none.
197 u2 _generic_signature_index;
198 // Constant pool index to the utf8 entry for the name of source file
199 // containing this klass, 0 if not specified.
200 u2 _source_file_name_index;
201 u2 _static_oop_field_count;// number of static oop fields in this klass
202 u2 _java_fields_count; // The number of declared Java fields
203 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
204
205 int _itable_len; // length of Java itable (in words)
206 // _is_marked_dependent can be set concurrently, thus cannot be part of the
207 // _misc_flags.
208 bool _is_marked_dependent; // used for marking during flushing and deoptimization
209
210 public:
211 enum {
212 _extra_is_being_redefined = 1 << 0, // used for locking redefinition
213 _extra_has_value_fields = 1 << 1, // has value fields and related embedded section is not empty
214 _extra_is_bufferable = 1 << 2, // value can be buffered out side of the Java heap
215 _extra_has_vcc_klass = 1 << 3 // has a pointer to its Value Capable Class (MVT)
216 };
217
218 protected:
219 u1 _extra_flags;
220
221 // The low three bits of _misc_flags contains the kind field.
222 // This can be used to quickly discriminate among the five kinds of
223 // InstanceKlass.
224
225 static const unsigned _misc_kind_field_size = 3;
226 static const unsigned _misc_kind_field_pos = 0;
227 static const unsigned _misc_kind_field_mask = (1u << _misc_kind_field_size) - 1u;
228
229 static const unsigned _misc_kind_other = 0; // concrete InstanceKlass
230 static const unsigned _misc_kind_reference = 1; // InstanceRefKlass
231 static const unsigned _misc_kind_class_loader = 2; // InstanceClassLoaderKlass
232 static const unsigned _misc_kind_mirror = 3; // InstanceMirrorKlass
233 static const unsigned _misc_kind_value_type = 4; // ValueKlass
234
235 // Start after _misc_kind field.
236 enum {
237 _misc_rewritten = 1 << 3, // methods rewritten.
238 _misc_has_nonstatic_fields = 1 << 4, // for sizing with UseCompressedOops
528 bool is_in_error_state() const { return _init_state == initialization_error; }
529 bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; }
530 ClassState init_state() { return (ClassState)_init_state; }
531 bool is_rewritten() const { return (_misc_flags & _misc_rewritten) != 0; }
532
533 // defineClass specified verification
534 bool should_verify_class() const {
535 return (_misc_flags & _misc_should_verify_class) != 0;
536 }
537 void set_should_verify_class(bool value) {
538 if (value) {
539 _misc_flags |= _misc_should_verify_class;
540 } else {
541 _misc_flags &= ~_misc_should_verify_class;
542 }
543 }
544
545 // marking
546 bool is_marked_dependent() const { return _is_marked_dependent; }
547 void set_is_marked_dependent(bool value) { _is_marked_dependent = value; }
548
549 static ByteSize extra_flags_offset() { return in_ByteSize(offset_of(InstanceKlass, _extra_flags)); }
550
551 // initialization (virtuals from Klass)
552 bool should_be_initialized() const; // means that initialize should be called
553 void initialize(TRAPS);
554 void link_class(TRAPS);
555 bool link_class_or_fail(TRAPS); // returns false on failure
556 void unlink_class();
557 void rewrite_class(TRAPS);
558 void link_methods(TRAPS);
559 Method* class_initializer() const;
560
561 // set the class to initialized if no static initializer is present
562 void eager_initialize(Thread *thread);
563
564 // reference type
565 ReferenceType reference_type() const { return (ReferenceType)_reference_type; }
566 void set_reference_type(ReferenceType t) {
567 assert(t == (u1)t, "overflow");
568 _reference_type = (u1)t;
569 }
|