RFR: 8313708: NMT: cleanup _mst_marker
Johan Sjölen
jsjolen at openjdk.org
Wed Aug 23 09:10:56 UTC 2023
On Thu, 3 Aug 2023 18:44:43 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:
> While learning the NMT code I came across _mst_marker and I don't really like how it combines 16bit index and 16bit position into single 32bit mst_marker using bit sizzling.
>
> Consequently, right now we need the following 3 APIs: build_marker(), bucket_idx_from_marker(), pos_idx_from_marker() to support this. They are really not adding any value, in my opinion, and in fact obfuscate the code.
>
> I'd like to propose that we simplify the code and pass a struct value (as suggested by Thomas) which hides away the 2 individual fields that are implementation detail.
One comment but this definitely looks like a nice improvement now, I want to read the surrounding code in a bit more depth before committing to the approval, thanks for the good work :).
src/hotspot/share/services/mallocSiteTable.cpp line 118:
> 116: * Under any of above circumstances, caller should handle the situation.
> 117: */
> 118: MallocSite* MallocSiteTable::lookup_or_add(const NativeCallStack& key, uint16_t* bucket_idx, uint16_t* bucket_pos, MEMFLAGS flags) {
Could it take a `BucketInfo*` instead of the two separate pointers?
-------------
PR Review: https://git.openjdk.org/jdk/pull/15145#pullrequestreview-1591074316
PR Review Comment: https://git.openjdk.org/jdk/pull/15145#discussion_r1302689435
More information about the hotspot-runtime-dev
mailing list