< prev index next >

src/share/vm/ci/ciInstanceKlass.cpp

Print this page

        

*** 61,71 **** _nonstatic_field_size = ik->nonstatic_field_size(); _has_nonstatic_fields = ik->has_nonstatic_fields(); _has_nonstatic_concrete_methods = ik->has_nonstatic_concrete_methods(); _is_anonymous = ik->is_anonymous(); _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields - _nof_declared_nonstatic_fields = -1; // initialized lazily by compute_nonstatic_fields _has_injected_fields = -1; _vcc_klass = NULL; _implementor = NULL; // we will fill these lazily Thread *thread = Thread::current(); --- 61,70 ----
*** 104,114 **** assert(name->byte_at(0) != '[', "not an instance klass"); _init_state = (InstanceKlass::ClassState)0; _nonstatic_field_size = -1; _has_nonstatic_fields = false; _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields - _nof_declared_nonstatic_fields = -1; // initialized lazily by compute_nonstatic_fields _has_injected_fields = -1; _vcc_klass = NULL; _is_anonymous = false; _loader = loader; _protection_domain = protection_domain; --- 103,112 ----
*** 455,465 **** return _nonstatic_fields->length(); if (!has_nonstatic_fields()) { Arena* arena = CURRENT_ENV->arena(); _nonstatic_fields = new (arena) GrowableArray<ciField*>(arena, 0, 0, NULL); - _nof_declared_nonstatic_fields = 0; return 0; } assert(!is_java_lang_Object(), "bootstrap OK"); // Size in bytes of my fields, including inherited fields. --- 453,462 ----
*** 473,483 **** super_fields = super->_nonstatic_fields; assert(super_flen == 0 || super_fields != NULL, "first get nof_fields"); // See if I am no larger than my super; if so, I can use his fields. if (fsize == super_fsize) { _nonstatic_fields = super_fields; - _nof_declared_nonstatic_fields = super->nof_declared_nonstatic_fields(); return super_fields->length(); } } GrowableArray<ciField*>* fields = NULL; --- 470,479 ----
*** 487,516 **** if (fields == NULL) { // This can happen if this class (java.lang.Class) has invisible fields. if (super_fields != NULL) { _nonstatic_fields = super_fields; - _nof_declared_nonstatic_fields = super->nof_declared_nonstatic_fields(); return super_fields->length(); } else { - _nof_declared_nonstatic_fields = 0; return 0; } } - int flen = fields->length(); - - // Now sort them by offset, ascending. - // (In principle, they could mix with superclass fields.) - fields->sort(sort_field_by_offset); _nonstatic_fields = fields; ! return flen; } ! GrowableArray<ciField*>* ! ciInstanceKlass::compute_nonstatic_fields_impl(GrowableArray<ciField*>* ! super_fields) { ASSERT_IN_VM; Arena* arena = CURRENT_ENV->arena(); int flen = 0; GrowableArray<ciField*>* fields = NULL; InstanceKlass* k = get_instanceKlass(); --- 483,503 ---- if (fields == NULL) { // This can happen if this class (java.lang.Class) has invisible fields. if (super_fields != NULL) { _nonstatic_fields = super_fields; return super_fields->length(); } else { return 0; } } _nonstatic_fields = fields; ! return fields->length(); } ! GrowableArray<ciField*>* ciInstanceKlass::compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields, bool flatten) { ASSERT_IN_VM; Arena* arena = CURRENT_ENV->arena(); int flen = 0; GrowableArray<ciField*>* fields = NULL; InstanceKlass* k = get_instanceKlass();
*** 519,550 **** flen += 1; } // allocate the array: if (flen == 0) { - _nof_declared_nonstatic_fields = flen; return NULL; // return nothing if none are locally declared } if (super_fields != NULL) { flen += super_fields->length(); } - _nof_declared_nonstatic_fields = flen; fields = new (arena) GrowableArray<ciField*>(arena, flen, 0, NULL); if (super_fields != NULL) { fields->appendAll(super_fields); } for (JavaFieldStream fs(k); !fs.done(); fs.next()) { if (fs.access_flags().is_static()) continue; fieldDescriptor& fd = fs.field_descriptor(); ! if (fd.field_type() == T_VALUETYPE) { // Value type fields are embedded int field_offset = fd.offset(); // Get ValueKlass and adjust number of fields ciValueKlass* vk = get_field_type_by_offset(field_offset)->as_value_klass(); ! flen += vk->flattened_field_count() - 1; // Iterate over fields of the flattened value type and copy them to 'this' for (int i = 0; i < vk->nof_nonstatic_fields(); ++i) { ciField* flattened_field = vk->nonstatic_field_at(i); // Adjust offset to account for missing oop header int offset = field_offset + (flattened_field->offset() - vk->first_field_offset()); --- 506,536 ---- flen += 1; } // allocate the array: if (flen == 0) { return NULL; // return nothing if none are locally declared } if (super_fields != NULL) { flen += super_fields->length(); } fields = new (arena) GrowableArray<ciField*>(arena, flen, 0, NULL); if (super_fields != NULL) { fields->appendAll(super_fields); } for (JavaFieldStream fs(k); !fs.done(); fs.next()) { if (fs.access_flags().is_static()) continue; fieldDescriptor& fd = fs.field_descriptor(); ! if (fd.is_flatten() && flatten) { ! assert(fd.field_type() == T_VALUETYPE, "flattening is only supported for value type fields"); // Value type fields are embedded int field_offset = fd.offset(); // Get ValueKlass and adjust number of fields ciValueKlass* vk = get_field_type_by_offset(field_offset)->as_value_klass(); ! flen += vk->nof_nonstatic_fields() - 1; // Iterate over fields of the flattened value type and copy them to 'this' for (int i = 0; i < vk->nof_nonstatic_fields(); ++i) { ciField* flattened_field = vk->nonstatic_field_at(i); // Adjust offset to account for missing oop header int offset = field_offset + (flattened_field->offset() - vk->first_field_offset());
*** 558,567 **** --- 544,556 ---- ciField* field = new (arena) ciField(&fd); fields->append(field); } } assert(fields->length() == flen, "sanity"); + // Now sort them by offset, ascending. + // (In principle, they could mix with superclass fields.) + fields->sort(sort_field_by_offset); return fields; } bool ciInstanceKlass::compute_injected_fields_helper() { ASSERT_IN_VM;
< prev index next >