< prev index next >

src/share/vm/classfile/classFileParser.cpp

Print this page

        

*** 3962,3971 **** --- 3962,3972 ---- int static_value_type_count = 0; int nonstatic_value_type_count = 0; int* nonstatic_value_type_indexes = NULL; Klass** nonstatic_value_type_klasses = NULL; unsigned int value_type_oop_map_count = 0; + int not_flattened_value_types = 0; int max_nonstatic_value_type = fac->count[NONSTATIC_VALUETYPE] + 1; nonstatic_value_type_indexes = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, int, max_nonstatic_value_type);
*** 3983,4003 **** --- 3984,4016 ---- Klass* klass = SystemDictionary::resolve_or_fail(signature, Handle(THREAD, _loader_data->class_loader()), _protection_domain, true, CHECK); assert(klass != NULL, "Sanity check"); assert(klass->access_flags().is_value_type(), "Value type expected"); + ValueKlass* vk = ValueKlass::cast(klass); + // Conditions to apply flattening or not should be defined + //in a single place + if (vk->size_helper() <= ValueArrayElemMaxFlatSize) { nonstatic_value_type_indexes[nonstatic_value_type_count] = fs.index(); nonstatic_value_type_klasses[nonstatic_value_type_count] = klass; nonstatic_value_type_count++; ValueKlass* vklass = ValueKlass::cast(klass); if (vklass->contains_oops()) { value_type_oop_map_count += vklass->nonstatic_oop_map_count(); } + fs.set_flattening(true); + } else { + not_flattened_value_types++; + fs.set_flattening(false); + } } } + // Adjusting non_static_oop_count to take into account not flattened value types; + nonstatic_oop_count += not_flattened_value_types; + // Total non-static fields count, including every contended field unsigned int nonstatic_fields_count = fac->count[NONSTATIC_DOUBLE] + fac->count[NONSTATIC_WORD] + fac->count[NONSTATIC_SHORT] + fac->count[NONSTATIC_BYTE] + fac->count[NONSTATIC_OOP] + fac->count[NONSTATIC_VALUETYPE];
*** 4024,4034 **** // int super_oop_map_count = (_super_klass == NULL) ? 0 :_super_klass->nonstatic_oop_map_count(); int max_oop_map_count = super_oop_map_count + fac->count[NONSTATIC_OOP] + ! value_type_oop_map_count; OopMapBlocksBuilder* nonstatic_oop_maps = new OopMapBlocksBuilder(max_oop_map_count, THREAD); if (super_oop_map_count > 0) { nonstatic_oop_maps->initialize_inherited_blocks(_super_klass->start_of_nonstatic_oop_maps(), _super_klass->nonstatic_oop_map_count()); --- 4037,4048 ---- // int super_oop_map_count = (_super_klass == NULL) ? 0 :_super_klass->nonstatic_oop_map_count(); int max_oop_map_count = super_oop_map_count + fac->count[NONSTATIC_OOP] + ! value_type_oop_map_count + ! not_flattened_value_types; OopMapBlocksBuilder* nonstatic_oop_maps = new OopMapBlocksBuilder(max_oop_map_count, THREAD); if (super_oop_map_count > 0) { nonstatic_oop_maps->initialize_inherited_blocks(_super_klass->start_of_nonstatic_oop_maps(), _super_klass->nonstatic_oop_map_count());
*** 4212,4222 **** case STATIC_DOUBLE: real_offset = next_static_double_offset; next_static_double_offset += BytesPerLong; break; case NONSTATIC_VALUETYPE: ! { Klass* klass = nonstatic_value_type_klasses[next_value_type_index]; assert(klass != NULL, "Klass should have been loaded and resolved earlier"); assert(klass->access_flags().is_value_type(),"Must be a value type"); ValueKlass* vklass = ValueKlass::cast(klass); real_offset = next_nonstatic_valuetype_offset; --- 4226,4236 ---- case STATIC_DOUBLE: real_offset = next_static_double_offset; next_static_double_offset += BytesPerLong; break; case NONSTATIC_VALUETYPE: ! if (fs.is_flatten()) { Klass* klass = nonstatic_value_type_klasses[next_value_type_index]; assert(klass != NULL, "Klass should have been loaded and resolved earlier"); assert(klass->access_flags().is_value_type(),"Must be a value type"); ValueKlass* vklass = ValueKlass::cast(klass); real_offset = next_nonstatic_valuetype_offset;
*** 4232,4243 **** while (map < last_map) { nonstatic_oop_maps->add(map->offset() + diff, map->count()); map++; } } - } break; case NONSTATIC_OOP: if( nonstatic_oop_space_count > 0 ) { real_offset = nonstatic_oop_space_offset; nonstatic_oop_space_offset += heapOopSize; nonstatic_oop_space_count -= 1; --- 4246,4259 ---- while (map < last_map) { nonstatic_oop_maps->add(map->offset() + diff, map->count()); map++; } } break; + } else { + // Fall through + } case NONSTATIC_OOP: if( nonstatic_oop_space_count > 0 ) { real_offset = nonstatic_oop_space_offset; nonstatic_oop_space_offset += heapOopSize; nonstatic_oop_space_count -= 1;
< prev index next >