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 04:20:07 PDT 2013


Kris, Aleksey, thanks for review.

AnnotationCollector::set_contended isn't used anymore and I don't see 
any reason to keep it. Will remove it completely.

Regarding is_contended(), I'm reluctant to replace it with 
has_annotation(_sun_misc_Contended), because it's more verbose.

Best regards,
Vladimir Ivanov

On 4/11/13 2:37 PM, Aleksey Shipilev wrote:
> BTW, is there any reason to retain AnnotationCollector::set_contended?
> There is a symmetrical AnnotationCollector::is_contended which can be
> folded to "has_annotation(_sun_misc_Contended)"?
>
> -Aleksey.
>
> On 04/11/2013 02:34 PM, Aleksey Shipilev wrote:
>> Thanks!
>> Looks good.
>>
>> -Aleksey.
>>
>> On 04/11/2013 01:52 PM, Vladimir Ivanov wrote:
>>> 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