< prev index next >

src/hotspot/share/ci/ciInstanceKlass.hpp

Print this page

 52 
 53   InstanceKlass::ClassState _init_state;           // state of class
 54   bool                   _is_shared;
 55   bool                   _has_finalizer;
 56   SubklassValue          _has_subklass;
 57   bool                   _has_nonstatic_fields;
 58   bool                   _has_nonstatic_concrete_methods;
 59   bool                   _is_hidden;
 60   bool                   _is_record;
 61 
 62   ciFlags                _flags;
 63   jint                   _nonstatic_field_size;
 64   jint                   _nonstatic_oop_map_size;
 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 
 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);
 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   int  compute_nonstatic_fields();
110   GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields);
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() {

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


213 
214   // total number of nonstatic fields (including inherited):
215   int nof_nonstatic_fields() {
216     if (_nonstatic_fields == NULL)
217       return compute_nonstatic_fields();
218     else
219       return _nonstatic_fields->length();

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

247   // Java access flags
248   bool is_public      () { return flags().is_public(); }
249   bool is_final       () { return flags().is_final(); }
250   bool is_super       () { return flags().is_super(); }
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 : NULL);
265   }
266 


267   // Is the defining class loader of this class the default loader?
268   bool uses_default_loader() const;
269 
270   bool is_java_lang_Object() const;
271 
272   BasicType box_klass_type() const;
273   bool is_box_klass() const;
274   bool is_boxed_value_offset(int offset) const;
275   bool is_box_cache_valid() const;
276 
277   // Is this klass in the given package?
278   bool is_in_package(const char* packagename) {
279     return is_in_package(packagename, (int) strlen(packagename));
280   }
281   bool is_in_package(const char* packagename, int len);
282 
283   // What kind of ciObject is this?
284   bool is_instance_klass() const { return true; }
285   bool is_java_klass() const     { return true; }
286 

 52 
 53   InstanceKlass::ClassState _init_state;           // state of class
 54   bool                   _is_shared;
 55   bool                   _has_finalizer;
 56   SubklassValue          _has_subklass;
 57   bool                   _has_nonstatic_fields;
 58   bool                   _has_nonstatic_concrete_methods;
 59   bool                   _is_hidden;
 60   bool                   _is_record;
 61 
 62   ciFlags                _flags;
 63   jint                   _nonstatic_field_size;
 64   jint                   _nonstatic_oop_map_size;
 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 
 81   void compute_injected_fields();
 82   bool compute_injected_fields_helper();
 83 
 84 protected:
 85   ciInstanceKlass(Klass* k);
 86   ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain, BasicType bt = T_OBJECT); // for unloaded klasses
 87 
 88   InstanceKlass* get_instanceKlass() const {
 89     return InstanceKlass::cast(get_Klass());
 90   }
 91 
 92   oop loader();
 93   jobject loader_handle();
 94 
 95   oop protection_domain();
 96   jobject protection_domain_handle();
 97 
 98   const char* type_string() { return "ciInstanceKlass"; }
 99 
100   bool is_in_package_impl(const char* packagename, int len);
101 
102   void print_impl(outputStream* st);
103 
104   ciConstantPoolCache* field_cache();
105 
106   bool is_shared() { return _is_shared; }
107 
108   void compute_shared_init_state();
109   bool compute_shared_has_subklass();
110   virtual int compute_nonstatic_fields();
111   GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields, bool flatten = true);
112 
113   // Update the init_state for shared klasses
114   void update_if_shared(InstanceKlass::ClassState expected) {
115     if (_is_shared && _init_state != expected) {
116       if (is_loaded()) compute_shared_init_state();
117     }
118   }
119 
120 public:
121   // Has this klass been initialized?
122   bool                   is_initialized() {
123     update_if_shared(InstanceKlass::fully_initialized);
124     return _init_state == InstanceKlass::fully_initialized;
125   }
126   bool                   is_not_initialized() {
127     update_if_shared(InstanceKlass::fully_initialized);
128     return _init_state < InstanceKlass::being_initialized;
129   }
130   // Is this klass being initialized?
131   bool                   is_being_initialized() {

194     } else {
195       return 2;
196     }
197   }
198   bool has_nonstatic_concrete_methods()  {
199     assert(is_loaded(), "must be loaded");
200     return _has_nonstatic_concrete_methods;
201   }
202 
203   bool is_hidden() const {
204     return _is_hidden;
205   }
206 
207   bool is_record() const {
208     return _is_record;
209   }
210 
211   ciInstanceKlass* get_canonical_holder(int offset);
212   ciField* get_field_by_offset(int field_offset, bool is_static);
213   ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static);
214   // get field descriptor at field_offset ignoring flattening
215   ciField* get_non_flattened_field_by_offset(int field_offset);
216 
217   // total number of nonstatic fields (including inherited):
218   int nof_nonstatic_fields() {
219     if (_nonstatic_fields == NULL) {
220       return compute_nonstatic_fields();
221     } else {
222       return _nonstatic_fields->length();
223     }
224   }
225 
226   bool has_injected_fields() {
227     if (_has_injected_fields == -1) {
228       compute_injected_fields();
229     }
230     return _has_injected_fields > 0 ? true : false;
231   }
232 
233   bool has_object_fields() const;
234 
235   // nth nonstatic field (presented by ascending address)
236   ciField* nonstatic_field_at(int i) {
237     assert(_nonstatic_fields != NULL, "");
238     return _nonstatic_fields->at(i);
239   }
240 
241   ciInstanceKlass* unique_concrete_subklass();
242   bool has_finalizable_subclass();
243 

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