src/share/vm/classfile/classFileParser.cpp

changeset 5137
50e9396d5257
parent 5135
205dd30230e1
child 5142
b5be63340698
     1.1 --- a/src/share/vm/classfile/classFileParser.cpp	Fri May 17 01:43:48 2013 +0400
     1.2 +++ b/src/share/vm/classfile/classFileParser.cpp	Fri May 17 01:58:32 2013 +0400
     1.3 @@ -1719,15 +1719,28 @@
     1.4      coll->set_annotation(id);
     1.5  
     1.6      if (id == AnnotationCollector::_sun_misc_Contended) {
     1.7 +      // @Contended can optionally specify the contention group.
     1.8 +      //
     1.9 +      // Contended group defines the equivalence class over the fields:
    1.10 +      // the fields within the same contended group are not treated distinct.
    1.11 +      // The only exception is default group, which does not incur the
    1.12 +      // equivalence. Naturally, contention group for classes is meaningless.
    1.13 +      //
    1.14 +      // While the contention group is specified as String, annotation
    1.15 +      // values are already interned, and we might as well use the constant
    1.16 +      // pool index as the group tag.
    1.17 +      //
    1.18 +      u2 group_index = 0; // default contended group
    1.19        if (count == 1
    1.20            && s_size == (index - index0)  // match size
    1.21            && s_tag_val == *(abase + tag_off)
    1.22            && member == vmSymbols::value_name()) {
    1.23 -        u2 group_index = Bytes::get_Java_u2(abase + s_con_off);
    1.24 -        coll->set_contended_group(group_index);
    1.25 -      } else {
    1.26 -        coll->set_contended_group(0); // default contended group
    1.27 +        group_index = Bytes::get_Java_u2(abase + s_con_off);
    1.28 +        if (_cp->symbol_at(group_index)->utf8_length() == 0) {
    1.29 +          group_index = 0; // default contended group
    1.30 +        }
    1.31        }
    1.32 +      coll->set_contended_group(group_index);
    1.33      }
    1.34    }
    1.35  }

mercurial