RFR: 8338912: CDS: Segmented roots array [v5]
Ioi Lam
iklam at openjdk.org
Tue Sep 10 09:04:06 UTC 2024
On Tue, 10 Sep 2024 08:12:19 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> > Diff of the map files confirms this:
> > ```
> > - heap_root_segments.roots_count: 2628
> > - heap_root_segments.seg_max_size_elems: 1048576
> > - heap_root_segments.seg_max_size_bytes: 131070
> > ....
> > 131c131
> > < 0x0000000000000300: 0010000000000a44 0000020a0001fffe 0000000000000002 000000000000f022
> > ---
> > > 0x0000000000000300: 0010000000000a44 000001e20001fffe 0000000000000002 000000000000f022
> >
> > 2628 = 0x00000a44
> > 1048576 = 0x00100000
> > 131080 = 0x00001ff2
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > The 0x000001e2 is garbage.
>
> Whoa, that looks fragile! It feels safer to memset(0) the entire header then? Whack-a-mole-ing the alignment paddings every time we add a field is not convenient.
memset the header first is not going to help. The random bits are added by this call:
void set_heap_root_segments(HeapRootSegments segments) { _heap_root_segments = segments; }
`segments` is passed in by value on the stack. Apparently VC++ will not zero-out the unused bits when pushing `segments` onto the stack, but will insist copying the unused bits when doing the assignment.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20858#issuecomment-2340083735
More information about the hotspot-runtime-dev
mailing list