RFR: 8333658: NMT: Use an allocator with 4-byte pointers to save memory in NativeCallStackStorage [v24]

Johan Sjölen jsjolen at openjdk.org
Thu Jun 20 20:06:17 UTC 2024


On Thu, 20 Jun 2024 18:02:08 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Rename free to deallocate
>
> src/hotspot/share/nmt/nmtNativeCallStackStorage.hpp line 74:
> 
>> 72:   using Allocator = HomogenousObjectArray<Link, mtNMT>;
>> 73:   using LinkPtr = typename Allocator::I;
>> 74:   LinkPtr nil() { return Allocator::nil; }
> 
> could we have some clearer names?
> 
> - Link -> TableEntry or Entry (since its entries of the hashtable)
> - LinkPtr -> TableEntryIndex
> 
> Also, could you put all data members of NCCS here, please? It makes it easier to see the implementation. The big boys here are _table, hash table entry storage, and stack storage.
> 
> I don't think you need a nil(), at least not if you keep referring to Allocator::nil elsewhere. 
> 
> Btw, why do you prefer using over  typedef?

All suggestions sounds fine 

> Btw, why do you prefer using over typedef?

It's helpful that the name sticks out a lot more than for typedef when doing stuff like function pointer or array aliases, the name is always left of `=`. `using` also supports templates (you can do `template <typename T> using x = array<T>`).

That's why you might prefer `using` to `typedef`. I prefer it because that's what I'm used to using, boring but true.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18979#discussion_r1648068972


More information about the hotspot-dev mailing list