comparison src/share/vm/classfile/classFileParser.cpp @ 10305:50e9396d5257

8014509: @Contended: explicit default value behaves differently from the implicit value Summary: Treat the empty string as the default value tag Reviewed-by: kvn, twisti
author shade
date Fri, 17 May 2013 01:58:32 +0400
parents 205dd30230e1
children b5be63340698
comparison
equal deleted inserted replaced
10303:205dd30230e1 10305:50e9396d5257
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