< prev index next >

src/hotspot/share/oops/instanceKlass.hpp

Print this page

 506                                        TRAPS);
 507 
 508   JavaThread* init_thread()  { return Atomic::load(&_init_thread); }
 509   const char* init_thread_name() {
 510     return init_thread()->name_raw();
 511   }
 512 
 513  public:
 514   // initialization state
 515   bool is_loaded() const                   { return init_state() >= loaded; }
 516   bool is_linked() const                   { return init_state() >= linked; }
 517   bool is_initialized() const              { return init_state() == fully_initialized; }
 518   bool is_not_initialized() const          { return init_state() <  being_initialized; }
 519   bool is_being_initialized() const        { return init_state() == being_initialized; }
 520   bool is_in_error_state() const           { return init_state() == initialization_error; }
 521   bool is_reentrant_initialization(Thread *thread)  { return thread == _init_thread; }
 522   ClassState  init_state() const           { return Atomic::load_acquire(&_init_state); }
 523   const char* init_state_name() const;
 524   bool is_rewritten() const                { return _misc_flags.rewritten(); }
 525 


 526   // is this a sealed class
 527   bool is_sealed() const;
 528 
 529   // defineClass specified verification
 530   bool should_verify_class() const         { return _misc_flags.should_verify_class(); }
 531   void set_should_verify_class(bool value) { _misc_flags.set_should_verify_class(value); }
 532 
 533   // marking
 534   bool is_marked_dependent() const         { return _misc_flags.is_marked_dependent(); }
 535   void set_is_marked_dependent(bool value) { _misc_flags.set_is_marked_dependent(value); }
 536 
 537   // initialization (virtuals from Klass)
 538   bool should_be_initialized() const;  // means that initialize should be called
 539   void initialize_with_aot_initialized_mirror(TRAPS);
 540   void assert_no_clinit_will_run_for_aot_initialized_class() const NOT_DEBUG_RETURN;
 541   void initialize(TRAPS);
 542   void link_class(TRAPS);
 543   bool link_class_or_fail(TRAPS); // returns false on failure
 544   void rewrite_class(TRAPS);
 545   void link_methods(TRAPS);

 791   void update_methods_jmethod_cache();
 792 
 793   // annotations support
 794   Annotations* annotations() const          { return _annotations; }
 795   void set_annotations(Annotations* anno)   { _annotations = anno; }
 796 
 797   AnnotationArray* class_annotations() const {
 798     return (_annotations != nullptr) ? _annotations->class_annotations() : nullptr;
 799   }
 800   Array<AnnotationArray*>* fields_annotations() const {
 801     return (_annotations != nullptr) ? _annotations->fields_annotations() : nullptr;
 802   }
 803   AnnotationArray* class_type_annotations() const {
 804     return (_annotations != nullptr) ? _annotations->class_type_annotations() : nullptr;
 805   }
 806   Array<AnnotationArray*>* fields_type_annotations() const {
 807     return (_annotations != nullptr) ? _annotations->fields_type_annotations() : nullptr;
 808   }
 809   // allocation
 810   instanceOop allocate_instance(TRAPS);
 811   static instanceOop allocate_instance(oop cls, TRAPS);
 812 
 813   // additional member function to return a handle
 814   instanceHandle allocate_instance_handle(TRAPS);
 815 
 816   objArrayOop allocate_objArray(int n, int length, TRAPS);
 817   // Helper function
 818   static instanceOop register_finalizer(instanceOop i, TRAPS);
 819 
 820   // Check whether reflection/jni/jvm code is allowed to instantiate this class;
 821   // if not, throw either an Error or an Exception.
 822   virtual void check_valid_for_instantiation(bool throwError, TRAPS);
 823 
 824   // initialization
 825   void call_class_initializer(TRAPS);
 826   void set_initialization_state_and_notify(ClassState state, TRAPS);
 827 
 828   // OopMapCache support
 829   OopMapCache* oop_map_cache()               { return _oop_map_cache; }
 830   void set_oop_map_cache(OopMapCache *cache) { _oop_map_cache = cache; }
 831   void mask_for(const methodHandle& method, int bci, InterpreterOopMap* entry);

