< prev index next >

src/hotspot/share/ci/ciInstanceKlass.hpp

Print this page

 52   jobject                _protection_domain;
 53 
 54   InstanceKlass::ClassState _init_state;           // state of class
 55   bool                   _is_shared;
 56   bool                   _has_finalizer;
 57   SubklassValue          _has_subklass;
 58   bool                   _has_nonstatic_fields;
 59   bool                   _has_nonstatic_concrete_methods;
 60   bool                   _is_hidden;
 61   bool                   _is_record;
 62   bool                   _has_trusted_loader;
 63 
 64   ciFlags                _flags;
 65 
 66   // Lazy fields get filled in only upon request.
 67   ciInstanceKlass*       _super;
 68   ciInstance*            _java_mirror;
 69 
 70   ciConstantPoolCache*   _field_cache;  // cached map index->field
 71   GrowableArray<ciField*>* _nonstatic_fields;

 72   int                    _has_injected_fields; // any non static injected fields? lazily initialized.
 73 
 74   // The possible values of the _implementor fall into following three cases:
 75   //   null: no implementor.
 76   //   A ciInstanceKlass that's not itself: one implementor.
 77   //   Itself: more than one implementor.
 78   ciInstanceKlass*       _implementor;
 79   GrowableArray<ciInstanceKlass*>* _transitive_interfaces;
 80 
 81   void compute_injected_fields();
 82   bool compute_injected_fields_helper();
 83   void compute_transitive_interfaces();
 84 
 85 protected:
 86   ciInstanceKlass(Klass* k);
 87   ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain);
 88 
 89   InstanceKlass* get_instanceKlass() const {
 90     return InstanceKlass::cast(get_Klass());
 91   }
 92 
 93   oop loader();
 94   jobject loader_handle();
 95 
 96   oop protection_domain();
 97   jobject protection_domain_handle();
 98 
 99   const char* type_string() { return "ciInstanceKlass"; }
100 
101   bool is_in_package_impl(const char* packagename, int len);
102 
103   void print_impl(outputStream* st);
104 
105   ciConstantPoolCache* field_cache();
106 
107   bool is_shared() { return _is_shared; }
108 
109   void compute_shared_init_state();
110   bool compute_shared_has_subklass();
111   int  compute_nonstatic_fields();
112   GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields);
113   bool compute_has_trusted_loader();
114 
115   // Update the init_state for shared klasses
116   void update_if_shared(InstanceKlass::ClassState expected) {
117     if (_is_shared && _init_state != expected) {
118       if (is_loaded()) compute_shared_init_state();
119     }
120   }
121 
122 public:
123   // Has this klass been initialized?
124   bool                   is_initialized() {
125     update_if_shared(InstanceKlass::fully_initialized);
126     return _init_state == InstanceKlass::fully_initialized;
127   }
128   bool                   is_not_initialized() {
129     update_if_shared(InstanceKlass::fully_initialized);
130     return _init_state < InstanceKlass::being_initialized;
131   }
132   // Is this klass being initialized?

190     } else {
191       return 2;
192     }
193   }
194   bool has_nonstatic_concrete_methods()  {
195     assert(is_loaded(), "must be loaded");
196     return _has_nonstatic_concrete_methods;
197   }
198 
199   bool is_hidden() const {
200     return _is_hidden;
201   }
202 
203   bool is_record() const {
204     return _is_record;
205   }
206 
207   ciInstanceKlass* get_canonical_holder(int offset);
208   ciField* get_field_by_offset(int field_offset, bool is_static);
209   ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static);


