RFR: JDK-8157141 & JDK-8166454: Solaris getisax(2) and meminfo(2) cleanup

David Holmes david.holmes at oracle.com
Tue Oct 4 08:15:20 UTC 2016


On 4/10/2016 1:04 AM, Alan Burlison wrote:
> On 01/10/2016 01:08, Kim Barrett wrote:
>
>>> They are never going to change value, but if you'd prefer they
>>> weren't used let me know and I'll revert to the integer constants.
>>
>> I like the use of symbolic constants.  It’s the unnecessary
>> assumptions about their values that I dislike.
>>
>> I’d prefer something like
>>
>>   const uint_t av_size = MAX2(AV_HW1_IDX, AV_HW2_IDX) + 1;
>>   uint_t* av = alloca(av_size);
>>   getisax(av, av_size);
>>
>> So av is known to be big enough to access the desired elements.
>
> The values of AV_HW1_IDX and AV_HW2_IDX can't be changed without
> breaking binary compatibility, and we simply aren't ever going to do
> that. We can then assume the values of AV_HW1_IDX and AV_HW2_IDX known,
> namely 0 and 1 respectively, there's no point in comparing them. Plus
> if/when we get the 3rd capabilities word it will need changing anyway.
>
> I've therefore changed the code to remove the alloca() call and be just:
>
> // Extract valid instruction set extensions.
> uint_t avs[AV_HW2_IDX + 1];
> uint_t avn = getisax(avs, sizeof(avs));
>
> webrev updated accordingly.

But it shouldn't be passing sizeof(avs), it should be passing 
(AV_HW2_IDX + 1)

David
-----



More information about the hotspot-runtime-dev mailing list