RFR: 8340923: The class LogSelection copies uninitialized memory [v2]

Julian Waters jwaters at openjdk.org
Thu Sep 26 06:47:38 UTC 2024


On Wed, 25 Sep 2024 16:56:03 GMT, Abdelhak Zaaim <duke at openjdk.org> wrote:

>> Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fixes
>
> I suggest using std::fill(_tags + _ntags, _tags + LogTag::MaxTags, LogTag::__NO_TAG); instead of the manual loop. Its cleaner, easier to read  and takes advantage of the standard library.

> > @abdelhak-zaaim HotSpot code is not allowed to use the vast majority of the C++ Standard Library
> 
> Would we need to adjust linker settings when using std::fill (in case it would be allowed) ?

I don't believe linker settings have to be changed, HotSpot does already link with the C++ Standard Library in the few cases where it's used, typically statically if I'm not wrong. But compiler settings might prove to be a challenge, because std::fill throws exceptions, and HotSpot currently restricts exception usage, they're forcefully disabled on the command line to enforce this rule. I do have an experiment where exceptions and RTTI are not disabled for HotSpot, and in those tests there are red crosses all over the runners, so I believe doing this would not be an easy undertaking

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

PR Comment: https://git.openjdk.org/jdk/pull/21185#issuecomment-2376066815


More information about the hotspot-runtime-dev mailing list