RFR (XS): 8011972: Field can be erroneously marked as contended when @Contended annotation isn't present

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Thu Apr 11 02:52:25 PDT 2013


http://cr.openjdk.java.net/~vlivanov/8011972/webrev.00
4 lines changed: 0 ins; 3 del; 1 mod

If a field is marked with some annotation recognized by VM (but not 
@Contended), the field will be marked as contended anyway. It's because 
AnnotationCollector::set_contended(bool contended) ignores the parameter 
and always marks a field as contended.

Moreover, calls to AnnotationCollector::set_contended in 
ClassFileParser::parse_annotations are redundant, because there's 
already a call right before:
src/share/vm/classfile/classFileParser.cpp:
1714     coll->set_annotation(id);

The problem hasn't manifested itself before, because @Contended is the 
only annotation on fields [1] VM recognizes. I hit it when working on a 
new annotation on fields for VM.

Testing: manual (w/ additional annotation on fields), 
runtime/8003985/Test8003985.java

Best regards,
Vladimir Ivanov

[1] 
http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/file/tip/src/share/vm/classfile/classFileParser.cpp 

ClassFileParser::AnnotationCollector::annotation_index


More information about the hotspot-runtime-dev mailing list