210 
211   // total number of nonstatic fields (including inherited):
212   int nof_nonstatic_fields() {
213     if (_nonstatic_fields == nullptr)
214       return compute_nonstatic_fields();
215     else
216       return _nonstatic_fields->length();

217   }
218 
219   bool has_injected_fields() {
220     if (_has_injected_fields == -1) {
221       compute_injected_fields();
222     }
223     return _has_injected_fields > 0 ? true : false;
224   }
225 
226   bool has_object_fields() const;
227 
228   // nth nonstatic field (presented by ascending address)
229   ciField* nonstatic_field_at(int i) {
230     assert(_nonstatic_fields != nullptr, "");
231     return _nonstatic_fields->at(i);
232   }
233 
234   ciInstanceKlass* unique_concrete_subklass();
235   bool has_finalizable_subclass();
236 
237   bool contains_field_offset(int offset);
238 
239   // Get the instance of java.lang.Class corresponding to
240   // this klass.  This instance is used for locking of
241   // synchronized static methods of this klass.
242   ciInstance*            java_mirror();
243 
244   // Java access flags
245   bool is_public      () { return flags().is_public(); }
246   bool is_final       () { return flags().is_final(); }
247   bool is_super       () { return flags().is_super(); }
248   bool is_interface   () { return flags().is_interface(); }
249   bool is_abstract    () { return flags().is_abstract(); }
250 
251   ciMethod* find_method(ciSymbol* name, ciSymbol* signature);
252   // Note:  To find a method from name and type strings, use ciSymbol::make,
253   // but consider adding to vmSymbols.hpp instead.
254 
255   bool is_leaf_type();
256   ciInstanceKlass* implementor();
257 
258   ciInstanceKlass* unique_implementor() {
259     assert(is_loaded(), "must be loaded");
260     ciInstanceKlass* impl = implementor();
261     return (impl != this ? impl : nullptr);
262   }
263 


264   // Is the defining class loader of this class the default loader?
265   bool uses_default_loader() const;
266 
267   bool is_java_lang_Object() const;
268 
269   BasicType box_klass_type() const;
270   bool is_box_klass() const;
271   bool is_boxed_value_offset(int offset) const;
272 
273   // Is this klass in the given package?
274   bool is_in_package(const char* packagename) {
275     return is_in_package(packagename, (int) strlen(packagename));
276   }
277   bool is_in_package(const char* packagename, int len);
278 
279   // What kind of ciObject is this?
280   bool is_instance_klass() const { return true; }
281 
282   virtual ciKlass* exact_klass() {
283     if (is_loaded() && is_final() && !is_interface()) {

 52   jobject                _protection_domain;
 53 
 54   InstanceKlass::ClassState _init_state;           // state of class
 55   bool                   _is_shared;
 56   bool                   _has_finalizer;
 57   SubklassValue          _has_subklass;
 58   bool                   _has_nonstatic_fields;
 59   bool                   _has_nonstatic_concrete_methods;
 60   bool                   _is_hidden;
 61   bool                   _is_record;
 62   bool                   _has_trusted_loader;
 63 
 64   ciFlags                _flags;
 65 
 66   // Lazy fields get filled in only upon request.
 67   ciInstanceKlass*       _super;
 68   ciInstance*            _java_mirror;
 69 
 70   ciConstantPoolCache*   _field_cache;  // cached map index->field
 71   GrowableArray<ciField*>* _nonstatic_fields;
 72 
 73   int                    _has_injected_fields; // any non static injected fields? lazily initialized.
 74 
 75   // The possible values of the _implementor fall into following three cases:
 76   //   null: no implementor.
 77   //   A ciInstanceKlass that's not itself: one implementor.
 78   //   Itself: more than one implementor.
 79   ciInstanceKlass*       _implementor;
 80   GrowableArray<ciInstanceKlass*>* _transitive_interfaces;
 81 
 82   void compute_injected_fields();
 83   bool compute_injected_fields_helper();
 84   void compute_transitive_interfaces();
 85 
 86 protected:
 87   ciInstanceKlass(Klass* k);
 88   ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain, BasicType bt = T_OBJECT); // for unloaded klasses
 89 
 90   InstanceKlass* get_instanceKlass() const {
 91     return InstanceKlass::cast(get_Klass());
 92   }
 93 
 94   oop loader();
 95   jobject loader_handle();
 96 
 97   oop protection_domain();
 98   jobject protection_domain_handle();
 99 
100   const char* type_string() { return "ciInstanceKlass"; }
101 
102   bool is_in_package_impl(const char* packagename, int len);
103 
104   void print_impl(outputStream* st);
105 
106   ciConstantPoolCache* field_cache();
107 
108   bool is_shared() { return _is_shared; }
109 
110   void compute_shared_init_state();
111   bool compute_shared_has_subklass();
112   virtual int compute_nonstatic_fields();
113   GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields, bool flatten = true);
114   bool compute_has_trusted_loader();
115 
116   // Update the init_state for shared klasses
117   void update_if_shared(InstanceKlass::ClassState expected) {
118     if (_is_shared && _init_state != expected) {
119       if (is_loaded()) compute_shared_init_state();
120     }
121   }
122 
123 public:
124   // Has this klass been initialized?
125   bool                   is_initialized() {
126     update_if_shared(InstanceKlass::fully_initialized);
127     return _init_state == InstanceKlass::fully_initialized;
128   }
129   bool                   is_not_initialized() {
130     update_if_shared(InstanceKlass::fully_initialized);
131     return _init_state < InstanceKlass::being_initialized;
132   }
133   // Is this klass being initialized?

