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

Kim Barrett kim.barrett at oracle.com
Sat Oct 1 00:08:21 UTC 2016


> On Sep 30, 2016, at 9:55 AM, Alan Burlison <Alan.Burlison at oracle.com> wrote:
> 
> On 30/09/2016 01:03, Kim Barrett wrote:
> 
>> The old code used literal integer sizes and indices.  The new code
>> assumes avn > AV_HW1_IDX.  I don’t see anything that guarantees that
>> to be true (other than, perhaps, the source code for getisax).  If
>> the array was allocated with a size of the larger of AV_HW1_IDX+1 and
>> AV_HW2_IDX+1 then we’d be guaranteed safe to access
>> av[AV_HW{1,2}_IDX].
> 
> 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.



More information about the hotspot-runtime-dev mailing list