On Fri, 30 Jul 2021 04:09:32 GMT, Kim Barrett <kbarr...@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