191     } else {
192       return 2;
193     }
194   }
195   bool has_nonstatic_concrete_methods()  {
196     assert(is_loaded(), "must be loaded");
197     return _has_nonstatic_concrete_methods;
198   }
199 
200   bool is_hidden() const {
201     return _is_hidden;
202   }
203 
204   bool is_record() const {
205     return _is_record;
206   }
207 
208   ciInstanceKlass* get_canonical_holder(int offset);
209   ciField* get_field_by_offset(int field_offset, bool is_static);
210   ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static);
211   // get field descriptor at field_offset ignoring flattening
212   ciField* get_non_flat_field_by_offset(int field_offset);
213 
214   // total number of nonstatic fields (including inherited):
215   int nof_nonstatic_fields() {
216     if (_nonstatic_fields == nullptr) {
217       return compute_nonstatic_fields();
218     } else {
219       return _nonstatic_fields->length();
220     }
221   }
222 
223   bool has_injected_fields() {
224     if (_has_injected_fields == -1) {
225       compute_injected_fields();
226     }
227     return _has_injected_fields > 0 ? true : false;
228   }
229 
230   bool has_object_fields() const;
231 
232   // nth nonstatic field (presented by ascending address)
233   ciField* nonstatic_field_at(int i) {
234     assert(_nonstatic_fields != nullptr, "");
235     return _nonstatic_fields->at(i);
236   }
237 
238   ciInstanceKlass* unique_concrete_subklass();
239   bool has_finalizable_subclass();
240 
241   bool contains_field_offset(int offset);
242 
243   // Get the instance of java.lang.Class corresponding to
244   // this klass.  This instance is used for locking of
245   // synchronized static methods of this klass.
246   ciInstance*            java_mirror();
247 
248   // Java access flags
249   bool is_public      () { return flags().is_public(); }
250   bool is_final       () { return flags().is_final(); }

251   bool is_interface   () { return flags().is_interface(); }
252   bool is_abstract    () { return flags().is_abstract(); }
253 
254   ciMethod* find_method(ciSymbol* name, ciSymbol* signature);
255   // Note:  To find a method from name and type strings, use ciSymbol::make,
256   // but consider adding to vmSymbols.hpp instead.
257 
258   bool is_leaf_type();
259   ciInstanceKlass* implementor();
260 
261   ciInstanceKlass* unique_implementor() {
262     assert(is_loaded(), "must be loaded");
263     ciInstanceKlass* impl = implementor();
264     return (impl != this ? impl : nullptr);
265   }
266 
267   virtual bool can_be_inline_klass(bool is_exact = false);
268 
269   // Is the defining class loader of this class the default loader?
270   bool uses_default_loader() const;
271 
272   bool is_java_lang_Object() const;
273 
274   BasicType box_klass_type() const;
275   bool is_box_klass() const;
276   bool is_boxed_value_offset(int offset) const;
277 
278   // Is this klass in the given package?
279   bool is_in_package(const char* packagename) {
280     return is_in_package(packagename, (int) strlen(packagename));
281   }
282   bool is_in_package(const char* packagename, int len);
283 
284   // What kind of ciObject is this?
285   bool is_instance_klass() const { return true; }
286 
287   virtual ciKlass* exact_klass() {
288     if (is_loaded() && is_final() && !is_interface()) {
< prev index next >