1071   // Must be one per class and it has to be a VM internal object so java code
1072   // cannot lock it (like the mirror).
1073   // It has to be an object not a Mutex because it's held through java calls.
1074   oop init_lock() const;
1075 
1076   // Returns the array class for the n'th dimension
1077   virtual ArrayKlass* array_klass(int n, TRAPS);
1078   virtual ArrayKlass* array_klass_or_null(int n);
1079 
1080   // Returns the array class with this class as element type
1081   virtual ArrayKlass* array_klass(TRAPS);
1082   virtual ArrayKlass* array_klass_or_null();
1083 
1084   static void clean_initialization_error_table();
1085 private:
1086   void fence_and_clear_init_lock();
1087 
1088   bool link_class_impl                           (TRAPS);
1089   bool verify_code                               (TRAPS);
1090   void initialize_impl                           (TRAPS);
1091   void initialize_super_interfaces               (TRAPS);
1092 
1093   void add_initialization_error(JavaThread* current, Handle exception);
1094   oop get_initialization_error(JavaThread* current);
1095 
1096   // find a local method (returns null if not found)
1097   Method* find_method_impl(const Symbol* name,
1098                            const Symbol* signature,
1099                            OverpassLookupMode overpass_mode,
1100                            StaticLookupMode static_mode,
1101                            PrivateLookupMode private_mode) const;
1102 
1103   static Method* find_method_impl(const Array<Method*>* methods,
1104                                   const Symbol* name,
1105                                   const Symbol* signature,
1106                                   OverpassLookupMode overpass_mode,
1107                                   StaticLookupMode static_mode,
1108                                   PrivateLookupMode private_mode);
1109 
1110 #if INCLUDE_JVMTI
1111   // RedefineClasses support
1112   void link_previous_versions(InstanceKlass* pv) { _previous_versions = pv; }
1113   void mark_newly_obsolete_methods(Array<Method*>* old_methods, int emcp_method_count);
1114 #endif
1115   // log class name to classlist
1116   void log_to_classlist() const;
1117 public:
1118 
1119 #if INCLUDE_CDS
1120   // CDS support - remove and restore oops from metadata. Oops are not shared.
1121   virtual void remove_unshareable_info();
1122   void remove_unshareable_flags();
1123   virtual void remove_java_mirror();
1124   void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, PackageEntry* pkg_entry, TRAPS);
1125   void init_shared_package_entry();
1126   bool can_be_verified_at_dumptime() const;
1127   void compute_has_loops_flag_for_methods();
1128 #endif
1129 







1130   jint compute_modifier_flags() const;
1131 
1132 public:
1133   // JVMTI support
1134   jint jvmti_class_status() const;
1135 
1136   virtual void metaspace_pointers_do(MetaspaceClosure* iter);
1137 
1138  public:
1139   // Printing
1140   void print_on(outputStream* st) const;
1141   void print_value_on(outputStream* st) const;
1142 
1143   void oop_print_value_on(oop obj, outputStream* st);
1144 
1145   void oop_print_on      (oop obj, outputStream* st);
1146 
1147 #ifndef PRODUCT
1148   void print_dependent_nmethods(bool verbose = false);
1149   bool is_dependent_nmethod(nmethod* nm);

 506                                        TRAPS);
 507 
 508   JavaThread* init_thread()  { return Atomic::load(&_init_thread); }
 509   const char* init_thread_name() {
 510     return init_thread()->name_raw();
 511   }
 512 
 513  public:
 514   // initialization state
 515   bool is_loaded() const                   { return init_state() >= loaded; }
 516   bool is_linked() const                   { return init_state() >= linked; }
 517   bool is_initialized() const              { return init_state() == fully_initialized; }
 518   bool is_not_initialized() const          { return init_state() <  being_initialized; }
 519   bool is_being_initialized() const        { return init_state() == being_initialized; }
 520   bool is_in_error_state() const           { return init_state() == initialization_error; }
 521   bool is_reentrant_initialization(Thread *thread)  { return thread == _init_thread; }
 522   ClassState  init_state() const           { return Atomic::load_acquire(&_init_state); }
 523   const char* init_state_name() const;
 524   bool is_rewritten() const                { return _misc_flags.rewritten(); }
 525 
 526   static const char* state2name(ClassState state);
 527 
 528   // is this a sealed class
 529   bool is_sealed() const;
 530 
 531   // defineClass specified verification
 532   bool should_verify_class() const         { return _misc_flags.should_verify_class(); }
 533   void set_should_verify_class(bool value) { _misc_flags.set_should_verify_class(value); }
 534 
 535   // marking
 536   bool is_marked_dependent() const         { return _misc_flags.is_marked_dependent(); }
 537   void set_is_marked_dependent(bool value) { _misc_flags.set_is_marked_dependent(value); }
 538 
 539   // initialization (virtuals from Klass)
 540   bool should_be_initialized() const;  // means that initialize should be called
 541   void initialize_with_aot_initialized_mirror(TRAPS);
 542   void assert_no_clinit_will_run_for_aot_initialized_class() const NOT_DEBUG_RETURN;
 543   void initialize(TRAPS);
 544   void link_class(TRAPS);
 545   bool link_class_or_fail(TRAPS); // returns false on failure
 546   void rewrite_class(TRAPS);
 547   void link_methods(TRAPS);

 793   void update_methods_jmethod_cache();
 794 
 795   // annotations support
 796   Annotations* annotations() const          { return _annotations; }
 797   void set_annotations(Annotations* anno)   { _annotations = anno; }
 798 
 799   AnnotationArray* class_annotations() const {
 800     return (_annotations != nullptr) ? _annotations->class_annotations() : nullptr;
 801   }
 802   Array<AnnotationArray*>* fields_annotations() const {
 803     return (_annotations != nullptr) ? _annotations->fields_annotations() : nullptr;
 804   }
 805   AnnotationArray* class_type_annotations() const {
 806     return (_annotations != nullptr) ? _annotations->class_type_annotations() : nullptr;
 807   }
 808   Array<AnnotationArray*>* fields_type_annotations() const {
 809     return (_annotations != nullptr) ? _annotations->fields_type_annotations() : nullptr;
 810   }
 811   // allocation
 812   instanceOop allocate_instance(TRAPS);
 813   static instanceOop allocate_instance(oop cls, const char* who, TRAPS);
 814 
 815   // additional member function to return a handle
 816   instanceHandle allocate_instance_handle(TRAPS);
 817 
 818   objArrayOop allocate_objArray(int n, int length, TRAPS);
 819   // Helper function
 820   static instanceOop register_finalizer(instanceOop i, TRAPS);
 821 
 822   // Check whether reflection/jni/jvm code is allowed to instantiate this class;
 823   // if not, throw either an Error or an Exception.
 824   virtual void check_valid_for_instantiation(bool throwError, TRAPS);
 825 
 826   // initialization
 827   void call_class_initializer(TRAPS);
 828   void set_initialization_state_and_notify(ClassState state, TRAPS);
 829 
 830   // OopMapCache support
 831   OopMapCache* oop_map_cache()               { return _oop_map_cache; }
 832   void set_oop_map_cache(OopMapCache *cache) { _oop_map_cache = cache; }
 833   void mask_for(const methodHandle& method, int bci, InterpreterOopMap* entry);

