< prev index next >

src/hotspot/share/classfile/classFileParser.cpp

Print this page

        

*** 1518,1531 **** BAD_ALLOCATION_TYPE, // T_NARROWKLASS = 19, BAD_ALLOCATION_TYPE, // T_VALUETYPEPTR= 20, BAD_ALLOCATION_TYPE, // T_CONFLICT = 21, }; ! static FieldAllocationType basic_type_to_atype(bool is_static, BasicType type) { assert(type >= T_BOOLEAN && type < T_VOID, "only allowable values"); FieldAllocationType result = _basic_type_to_atype[type + (is_static ? (T_CONFLICT + 1) : 0)]; assert(result != BAD_ALLOCATION_TYPE, "bad type"); return result; } class ClassFileParser::FieldAllocationCount : public ResourceObj { public: --- 1518,1534 ---- BAD_ALLOCATION_TYPE, // T_NARROWKLASS = 19, BAD_ALLOCATION_TYPE, // T_VALUETYPEPTR= 20, BAD_ALLOCATION_TYPE, // T_CONFLICT = 21, }; ! static FieldAllocationType basic_type_to_atype(bool is_static, BasicType type, bool is_flattenable) { assert(type >= T_BOOLEAN && type < T_VOID, "only allowable values"); FieldAllocationType result = _basic_type_to_atype[type + (is_static ? (T_CONFLICT + 1) : 0)]; assert(result != BAD_ALLOCATION_TYPE, "bad type"); + if (is_flattenable) { + result = is_static ? STATIC_FLATTENABLE : NONSTATIC_FLATTENABLE; + } return result; } class ClassFileParser::FieldAllocationCount : public ResourceObj { public:
*** 1535,1546 **** for (int i = 0; i < MAX_FIELD_ALLOCATION_TYPE; i++) { count[i] = 0; } } ! FieldAllocationType update(bool is_static, BasicType type) { ! FieldAllocationType atype = basic_type_to_atype(is_static, type); if (atype != BAD_ALLOCATION_TYPE) { // Make sure there is no overflow with injected fields. assert(count[atype] < 0xFFFF, "More than 65535 fields"); count[atype]++; } --- 1538,1549 ---- for (int i = 0; i < MAX_FIELD_ALLOCATION_TYPE; i++) { count[i] = 0; } } ! FieldAllocationType update(bool is_static, BasicType type, bool is_flattenable) { ! FieldAllocationType atype = basic_type_to_atype(is_static, type, is_flattenable); if (atype != BAD_ALLOCATION_TYPE) { // Make sure there is no overflow with injected fields. assert(count[atype] < 0xFFFF, "More than 65535 fields"); count[atype]++; }
*** 1688,1698 **** signature_index, constantvalue_index); const BasicType type = cp->basic_type_for_signature_at(signature_index); // Remember how many oops we encountered and compute allocation type ! const FieldAllocationType atype = fac->update(is_static, type); field->set_allocation_type(atype); // After field is initialized with type, we can augment it with aux info if (parsed_annotations.has_any_annotations()) parsed_annotations.apply_to(field); --- 1691,1701 ---- signature_index, constantvalue_index); const BasicType type = cp->basic_type_for_signature_at(signature_index); // Remember how many oops we encountered and compute allocation type ! const FieldAllocationType atype = fac->update(is_static, type, access_flags.is_flattenable()); field->set_allocation_type(atype); // After field is initialized with type, we can augment it with aux info if (parsed_annotations.has_any_annotations()) parsed_annotations.apply_to(field);
*** 1729,1739 **** 0); const BasicType type = FieldType::basic_type(injected[n].signature()); // Remember how many oops we encountered and compute allocation type ! const FieldAllocationType atype = fac->update(false, type); field->set_allocation_type(atype); index++; } } --- 1732,1742 ---- 0); const BasicType type = FieldType::basic_type(injected[n].signature()); // Remember how many oops we encountered and compute allocation type ! const FieldAllocationType atype = fac->update(false, type, false); field->set_allocation_type(atype); index++; } }
*** 1743,1753 **** field->initialize(JVM_ACC_FIELD_INTERNAL | JVM_ACC_STATIC, vmSymbols::default_value_name_enum, vmSymbols::java_lang_Object_enum, 0); const BasicType type = FieldType::basic_type(vmSymbols::object_signature()); ! const FieldAllocationType atype = fac->update(true, type); field->set_allocation_type(atype); index++; } assert(NULL == _fields, "invariant"); --- 1746,1756 ---- field->initialize(JVM_ACC_FIELD_INTERNAL | JVM_ACC_STATIC, vmSymbols::default_value_name_enum, vmSymbols::java_lang_Object_enum, 0); const BasicType type = FieldType::basic_type(vmSymbols::object_signature()); ! const FieldAllocationType atype = fac->update(true, type, false); field->set_allocation_type(atype); index++; } assert(NULL == _fields, "invariant");
*** 4019,4042 **** _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 ( false && // Currently disabling flattening ! ((ValueFieldMaxFlatSize < 0) || vk->size_helper() <= ValueFieldMaxFlatSize)) { 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; --- 4022,4044 ---- _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 ((ValueFieldMaxFlatSize < 0) || (vk->size_helper() * HeapWordSize) <= ValueFieldMaxFlatSize) { 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_flattened(true); } else { not_flattened_value_types++; ! fs.set_flattened(false); } } } // Adjusting non_static_oop_count to take into account not flattened value types;
*** 4257,4267 **** case STATIC_DOUBLE: real_offset = next_static_double_offset; next_static_double_offset += BytesPerLong; break; case NONSTATIC_FLATTENABLE: ! 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; --- 4259,4269 ---- case STATIC_DOUBLE: real_offset = next_static_double_offset; next_static_double_offset += BytesPerLong; break; case NONSTATIC_FLATTENABLE: ! if (fs.is_flattened()) { 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;
*** 5213,5223 **** case JVM_SIGNATURE_FLOAT: case JVM_SIGNATURE_LONG: case JVM_SIGNATURE_DOUBLE: return signature + 1; case JVM_SIGNATURE_CLASS: ! case JVM_SIGNATURE_VALUE_CLASS: { if (_major_version < JAVA_1_5_VERSION) { // Skip over the class name if one is there const char* const p = skip_over_field_name(signature + 1, true, --length); // The next character better be a semicolon --- 5215,5225 ---- case JVM_SIGNATURE_FLOAT: case JVM_SIGNATURE_LONG: case JVM_SIGNATURE_DOUBLE: return signature + 1; case JVM_SIGNATURE_CLASS: ! { if (_major_version < JAVA_1_5_VERSION) { // Skip over the class name if one is there const char* const p = skip_over_field_name(signature + 1, true, --length); // The next character better be a semicolon
< prev index next >