RFR: 8336245: AArch64: remove extra register copy when converting from long to pointer

Fei Gao fgao at openjdk.org
Mon Jul 15 10:52:53 UTC 2024


On Fri, 12 Jul 2024 14:34:20 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> src/hotspot/share/opto/machnode.cpp line 400:
>> 
>>> 398: 
>>> 399:   if (t->isa_intptr_t() &&
>>> 400: #if !defined(AARCH64)
>> 
>> After applying the operand "IndirectX2P", we may have some patterns like:
>> 
>> str val, [CastX2P base]
>> 
>> The code path here will resolve the `base`, which is actually a `intptr`, not a `ptr`, and the offset is `0`.
>> 
>> I guess the code here was intended to support `[base, offset]`, where base can be a `intptr` but offset can not be `0`. I'm not sure why there is such a limitation that offset can not be `0`, maybe for some old machines?
>> 
>> I don't think the limitation is applied to aarch64 machines now. So I unblock it for aarch64.
>
> I think it's the other way around. Isn't this code saying that if the address is an intptr + a nonzero offset, then the returned type is bottom, ie nothing? What effect does this change have?

Thanks for review! Yeah, this code says if the address is an `intptr` + a nonzero offset, then return `TypeRawPtr::BOTTOM`. Then it continues [the verification](https://github.com/openjdk/jdk/blob/a96de6d8d273d75a6500e10ed06faab9955f893b/src/hotspot/share/opto/matcher.cpp#L1834). 

Without the change here, an `intptr` + a `zero` offset would fail to assert on next lines, https://github.com/openjdk/jdk/blob/a96de6d8d273d75a6500e10ed06faab9955f893b/src/hotspot/share/opto/machnode.cpp#L409-L413

AFAIK, the return value `TypeRawPtr::BOTTOM` represents `raw access to memory` here. And an `intptr` + a `zero` offset is also a valid `raw access`, so I unblock it here. WDYT? Thanks.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20157#discussion_r1677638951


More information about the hotspot-dev mailing list