RFR: 8338912: CDS: Segmented roots array [v4]
Ioi Lam
iklam at openjdk.org
Fri Sep 6 18:04:17 UTC 2024
On Fri, 6 Sep 2024 14:54:21 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> src/hotspot/share/cds/archiveHeapWriter.cpp line 219:
>>
>>> 217: _buffer_used = oop_offset + bytes_size;
>>> 218: ensure_buffer_space(_buffer_used);
>>> 219:
>>
>> There's a lot of low-level calculation here that's hard to understand. I would suggest splitting this "while" body into smaller functions, something like:
>>
>>
>> while (segment_beg < length) {
>> int elem_count = MIN2(max_elem_count, length - segment_beg);
>> objArrayOop segment_oop = allocate_root_segment(elem_count);
>> for (int i = 0; i < elem_count; i++) {
>> oop val = roots->at(segment_beg + i);
>> root_segment_at_put(segment_oop, i, val);
>> }
>> }
>>
>>
>> BTW, I think you can remove the special relocation code in `ArchiveHeapWriter::relocate_embedded_oops` by storing the requested address of `val` into `segment_oop`. You also need to call `mark_oop_pointer()` on each slot.
>
> Helper methods introduced, the code should look cleaner now.
>
>> I think you can remove the special relocation code in ArchiveHeapWriter::relocate_embedded_oops by storing the requested address of val into segment_oop.
>
> Comprehension check: this effectively does the relocation right away, right? I can try, but I prefer not to do more than neccessary for segmented root arrays to work :)
Actually my suggestion won't work, because the creation of the root segments are now down before the root objects are copied, so we don't know their requested address yet.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20858#discussion_r1747495092
More information about the hotspot-runtime-dev
mailing list