RFR: 8330076: NMT: add/make a mandatory MEMFLAGS argument to family of os::reserve/commit/uncommit memory API [v7]
Stefan Karlsson
stefank at openjdk.org
Tue Apr 30 13:35:17 UTC 2024
On Tue, 30 Apr 2024 08:59:21 GMT, Afshin Zafari <azafari at openjdk.org> wrote:
>> src/hotspot/share/memory/virtualspace.cpp line 623:
>>
>>> 621: }
>>> 622: // _nmt_flag is used internally by initialize_compressed_heap
>>> 623: _nmt_flag = mtJavaHeap;
>>
>> Nit, we use a mixture of directly accessing _nmt_flag and accessing it via getter. Hotspot seems to prefer getters/setters. Can we use setters here?
>
> The flag is not set/changed in other classes, so there is no need to have a `public set_nmt_flag()` member for it.
> All the changes to the flag can be done internally using the member directly.
> P.S.: There was already a setter but removed after a review comment.
> Hotspot seems to prefer getters/setters.
I don't think this is true. Maybe in some places, but I don't think we prefer to use setters/getters from inside classes. Maybe if we want to add some verification code, but otherwise I tend to prefer using the members directly.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18745#discussion_r1584827626
More information about the shenandoah-dev
mailing list