RFR: 8313708: NMT: cleanup _mst_marker
Gerard Ziemski
gziemski at openjdk.org
Fri Aug 11 00:35:29 UTC 2023
On Tue, 8 Aug 2023 09:06:48 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>
> Yes, the packing of two values into one is perhaps a bit unnecessary, but I do prefer the struct approach. Perhaps something like:
>
> ```c++
> struct alignas(uint32_t) MSTM {
> const uint16_t _bucket_idx;
> const uint16_t _bucket_pos;
> };
> STATIC_ASSERT(sizeof(MSTM) == sizeof(uint32_t), "must");
> ```
>
> (Shouldn't `MallocHeader` be a packed data structure by the way?)
>
> > the point of the marker is to quickly resolve MST entries. But that could be done in a better way, without having to manually walk bucket chains and count buckets with O(n). For example, by storing MST entries in a linear array (they never go away, so one would not have to deal with deletion) and redefining the mst_marker to be an index into that table. That way, access to these entries would be O(1).
>
> This would be very nice.
Agree. I used your code pretty much verbatim - thank you!
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15145#issuecomment-1674069329
More information about the hotspot-runtime-dev
mailing list