RFR: 8319875: Add macOS implementation for jcmd System.map [v12]

Thomas Stuefe stuefe at openjdk.org
Sat Dec 7 08:40:41 UTC 2024


On Thu, 5 Dec 2024 18:37:23 GMT, Simon Tooke <stooke at openjdk.org> wrote:

>> This is a port of #16301  to macOS.
>> 
>> System.map and System.dump_map are implemented using the macOS API and provide roughly the same information in the same format. Most of the heavy lifting was implemented by @tstuefe in https://github.com/openjdk/jdk/pull/16301 - this PR adds the macOS implementation and enables the common code for macOS 64 bit.
>> 
>> The System.map tests are also reworked to be cleaner for the three implementations.
>> 
>> [sample output using G1GC](https://github.com/user-attachments/files/17558064/g1_map.txt)
>> [sample output using ZGC](https://github.com/user-attachments/files/17558067/zgc_map.txt)
>
> Simon Tooke has updated the pull request incrementally with one additional commit since the last revision:
> 
>   combine like 128MB regions

src/hotspot/os/bsd/memMapPrinter_macosx.cpp line 97:

> 95:       _file_name.print_raw(mem_info.prp_vip.vip_path);
> 96:     }
> 97:     /* proc_regionfilename() seems to give bad results, so we don't try to use it here. */

We use // in cpp for most cases

src/hotspot/os/bsd/memMapPrinter_macosx.cpp line 113:

> 111:       "cow", "pvt", "---", "shr", "tsh", "p/a", "s/a", "lpg"
> 112:     };
> 113:     assert(SM_COW == 1 && SM_LARGE_PAGE == 8, "share_mode contants are out of range");

Suggestion:

    assert(SM_COW == 1 && SM_LARGE_PAGE == (sizeof(share_strings)/sizeof(share_strings[0]), "share_mode contants are out of range"); // the +1 offset is intentional, see below

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20953#discussion_r1874370759
PR Review Comment: https://git.openjdk.org/jdk/pull/20953#discussion_r1874370994


More information about the hotspot-runtime-dev mailing list