48 jobject _protection_domain; 49 50 InstanceKlass::ClassState _init_state; // state of class 51 bool _is_shared; 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 _has_injected_fields; // any non static injected fields? lazily initialized. 69 70 // The possible values of the _implementor fall into following three cases: 71 // NULL: no implementor. 72 // A ciInstanceKlass that's not itself: one implementor. 73 // Itsef: more than one implementors. 74 ciInstanceKlass* _implementor; 75 76 void compute_injected_fields(); 77 bool compute_injected_fields_helper(); 78 79 protected: 80 ciInstanceKlass(KlassHandle h_k); 81 ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain); 82 83 InstanceKlass* get_instanceKlass() const { 84 return InstanceKlass::cast(get_Klass()); 85 } 86 87 oop loader(); 177 bool has_default_methods() { 178 assert(is_loaded(), "must be loaded"); 179 return _has_default_methods; 180 } 181 182 bool is_anonymous() { 183 return _is_anonymous; 184 } 185 186 ciInstanceKlass* get_canonical_holder(int offset); 187 ciField* get_field_by_offset(int field_offset, bool is_static); 188 ciType* get_field_type_by_offset(int field_offset); 189 ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static); 190 191 // total number of nonstatic fields (including inherited): 192 int nof_nonstatic_fields() { 193 if (_nonstatic_fields == NULL) 194 return compute_nonstatic_fields(); 195 else 196 return _nonstatic_fields->length(); 197 } 198 199 bool has_injected_fields() { 200 if (_has_injected_fields == -1) { 201 compute_injected_fields(); 202 } 203 return _has_injected_fields > 0 ? true : false; 204 } 205 206 // nth nonstatic field (presented by ascending address) 207 ciField* nonstatic_field_at(int i) { 208 assert(_nonstatic_fields != NULL, ""); 209 return _nonstatic_fields->at(i); 210 } 211 212 ciInstanceKlass* unique_concrete_subklass(); 213 bool has_finalizable_subclass(); 214 215 bool contains_field_offset(int offset) { 216 return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size(), is_valuetype()); | 48 jobject _protection_domain; 49 50 InstanceKlass::ClassState _init_state; // state of class 51 bool _is_shared; 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(); 179 bool has_default_methods() { 180 assert(is_loaded(), "must be loaded"); 181 return _has_default_methods; 182 } 183 184 bool is_anonymous() { 185 return _is_anonymous; 186 } 187 188 ciInstanceKlass* get_canonical_holder(int offset); 189 ciField* get_field_by_offset(int field_offset, bool is_static); 190 ciType* get_field_type_by_offset(int field_offset); 191 ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static); 192 193 // total number of nonstatic fields (including inherited): 194 int nof_nonstatic_fields() { 195 if (_nonstatic_fields == NULL) 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()); |