1073   // Must be one per class and it has to be a VM internal object so java code
1074   // cannot lock it (like the mirror).
1075   // It has to be an object not a Mutex because it's held through java calls.
1076   oop init_lock() const;
1077 
1078   // Returns the array class for the n'th dimension
1079   virtual ArrayKlass* array_klass(int n, TRAPS);
1080   virtual ArrayKlass* array_klass_or_null(int n);
1081 
1082   // Returns the array class with this class as element type
1083   virtual ArrayKlass* array_klass(TRAPS);
1084   virtual ArrayKlass* array_klass_or_null();
1085 
1086   static void clean_initialization_error_table();
1087 private:
1088   void fence_and_clear_init_lock();
1089 
1090   bool link_class_impl                           (TRAPS);
1091   bool verify_code                               (TRAPS);
1092   void initialize_impl                           (TRAPS);
1093   void initialize_super_interfaces(TRAPS);
1094 
1095   void add_initialization_error(JavaThread* current, Handle exception);
1096   oop get_initialization_error(JavaThread* current);
1097 
1098   // find a local method (returns null if not found)
1099   Method* find_method_impl(const Symbol* name,
1100                            const Symbol* signature,
1101                            OverpassLookupMode overpass_mode,
1102                            StaticLookupMode static_mode,
1103                            PrivateLookupMode private_mode) const;
1104 
1105   static Method* find_method_impl(const Array<Method*>* methods,
1106                                   const Symbol* name,
1107                                   const Symbol* signature,
1108                                   OverpassLookupMode overpass_mode,
1109                                   StaticLookupMode static_mode,
1110                                   PrivateLookupMode private_mode);
1111 
1112 #if INCLUDE_JVMTI
1113   // RedefineClasses support
1114   void link_previous_versions(InstanceKlass* pv) { _previous_versions = pv; }
1115   void mark_newly_obsolete_methods(Array<Method*>* old_methods, int emcp_method_count);
1116 #endif
1117   // log class name to classlist
1118   void log_to_classlist() const;
1119 public:
1120 
1121 #if INCLUDE_CDS
1122   // CDS support - remove and restore oops from metadata. Oops are not shared.
1123   virtual void remove_unshareable_info();
1124   void remove_unshareable_flags();
1125   virtual void remove_java_mirror();
1126   void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, PackageEntry* pkg_entry, TRAPS);
1127   void init_shared_package_entry();
1128   bool can_be_verified_at_dumptime() const;
1129   void compute_has_loops_flag_for_methods();
1130 #endif
1131 
1132   bool     has_init_deps_processed() const { return _misc_flags.has_init_deps_processed(); }
1133   void set_has_init_deps_processed() {
1134     assert(is_initialized(), "");
1135     assert(!has_init_deps_processed(), "already set"); // one-off action
1136     _misc_flags.set_has_init_deps_processed(true);
1137   }
1138 
1139   jint compute_modifier_flags() const;
1140 
1141 public:
1142   // JVMTI support
1143   jint jvmti_class_status() const;
1144 
1145   virtual void metaspace_pointers_do(MetaspaceClosure* iter);
1146 
1147  public:
1148   // Printing
1149   void print_on(outputStream* st) const;
1150   void print_value_on(outputStream* st) const;
1151 
1152   void oop_print_value_on(oop obj, outputStream* st);
1153 
1154   void oop_print_on      (oop obj, outputStream* st);
1155 
1156 #ifndef PRODUCT
1157   void print_dependent_nmethods(bool verbose = false);
1158   bool is_dependent_nmethod(nmethod* nm);
< prev index next >