RFR: 8337563: NMT: rename MEMFLAGS to MemTag [v7]

Afshin Zafari azafari at openjdk.org
Thu Sep 12 12:05:11 UTC 2024


On Tue, 10 Sep 2024 20:53:46 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> Please review this cleanup, where we rename `MEMFLAGS` to `MemTag`.
>> 
>> `MEMFLAGS` implies that we can use more than one at the same time, but those are exclusive values, so `MemTag` is a more suitable name.
>> 
>> This fix also includes a cleanup of all the related function/template parameter names and local variable names.
>> 
>> Testing is pending...
>> 
>> Note: there is more history in old closed PRs [https://github.com/openjdk/jdk/pull/20497](https://github.com/openjdk/jdk/pull/20497) and [https://github.com/openjdk/jdk/pull/20472](https://github.com/openjdk/jdk/pull/20472)
>
> Gerard Ziemski has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Coleen's feedback

Thank you @gerard-ziemski, for this huge change. After this change, the code looks much more nicer and consistent.

If we are insisting on replacing `flag` with `tag`, I could find these missed ones by regexp search for `mem.*flag`:

---
7 results - 5 files

Source root • src/hotspot/share/nmt/memMapPrinter.cpp:
  `83: // A Cache that correlates range with MEMFLAG, optimized to be iterated quickly`

Source root • src/hotspot/share/nmt/memTracker.hpp:
  `208:   //  memory flags of the original region.`

Source root • src/hotspot/share/nmt/vmatree.hpp:

`97:       assert(!(type == StateType::Released) || data.mem_tag == mtNone, "Released type must have flag mtNone");`

`108:       return static_cast<MemTag>(type_flag[1]);`


Source root • test/hotspot/gtest/nmt/test_nmt_reserved_region.cpp:
  `50:   ASSERT_EQ(region2.mem_tag(), mtThreadStack); // Should be correct flag`

Source root • test/hotspot/gtest/nmt/test_vmatree.cpp:
  
`435:   const MemTag candidate_flags[candidates_len_flags] = {`

`459:     const MemTag mem_tag = candidate_flags[os::random() % candidates_len_flags];`

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

PR Review: https://git.openjdk.org/jdk/pull/20872#pullrequestreview-2300097782


More information about the serviceability-dev mailing list