RFR: 8345012: os::build_agent_function_name potentially wastes a byte when allocating the buffer [v2]

Kim Barrett kbarrett at openjdk.org
Thu Nov 28 02:17:37 UTC 2024


On Wed, 27 Nov 2024 19:23:56 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> David Holmes has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix bug re-checking minimum length
>
> Also a general understanding question: do we even care about these savings? AFAIU, the improvements are miniscule (are they?), and we are risking a bit of regression by touching this code. It is a good hygienic exercise, for sure.

> Thanks for looking at this @shipilev !
> 
> > Also a general understanding question: do we even care about these savings?
> 
> Perhaps not. That was also raised in the original commentary. And to be quite open here I introduced several bugs whilst trying to address this so it is very easy to get wrong.

I would be fine with not changing the calculation.  As noted by @dholmes-ora , in the original discussion I suggested
that as an option, but with a comment describing the calculation (including the potential extra byte) "to guide the next
careful reader".  I spent too much time puzzling over that calculation to make sure there wasn't a potential off-by-one
in the other direction.  A comment saying something like "+2 == +1 for terminating nul and +1 for optional underscore"
would have helped.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/22404#issuecomment-2505131350


More information about the hotspot-runtime-dev mailing list