RFR: 8312132: Add tracking of multiple address spaces in NMT [v46]

Thomas Stuefe stuefe at openjdk.org
Fri Apr 26 11:44:42 UTC 2024


On Thu, 25 Apr 2024 10:33:11 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> src/hotspot/share/nmt/vmatree.hpp line 139:
>> 
>>> 137:   }
>>> 138: 
>>> 139:   SummaryDiff commit_mapping(size_t from, size_t sz, Metadata& metadata) {
>> 
>> `size_t` or `address` for `from`?
>
> I've been using `size_t` so far to indicate that we are within some file with some offset. I'm not sure that `address` is ever the right choice for `VMATree` as it is a `uchar*`, indicating that it's a directly dereferencable pointer. It's not a huge deal whether we choose `size_t`, `uintptr_t` or `address` for our internal representation IMHO, as long as the external interface (`MemTracker`) correctly indicates what kind of address is expected.
> 
> @tstuefe, @gerard-ziemski. This discussion is easily lost in the sea of comments, so pinging you directly here.

How about making your own index type? Something that clearly distinguishes it from sizes. Can be a simple typedef.

I think address would be wrong. But size_t is also feeling off. I know we use size_t in other places as index or offset, but it still throws me off, I think of size_t as a size, not an offset.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18289#discussion_r1580908010


More information about the hotspot-dev mailing list