144 // (the 64-bit chunk goes first, to avoid some fragmentation)
145 jlong _last_biased_lock_bulk_revocation_time;
146 markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type
147 jint _biased_lock_revocation_count;
148
149 // vtable length
150 int _vtable_len;
151
152 private:
153 // This is an index into FileMapHeader::_classpath_entry_table[], to
154 // associate this class with the JAR file where it's loaded from during
155 // dump time. If a class is not loaded from the shared archive, this field is
156 // -1.
157 jshort _shared_class_path_index;
158
159 friend class SharedClassUtil;
160 protected:
161
162 // Constructor
163 Klass();
164
165 void* operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw();
166
167 public:
168 enum DefaultsLookupMode { find_defaults, skip_defaults };
169 enum OverpassLookupMode { find_overpass, skip_overpass };
170 enum StaticLookupMode { find_static, skip_static };
171 enum PrivateLookupMode { find_private, skip_private };
172
173 bool is_klass() const volatile { return true; }
174
175 // super
176 Klass* super() const { return _super; }
177 void set_super(Klass* k) { _super = k; }
178
179 // initializes _super link, _primary_supers & _secondary_supers arrays
180 void initialize_supers(Klass* k, TRAPS);
181 void initialize_supers_impl1(Klass* k);
182 void initialize_supers_impl2(Klass* k);
183
184 // klass-specific helper for initializing _secondary_supers
185 virtual GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
545 AccessFlags access_flags() const { return _access_flags; }
546 void set_access_flags(AccessFlags flags) { _access_flags = flags; }
547
548 bool is_public() const { return _access_flags.is_public(); }
549 bool is_final() const { return _access_flags.is_final(); }
550 bool is_interface() const { return _access_flags.is_interface(); }
551 bool is_abstract() const { return _access_flags.is_abstract(); }
552 bool is_super() const { return _access_flags.is_super(); }
553 bool is_synthetic() const { return _access_flags.is_synthetic(); }
554 void set_is_synthetic() { _access_flags.set_is_synthetic(); }
555 bool has_finalizer() const { return _access_flags.has_finalizer(); }
556 bool has_final_method() const { return _access_flags.has_final_method(); }
557 void set_has_finalizer() { _access_flags.set_has_finalizer(); }
558 void set_has_final_method() { _access_flags.set_has_final_method(); }
559 bool has_vanilla_constructor() const { return _access_flags.has_vanilla_constructor(); }
560 void set_has_vanilla_constructor() { _access_flags.set_has_vanilla_constructor(); }
561 bool has_miranda_methods () const { return access_flags().has_miranda_methods(); }
562 void set_has_miranda_methods() { _access_flags.set_has_miranda_methods(); }
563 bool is_shared() const { return access_flags().is_shared_class(); } // shadows MetaspaceObj::is_shared)()
564 void set_is_shared() { _access_flags.set_is_shared_class(); }
565
566 bool is_cloneable() const;
567 void set_is_cloneable();
568
569 // Biased locking support
570 // Note: the prototype header is always set up to be at least the
571 // prototype markOop. If biased locking is enabled it may further be
572 // biasable and have an epoch.
573 markOop prototype_header() const { return _prototype_header; }
574 // NOTE: once instances of this klass are floating around in the
575 // system, this header must only be updated at a safepoint.
576 // NOTE 2: currently we only ever set the prototype header to the
577 // biasable prototype for instanceKlasses. There is no technical
578 // reason why it could not be done for arrayKlasses aside from
579 // wanting to reduce the initial scope of this optimization. There
580 // are potential problems in setting the bias pattern for
581 // JVM-internal oops.
582 inline void set_prototype_header(markOop header);
583 static ByteSize prototype_header_offset() { return in_ByteSize(offset_of(Klass, _prototype_header)); }
584
585 int biased_lock_revocation_count() const { return (int) _biased_lock_revocation_count; }
660 // Verification
661 virtual void verify_on(outputStream* st);
662 void verify() { verify_on(tty); }
663
664 #ifndef PRODUCT
665 bool verify_vtable_index(int index);
666 bool verify_itable_index(int index);
667 #endif
668
669 virtual void oop_verify_on(oop obj, outputStream* st);
670
671 static bool is_null(narrowKlass obj);
672 static bool is_null(Klass* obj);
673
674 // klass encoding for klass pointer in objects.
675 static narrowKlass encode_klass_not_null(Klass* v);
676 static narrowKlass encode_klass(Klass* v);
677
678 static Klass* decode_klass_not_null(narrowKlass v);
679 static Klass* decode_klass(narrowKlass v);
680 };
681
682 // Helper to convert the oop iterate macro suffixes into bool values that can be used by template functions.
683 #define nvs_nv_to_bool true
684 #define nvs_v_to_bool false
685 #define nvs_to_bool(nv_suffix) nvs##nv_suffix##_to_bool
686
687 // Oop iteration macros for declarations.
688 // Used to generate declarations in the *Klass header files.
689
690 #define OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
691 void oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure); \
692 void oop_oop_iterate_bounded##nv_suffix(oop obj, OopClosureType* closure, MemRegion mr);
693
694 #if INCLUDE_ALL_GCS
695 #define OOP_OOP_ITERATE_DECL_BACKWARDS(OopClosureType, nv_suffix) \
696 void oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure);
697 #endif // INCLUDE_ALL_GCS
698
699
|
144 // (the 64-bit chunk goes first, to avoid some fragmentation)
145 jlong _last_biased_lock_bulk_revocation_time;
146 markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type
147 jint _biased_lock_revocation_count;
148
149 // vtable length
150 int _vtable_len;
151
152 private:
153 // This is an index into FileMapHeader::_classpath_entry_table[], to
154 // associate this class with the JAR file where it's loaded from during
155 // dump time. If a class is not loaded from the shared archive, this field is
156 // -1.
157 jshort _shared_class_path_index;
158
159 friend class SharedClassUtil;
160 protected:
161
162 // Constructor
163 Klass();
164 #if INCLUDE_VBC
165 void* operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, bool is_value, TRAPS) throw();
166 void* operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw() {
167 return operator new (size, loader_data, word_size, false, THREAD);
168 }
169 #else
170 void* operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw();
171 #endif
172
173 public:
174 enum DefaultsLookupMode { find_defaults, skip_defaults };
175 enum OverpassLookupMode { find_overpass, skip_overpass };
176 enum StaticLookupMode { find_static, skip_static };
177 enum PrivateLookupMode { find_private, skip_private };
178
179 bool is_klass() const volatile { return true; }
180
181 // super
182 Klass* super() const { return _super; }
183 void set_super(Klass* k) { _super = k; }
184
185 // initializes _super link, _primary_supers & _secondary_supers arrays
186 void initialize_supers(Klass* k, TRAPS);
187 void initialize_supers_impl1(Klass* k);
188 void initialize_supers_impl2(Klass* k);
189
190 // klass-specific helper for initializing _secondary_supers
191 virtual GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
551 AccessFlags access_flags() const { return _access_flags; }
552 void set_access_flags(AccessFlags flags) { _access_flags = flags; }
553
554 bool is_public() const { return _access_flags.is_public(); }
555 bool is_final() const { return _access_flags.is_final(); }
556 bool is_interface() const { return _access_flags.is_interface(); }
557 bool is_abstract() const { return _access_flags.is_abstract(); }
558 bool is_super() const { return _access_flags.is_super(); }
559 bool is_synthetic() const { return _access_flags.is_synthetic(); }
560 void set_is_synthetic() { _access_flags.set_is_synthetic(); }
561 bool has_finalizer() const { return _access_flags.has_finalizer(); }
562 bool has_final_method() const { return _access_flags.has_final_method(); }
563 void set_has_finalizer() { _access_flags.set_has_finalizer(); }
564 void set_has_final_method() { _access_flags.set_has_final_method(); }
565 bool has_vanilla_constructor() const { return _access_flags.has_vanilla_constructor(); }
566 void set_has_vanilla_constructor() { _access_flags.set_has_vanilla_constructor(); }
567 bool has_miranda_methods () const { return access_flags().has_miranda_methods(); }
568 void set_has_miranda_methods() { _access_flags.set_has_miranda_methods(); }
569 bool is_shared() const { return access_flags().is_shared_class(); } // shadows MetaspaceObj::is_shared)()
570 void set_is_shared() { _access_flags.set_is_shared_class(); }
571 #if INCLUDE_VBC
572 bool is_value_based() const { return access_flags().is_value_based_class(); }
573 void set_is_value_based() { _access_flags.set_is_value_based_class(); }
574 #endif
575 bool is_cloneable() const;
576 void set_is_cloneable();
577
578 // Biased locking support
579 // Note: the prototype header is always set up to be at least the
580 // prototype markOop. If biased locking is enabled it may further be
581 // biasable and have an epoch.
582 markOop prototype_header() const { return _prototype_header; }
583 // NOTE: once instances of this klass are floating around in the
584 // system, this header must only be updated at a safepoint.
585 // NOTE 2: currently we only ever set the prototype header to the
586 // biasable prototype for instanceKlasses. There is no technical
587 // reason why it could not be done for arrayKlasses aside from
588 // wanting to reduce the initial scope of this optimization. There
589 // are potential problems in setting the bias pattern for
590 // JVM-internal oops.
591 inline void set_prototype_header(markOop header);
592 static ByteSize prototype_header_offset() { return in_ByteSize(offset_of(Klass, _prototype_header)); }
593
594 int biased_lock_revocation_count() const { return (int) _biased_lock_revocation_count; }
669 // Verification
670 virtual void verify_on(outputStream* st);
671 void verify() { verify_on(tty); }
672
673 #ifndef PRODUCT
674 bool verify_vtable_index(int index);
675 bool verify_itable_index(int index);
676 #endif
677
678 virtual void oop_verify_on(oop obj, outputStream* st);
679
680 static bool is_null(narrowKlass obj);
681 static bool is_null(Klass* obj);
682
683 // klass encoding for klass pointer in objects.
684 static narrowKlass encode_klass_not_null(Klass* v);
685 static narrowKlass encode_klass(Klass* v);
686
687 static Klass* decode_klass_not_null(narrowKlass v);
688 static Klass* decode_klass(narrowKlass v);
689
690 #if INCLUDE_VBC
691 static bool decode_ptr_is_value_based(narrowKlass v);
692 static bool ptr_is_value_based(Klass* v);
693 #endif
694 };
695
696 // Helper to convert the oop iterate macro suffixes into bool values that can be used by template functions.
697 #define nvs_nv_to_bool true
698 #define nvs_v_to_bool false
699 #define nvs_to_bool(nv_suffix) nvs##nv_suffix##_to_bool
700
701 // Oop iteration macros for declarations.
702 // Used to generate declarations in the *Klass header files.
703
704 #define OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
705 void oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure); \
706 void oop_oop_iterate_bounded##nv_suffix(oop obj, OopClosureType* closure, MemRegion mr);
707
708 #if INCLUDE_ALL_GCS
709 #define OOP_OOP_ITERATE_DECL_BACKWARDS(OopClosureType, nv_suffix) \
710 void oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure);
711 #endif // INCLUDE_ALL_GCS
712
713
|