RFR: 8296344: Remove dependency on G1 for writing the CDS archive heap [v2]

Ioi Lam iklam at openjdk.org
Fri Feb 3 05:31:51 UTC 2023


On Thu, 2 Feb 2023 21:38:40 GMT, Ashutosh Mehra <duke at openjdk.org> wrote:

>> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fixed windows and 32-bit builds which do not support archive heap
>
> src/hotspot/share/cds/archiveHeapWriter.cpp line 528:
> 
>> 526:   template <class T> void do_oop_work(T *p) {
>> 527:     size_t field_offset = pointer_delta(p, _src_obj, sizeof(char));
>> 528:     ArchiveHeapWriter::relocate_field_in_requested_obj<T>(_requested_obj, field_offset);
> 
> I understand what we are doing here, but it seems to be taking a bit of a convoluted approach. It performs quite a few operations to calculate `source_referent`, which is already available in *p.
> So an alternate implementation for `do_oop(narrowOop *p)` can be:
> 
>     if (!CompressedOops::is_null(*p)) {
>       size_t field_offset = pointer_delta(p, _src_obj, sizeof(char));
>       oop request_referrent = source_obj_to_requested_obj(CompressedOops::decode(*p));  // source referent is already in *p
>       narrowOop* field_address_in_buffer = (narrowOop*)(cast_from_oop<address>(_buffered_obj) + field_offset);
>       *field_address_in_buffer = CompressedOops::encode(request_referrent);
>       mark_oop_pointer<narrowOop>(_requested_obj, field_offset, _oopmap);
>     }
> 
> The `_buffered_obj` can be calculated in the `iterator` below and passed to `EmbeddedOopRelocator` c'tor.
> `do_oop(oop *p)` would follow the same. Does this read better?

Thanks for the suggestion. I simplified the relocation code by loading/storing the field  using the "buffered address" instead of the "requested address".

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

PR: https://git.openjdk.org/jdk/pull/12304


More information about the hotspot-dev mailing list