src/share/vm/classfile/classFileParser.cpp

changeset 5142
b5be63340698
parent 5115
e484fe2abebd
parent 5137
50e9396d5257
child 5146
bbddfb08190f
equal deleted inserted replaced
5130:7ec426e29e4c 5142:b5be63340698
1717 AnnotationCollector::ID id = coll->annotation_index(_loader_data, aname); 1717 AnnotationCollector::ID id = coll->annotation_index(_loader_data, aname);
1718 if (id == AnnotationCollector::_unknown) continue; 1718 if (id == AnnotationCollector::_unknown) continue;
1719 coll->set_annotation(id); 1719 coll->set_annotation(id);
1720 1720
1721 if (id == AnnotationCollector::_sun_misc_Contended) { 1721 if (id == AnnotationCollector::_sun_misc_Contended) {
1722 // @Contended can optionally specify the contention group.
1723 //
1724 // Contended group defines the equivalence class over the fields:
1725 // the fields within the same contended group are not treated distinct.
1726 // The only exception is default group, which does not incur the
1727 // equivalence. Naturally, contention group for classes is meaningless.
1728 //
1729 // While the contention group is specified as String, annotation
1730 // values are already interned, and we might as well use the constant
1731 // pool index as the group tag.
1732 //
1733 u2 group_index = 0; // default contended group
1722 if (count == 1 1734 if (count == 1
1723 && s_size == (index - index0) // match size 1735 && s_size == (index - index0) // match size
1724 && s_tag_val == *(abase + tag_off) 1736 && s_tag_val == *(abase + tag_off)
1725 && member == vmSymbols::value_name()) { 1737 && member == vmSymbols::value_name()) {
1726 u2 group_index = Bytes::get_Java_u2(abase + s_con_off); 1738 group_index = Bytes::get_Java_u2(abase + s_con_off);
1727 coll->set_contended_group(group_index); 1739 if (_cp->symbol_at(group_index)->utf8_length() == 0) {
1728 } else { 1740 group_index = 0; // default contended group
1729 coll->set_contended_group(0); // default contended group 1741 }
1730 } 1742 }
1743 coll->set_contended_group(group_index);
1731 } 1744 }
1732 } 1745 }
1733 } 1746 }
1734 1747
1735 ClassFileParser::AnnotationCollector::ID 1748 ClassFileParser::AnnotationCollector::ID
3163 ((fac->count[STATIC_SHORT]) * BytesPerShort); 3176 ((fac->count[STATIC_SHORT]) * BytesPerShort);
3164 3177
3165 first_nonstatic_field_offset = instanceOopDesc::base_offset_in_bytes() + 3178 first_nonstatic_field_offset = instanceOopDesc::base_offset_in_bytes() +
3166 nonstatic_field_size * heapOopSize; 3179 nonstatic_field_size * heapOopSize;
3167 3180
3181 next_nonstatic_field_offset = first_nonstatic_field_offset;
3182
3168 // class is contended, pad before all the fields 3183 // class is contended, pad before all the fields
3169 if (parsed_annotations->is_contended()) { 3184 if (parsed_annotations->is_contended()) {
3170 first_nonstatic_field_offset += pad_size; 3185 next_nonstatic_field_offset += pad_size;
3171 } 3186 }
3172
3173 next_nonstatic_field_offset = first_nonstatic_field_offset;
3174 3187
3175 unsigned int nonstatic_double_count = fac->count[NONSTATIC_DOUBLE] - fac_contended.count[NONSTATIC_DOUBLE]; 3188 unsigned int nonstatic_double_count = fac->count[NONSTATIC_DOUBLE] - fac_contended.count[NONSTATIC_DOUBLE];
3176 unsigned int nonstatic_word_count = fac->count[NONSTATIC_WORD] - fac_contended.count[NONSTATIC_WORD]; 3189 unsigned int nonstatic_word_count = fac->count[NONSTATIC_WORD] - fac_contended.count[NONSTATIC_WORD];
3177 unsigned int nonstatic_short_count = fac->count[NONSTATIC_SHORT] - fac_contended.count[NONSTATIC_SHORT]; 3190 unsigned int nonstatic_short_count = fac->count[NONSTATIC_SHORT] - fac_contended.count[NONSTATIC_SHORT];
3178 unsigned int nonstatic_byte_count = fac->count[NONSTATIC_BYTE] - fac_contended.count[NONSTATIC_BYTE]; 3191 unsigned int nonstatic_byte_count = fac->count[NONSTATIC_BYTE] - fac_contended.count[NONSTATIC_BYTE];
3560 3573
3561 next_nonstatic_type_offset = align_size_up(notaligned_offset, wordSize ); 3574 next_nonstatic_type_offset = align_size_up(notaligned_offset, wordSize );
3562 int instance_size = align_object_size(next_nonstatic_type_offset / wordSize); 3575 int instance_size = align_object_size(next_nonstatic_type_offset / wordSize);
3563 3576
3564 assert(instance_size == align_object_size(align_size_up( 3577 assert(instance_size == align_object_size(align_size_up(
3565 (instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize + ((parsed_annotations->is_contended()) ? pad_size : 0)), 3578 (instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize),
3566 wordSize) / wordSize), "consistent layout helper value"); 3579 wordSize) / wordSize), "consistent layout helper value");
3567 3580
3568 // Number of non-static oop map blocks allocated at end of klass. 3581 // Number of non-static oop map blocks allocated at end of klass.
3569 const unsigned int total_oop_map_count = 3582 const unsigned int total_oop_map_count =
3570 compute_oop_map_count(_super_klass, nonstatic_oop_map_count, 3583 compute_oop_map_count(_super_klass, nonstatic_oop_map_count,

mercurial