RFR: 8346890: AArch64: Type profile counters generate suboptimal code

Andrew Haley aph at openjdk.org
Fri Jan 10 11:03:41 UTC 2025


On Fri, 10 Jan 2025 09:51:09 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Can you explain a bit more here? I think I get why would we want to rewrite `lea+ldr` to `slot_at`.
> 
> I do not quite understand why do we rewrite this one:
> 
> ```
> -    Address data_addr(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i)));
> -    __ addptr(data_addr, DataLayout::counter_increment);
> +    __ addptr(slot_at(ReceiverTypeData::receiver_count_offset(i)),
> +              DataLayout::counter_increment);
> ```
> 
> Does it really optimize anything to rewrite it to `slot_at`? If so, shouldn't this one in the other hunk also get rewritten?

It's a safety in depth patch.
It's good practice always to check variable offsets in order to ensure that they are reachable. `addptr` has an embedded `form_address`, so this is not strictly necessary. It is, however, harmless.

> ```
>          Address data_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_count_offset(i)));
>           __ addptr(data_addr, DataLayout::counter_increment);
> ```

Yes, it should.

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

PR Comment: https://git.openjdk.org/jdk/pull/23012#issuecomment-2582431283


More information about the hotspot-dev mailing list