< prev index next >

src/hotspot/share/ci/ciInstanceKlass.hpp

Print this page

 51   jobject                _loader;
 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 
 63   ciFlags                _flags;
 64 
 65   // Lazy fields get filled in only upon request.
 66   ciInstanceKlass*       _super;
 67   ciInstance*            _java_mirror;
 68 
 69   ciConstantPoolCache*   _field_cache;  // cached map index->field
 70   GrowableArray<ciField*>* _nonstatic_fields;

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

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


206 
207   // total number of nonstatic fields (including inherited):
208   int nof_nonstatic_fields() {
209     if (_nonstatic_fields == NULL)
210       return compute_nonstatic_fields();
211     else
212       return _nonstatic_fields->length();

213   }
214 
215   bool has_injected_fields() {
216     if (_has_injected_fields == -1) {
217       compute_injected_fields();
218     }
219     return _has_injected_fields > 0 ? true : false;
220   }
221 
222   bool has_object_fields() const;
223 
224   // nth nonstatic field (presented by ascending address)
225   ciField* nonstatic_field_at(int i) {
226     assert(_nonstatic_fields != NULL, "");
227     return _nonstatic_fields->at(i);
228   }
229 
230   ciInstanceKlass* unique_concrete_subklass();
231   bool has_finalizable_subclass();
232 

240   // Java access flags
241   bool is_public      () { return flags().is_public(); }
242   bool is_final       () { return flags().is_final(); }
243   bool is_super       () { return flags().is_super(); }
244   bool is_interface   () { return flags().is_interface(); }
245   bool is_abstract    () { return flags().is_abstract(); }
246 
247   ciMethod* find_method(ciSymbol* name, ciSymbol* signature);
248   // Note:  To find a method from name and type strings, use ciSymbol::make,
249   // but consider adding to vmSymbols.hpp instead.
250 
251   bool is_leaf_type();
252   ciInstanceKlass* implementor();
253 
254   ciInstanceKlass* unique_implementor() {
255     assert(is_loaded(), "must be loaded");
256     ciInstanceKlass* impl = implementor();
257     return (impl != this ? impl : NULL);
258   }
259 


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

 51   jobject                _loader;
 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 
 63   ciFlags                _flags;
 64 
 65   // Lazy fields get filled in only upon request.
 66   ciInstanceKlass*       _super;
 67   ciInstance*            _java_mirror;
 68 
 69   ciConstantPoolCache*   _field_cache;  // cached map index->field
 70   GrowableArray<ciField*>* _nonstatic_fields;
 71 
 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 
 80   void compute_injected_fields();
 81   bool compute_injected_fields_helper();
 82 
 83 protected:
 84   ciInstanceKlass(Klass* k);
 85   ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain, BasicType bt = T_OBJECT); // for unloaded klasses
 86 
 87   InstanceKlass* get_instanceKlass() const {
 88     return InstanceKlass::cast(get_Klass());
 89   }
 90 
 91   oop loader();
 92   jobject loader_handle();
 93 
 94   oop protection_domain();
 95   jobject protection_domain_handle();
 96 
 97   const char* type_string() { return "ciInstanceKlass"; }
 98 
 99   bool is_in_package_impl(const char* packagename, int len);
100 
101   void print_impl(outputStream* st);
102 
103   ciConstantPoolCache* field_cache();
104 
105   bool is_shared() { return _is_shared; }
106 
107   void compute_shared_init_state();
108   bool compute_shared_has_subklass();
109   virtual int compute_nonstatic_fields();
110   GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields, bool flatten = true);
111 
112   // Update the init_state for shared klasses
113   void update_if_shared(InstanceKlass::ClassState expected) {
114     if (_is_shared && _init_state != expected) {
115       if (is_loaded()) compute_shared_init_state();
116     }
117   }
118 
119 public:
120   // Has this klass been initialized?
121   bool                   is_initialized() {
122     update_if_shared(InstanceKlass::fully_initialized);
123     return _init_state == InstanceKlass::fully_initialized;
124   }
125   bool                   is_not_initialized() {
126     update_if_shared(InstanceKlass::fully_initialized);
127     return _init_state < InstanceKlass::being_initialized;
128   }
129   // Is this klass being initialized?
130   bool                   is_being_initialized() {

187     } else {
188       return 2;
189     }
190   }
191   bool has_nonstatic_concrete_methods()  {
192     assert(is_loaded(), "must be loaded");
193     return _has_nonstatic_concrete_methods;
194   }
195 
196   bool is_hidden() const {
197     return _is_hidden;
198   }
199 
200   bool is_record() const {
201     return _is_record;
202   }
203 
204   ciInstanceKlass* get_canonical_holder(int offset);
205   ciField* get_field_by_offset(int field_offset, bool is_static);
206   ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static);
207   // get field descriptor at field_offset ignoring flattening
208   ciField* get_non_flattened_field_by_offset(int field_offset);
209 
210   // total number of nonstatic fields (including inherited):
211   int nof_nonstatic_fields() {
212     if (_nonstatic_fields == NULL) {
213       return compute_nonstatic_fields();
214     } else {
215       return _nonstatic_fields->length();
216     }
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 != NULL, "");
231     return _nonstatic_fields->at(i);
232   }
233 
234   ciInstanceKlass* unique_concrete_subklass();
235   bool has_finalizable_subclass();
236 

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 : NULL);
262   }
263 
264   virtual bool can_be_inline_klass(bool is_exact = false);
265 
266   // Is the defining class loader of this class the default loader?
267   bool uses_default_loader() const;
268 
269   bool is_java_lang_Object() const;
270 
271   BasicType box_klass_type() const;
272   bool is_box_klass() const;
273   bool is_boxed_value_offset(int offset) const;
274   bool is_box_cache_valid() const;
275 
276   // Is this klass in the given package?
277   bool is_in_package(const char* packagename) {
278     return is_in_package(packagename, (int) strlen(packagename));
279   }
280   bool is_in_package(const char* packagename, int len);
281 
282   // What kind of ciObject is this?
283   bool is_instance_klass() const { return true; }
284 
285   virtual ciKlass* exact_klass() {
< prev index next >