RFR: 8351661: NMT: VMATree should support separate call-stacks for reserve and commit operations [v33]

Gerard Ziemski gziemski at openjdk.org
Mon Jun 2 15:07:01 UTC 2025


On Sun, 1 Jun 2025 06:51:22 GMT, Afshin Zafari <azafari at openjdk.org> wrote:

>> src/hotspot/share/nmt/vmatree.hpp line 249:
>> 
>>> 247:   };
>>> 248: 
>>> 249:   enum Operation {Release, Reserve, Commit, Uncommit, Invalid};
>> 
>> Can we drop `Invalid` and simplify the code?
>> 
>>  ```
>>  enum Operation {Release, Reserve, Commit, Uncommit};
>>   struct RequestInfo {
>>     position A, B;
>>     StateType _op;
>>     MemTag tag;
>>     SIndex callstack;
>>     bool use_tag_inplace;
>>     Operation op() const {
>>       return
>>             _op == StateType::Reserved && !use_tag_inplace  ? Operation::Reserve  :
>>             _op == StateType::Committed                     ? Operation::Commit   :
>>             _op == StateType::Reserved &&  use_tag_inplace  ? Operation::Uncommit :
>>              Operation::Release;
>>     }
>> 
>>     size_t op_to_index() const {
>>       return
>>             _op == StateType::Reserved && !use_tag_inplace  ? 1 :
>>             _op == StateType::Committed                     ? 2 :
>>             _op == StateType::Reserved &&  use_tag_inplace  ? 3 :
>>             0;
>>     }
>
> We need some invalid checking in the impl of register_mapping. How do we detect and report invalid values then?

There is no way an `Operation` can be set `Invalid`, unless we start with a default value, and in this case, instead of `Invalid` we can (should?) be using `Release`, which really does represent the default value.

This is the opposite of my other argument about nmtNone, where I think we could use another value to tell apart default never-set from don't care :-)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24028#discussion_r2121434114


More information about the hotspot-runtime-dev mailing list