RFR: JDK-8256844: Make NMT late-initializable
Thomas Stuefe
stuefe at openjdk.java.net
Fri Jul 30 09:50:34 UTC 2021
On Fri, 30 Jul 2021 04:09:32 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> src/hotspot/share/services/nmtPreInit.hpp line 166:
>>
>>> 164: NMTPreInitAllocation** find_entry(const void* p) const {
>>> 165: const unsigned index = index_for_key(p);
>>> 166: NMTPreInitAllocation** aa = (NMTPreInitAllocation**) (&(_entries[index]));
>>
>> Why is this cast needed?
>
> [Not a review, just a drive-by comment.] It's casting away const. Better would be a const_cast. And probably moved to the final result, with the body keeping things const-qualified. And maybe const and non-const overloads of this function. Or maybe this function shouldn't be const-qualified if a non-const result is always needed, but that doesn't seem likely.
I'll rethink this.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4874
More information about the core-libs-dev
mailing list