< 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);

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

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







1128   u2 compute_modifier_flags() const;
1129 
1130 public:
1131   // JVMTI support
1132   jint jvmti_class_status() const;
1133 
1134   virtual void metaspace_pointers_do(MetaspaceClosure* iter);
1135 
1136  public:
1137   // Printing
1138   void print_on(outputStream* st) const;
1139   void print_value_on(outputStream* st) const;
1140 
1141   void oop_print_value_on(oop obj, outputStream* st);
1142 
1143   void oop_print_on      (oop obj, outputStream* st);
1144 
1145 #ifndef PRODUCT
1146   void print_dependent_nmethods(bool verbose = false);
1147   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);

 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, const char* who, 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   bool     has_init_deps_processed() const { return _misc_flags.has_init_deps_processed(); }
1131   void set_has_init_deps_processed() {
1132     assert(is_initialized(), "");
1133     assert(!has_init_deps_processed(), "already set"); // one-off action
1134     _misc_flags.set_has_init_deps_processed(true);
1135   }
1136 
1137   u2 compute_modifier_flags() const;
1138 
1139 public:
1140   // JVMTI support
1141   jint jvmti_class_status() const;
1142 
1143   virtual void metaspace_pointers_do(MetaspaceClosure* iter);
1144 
1145  public:
1146   // Printing
1147   void print_on(outputStream* st) const;
1148   void print_value_on(outputStream* st) const;
1149 
1150   void oop_print_value_on(oop obj, outputStream* st);
1151 
1152   void oop_print_on      (oop obj, outputStream* st);
1153 
1154 #ifndef PRODUCT
1155   void print_dependent_nmethods(bool verbose = false);
1156   bool is_dependent_nmethod(nmethod* nm);
< prev index next >