RFR: 8338912: CDS: Segmented roots array [v2]

Aleksey Shipilev shade at openjdk.org
Fri Sep 6 14:58:34 UTC 2024


On Thu, 5 Sep 2024 05:25:30 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Aleksey Shipilev has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - More touchups
>>  - Introduce helper methods, further simplifications
>
> 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 :)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20858#discussion_r1747255528


More information about the hotspot-runtime-dev mailing list