RFR (XS) CR 8014509: @Contended: explicit default value behaves differently from the implicit value
Vladimir Kozlov
vladimir.kozlov at oracle.com
Wed May 15 09:34:10 PDT 2013
Aleksey,
Why you need to test 2 fields but not class annotation?
It would be nice to have a comment in parse_annotations() explaining what formats of Contended are expected.
And the code could be rearranged to simplify it a little:
if (id == AnnotationCollector::_sun_misc_Contended) {
u2 group_index = 0; // default contended group
if (count == 1
&& s_size == (index - index0) // match size
&& s_tag_val == *(abase + tag_off)
&& member == vmSymbols::value_name()) {
u2 group_index = Bytes::get_Java_u2(abase + s_con_off);
if (_cp->symbol_at(group_index)->utf8_length() == 0) {
group_index = 0; // empty tag => default contended group
}
}
coll->set_contended_group(group_index);
}
Thanks,
Vladimir
On 5/15/13 8:36 AM, Aleksey Shipilev wrote:
> Hi,
>
> Please review the little parameter handling fix for @Contended:
> http://cr.openjdk.java.net/~shade/8014509/webrev.01/
>
> Bottom-line, these guys should be equivalent:
> public class Test {
> private static class T0 {
> @Contended("") private double double1;
> @Contended("") private double double2;
> }
> private static class T1 {
> @Contended() private double double1;
> @Contended() private double double2;
> }
> private static class T2 {
> @Contended private double double1;
> @Contended private double double2;
> }
> }
>
> They are not, because we handle the default value in a weird way.
>
> Testing:
> - 8014509 regression test on Linux x86_64/fastdebug
> - full JPRT cycle against hotspot-rt
>
> Thanks,
> Aleksey.
>
>
>
More information about the hotspot-dev
mailing list