52 bool _has_finalizer; 53 bool _has_subklass; 54 bool _has_nonstatic_fields; 55 bool _has_default_methods; 56 bool _is_anonymous; 57 58 ciFlags _flags; 59 jint _nonstatic_field_size; 60 jint _nonstatic_oop_map_size; 61 62 // Lazy fields get filled in only upon request. 63 ciInstanceKlass* _super; 64 ciInstance* _java_mirror; 65 66 ciConstantPoolCache* _field_cache; // cached map index->field 67 GrowableArray<ciField*>* _nonstatic_fields; 68 int _nof_declared_nonstatic_fields; // Number of nonstatic fields declared in the bytecode 69 // i.e., without value types flattened into the instance. 70 int _has_injected_fields; // any non static injected fields? lazily initialized. 71 72 // The possible values of the _implementor fall into following three cases: 73 // NULL: no implementor. 74 // A ciInstanceKlass that's not itself: one implementor. 75 // Itsef: more than one implementors. 76 ciInstanceKlass* _implementor; 77 78 void compute_injected_fields(); 79 bool compute_injected_fields_helper(); 80 81 protected: 82 ciInstanceKlass(KlassHandle h_k); 83 ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain); 84 85 InstanceKlass* get_instanceKlass() const { 86 return InstanceKlass::cast(get_Klass()); 87 } 88 89 oop loader(); 90 jobject loader_handle(); 91 196 return compute_nonstatic_fields(); 197 else 198 return _nonstatic_fields->length(); 199 } 200 201 int nof_declared_nonstatic_fields() { 202 if (_nonstatic_fields == NULL) { 203 compute_nonstatic_fields(); 204 } 205 assert(_nof_declared_nonstatic_fields >= 0, "after lazy initialization _nof_declared_nonstatic_fields must be at least 0"); 206 return _nof_declared_nonstatic_fields; 207 } 208 209 bool has_injected_fields() { 210 if (_has_injected_fields == -1) { 211 compute_injected_fields(); 212 } 213 return _has_injected_fields > 0 ? true : false; 214 } 215 216 // nth nonstatic field (presented by ascending address) 217 ciField* nonstatic_field_at(int i) { 218 assert(_nonstatic_fields != NULL, ""); 219 return _nonstatic_fields->at(i); 220 } 221 222 ciInstanceKlass* unique_concrete_subklass(); 223 bool has_finalizable_subclass(); 224 225 bool contains_field_offset(int offset) { 226 return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size(), is_valuetype()); 227 } 228 229 // Get the instance of java.lang.Class corresponding to 230 // this klass. This instance is used for locking of 231 // synchronized static methods of this klass. 232 ciInstance* java_mirror(); 233 234 // Java access flags 235 bool is_public () { return flags().is_public(); } 236 bool is_final () { return flags().is_final(); } 237 bool is_super () { return flags().is_super(); } 238 bool is_interface () { return flags().is_interface(); } 239 bool is_abstract () { return flags().is_abstract(); } 240 241 ciMethod* find_method(ciSymbol* name, ciSymbol* signature); 242 // Note: To find a method from name and type strings, use ciSymbol::make, 243 // but consider adding to vmSymbols.hpp instead. 244 245 bool is_leaf_type(); 246 ciInstanceKlass* implementor(); 247 248 // Is the defining class loader of this class the default loader? 249 bool uses_default_loader() const; 250 251 bool is_java_lang_Object() const; 252 253 BasicType box_klass_type() const; 254 bool is_box_klass() const; 255 bool is_boxed_value_offset(int offset) const; 256 257 // Is this klass in the given package? 258 bool is_in_package(const char* packagename) { 259 return is_in_package(packagename, (int) strlen(packagename)); 260 } 261 bool is_in_package(const char* packagename, int len); 262 263 // What kind of ciObject is this? 264 bool is_instance_klass() const { return true; } 265 bool is_java_klass() const { return true; } 266 | 52 bool _has_finalizer; 53 bool _has_subklass; 54 bool _has_nonstatic_fields; 55 bool _has_default_methods; 56 bool _is_anonymous; 57 58 ciFlags _flags; 59 jint _nonstatic_field_size; 60 jint _nonstatic_oop_map_size; 61 62 // Lazy fields get filled in only upon request. 63 ciInstanceKlass* _super; 64 ciInstance* _java_mirror; 65 66 ciConstantPoolCache* _field_cache; // cached map index->field 67 GrowableArray<ciField*>* _nonstatic_fields; 68 int _nof_declared_nonstatic_fields; // Number of nonstatic fields declared in the bytecode 69 // i.e., without value types flattened into the instance. 70 int _has_injected_fields; // any non static injected fields? lazily initialized. 71 72 bool _has_derive_value_type; 73 ciInstanceKlass* _derive_value_type; // This field points: 74 // - to the derived value type class corresponding to the current value-capable class; 75 // - to the value-capable class corresponding to the current derived value type class. 76 77 // The possible values of the _implementor fall into following three cases: 78 // NULL: no implementor. 79 // A ciInstanceKlass that's not itself: one implementor. 80 // Itsef: more than one implementors. 81 ciInstanceKlass* _implementor; 82 83 void compute_injected_fields(); 84 bool compute_injected_fields_helper(); 85 86 protected: 87 ciInstanceKlass(KlassHandle h_k); 88 ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain); 89 90 InstanceKlass* get_instanceKlass() const { 91 return InstanceKlass::cast(get_Klass()); 92 } 93 94 oop loader(); 95 jobject loader_handle(); 96 201 return compute_nonstatic_fields(); 202 else 203 return _nonstatic_fields->length(); 204 } 205 206 int nof_declared_nonstatic_fields() { 207 if (_nonstatic_fields == NULL) { 208 compute_nonstatic_fields(); 209 } 210 assert(_nof_declared_nonstatic_fields >= 0, "after lazy initialization _nof_declared_nonstatic_fields must be at least 0"); 211 return _nof_declared_nonstatic_fields; 212 } 213 214 bool has_injected_fields() { 215 if (_has_injected_fields == -1) { 216 compute_injected_fields(); 217 } 218 return _has_injected_fields > 0 ? true : false; 219 } 220 221 bool has_derive_value_type() { 222 return _has_derive_value_type; 223 } 224 225 // nth nonstatic field (presented by ascending address) 226 ciField* nonstatic_field_at(int i) { 227 assert(_nonstatic_fields != NULL, ""); 228 return _nonstatic_fields->at(i); 229 } 230 231 ciInstanceKlass* unique_concrete_subklass(); 232 bool has_finalizable_subclass(); 233 234 bool contains_field_offset(int offset) { 235 return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size(), is_valuetype()); 236 } 237 238 // Get the instance of java.lang.Class corresponding to 239 // this klass. This instance is used for locking of 240 // synchronized static methods of this klass. 241 ciInstance* java_mirror(); 242 243 // Java access flags 244 bool is_public () { return flags().is_public(); } 245 bool is_final () { return flags().is_final(); } 246 bool is_super () { return flags().is_super(); } 247 bool is_interface () { return flags().is_interface(); } 248 bool is_abstract () { return flags().is_abstract(); } 249 250 ciMethod* find_method(ciSymbol* name, ciSymbol* signature); 251 // Note: To find a method from name and type strings, use ciSymbol::make, 252 // but consider adding to vmSymbols.hpp instead. 253 254 bool is_leaf_type(); 255 ciInstanceKlass* implementor(); 256 ciInstanceKlass* derive_value_type(); 257 258 // Is the defining class loader of this class the default loader? 259 bool uses_default_loader() const; 260 261 bool is_java_lang_Object() const; 262 263 BasicType box_klass_type() const; 264 bool is_box_klass() const; 265 bool is_boxed_value_offset(int offset) const; 266 267 // Is this klass in the given package? 268 bool is_in_package(const char* packagename) { 269 return is_in_package(packagename, (int) strlen(packagename)); 270 } 271 bool is_in_package(const char* packagename, int len); 272 273 // What kind of ciObject is this? 274 bool is_instance_klass() const { return true; } 275 bool is_java_klass() const { return true; } 276 |