RFR: 8338442: AArch64: Clean up IndOffXX type and let legitimize_address() fix out-of-range operands [v2]
Fei Gao
fgao at openjdk.org
Thu Aug 15 15:19:57 UTC 2024
On Fri, 8 Dec 2023 02:13:02 GMT, Dean Long <dlong at openjdk.org> wrote:
>> I think this patch is excessive for the problem and introduces a lot of code dupiication. Maybe it would be simpler, smaller, and faster to check for what we need:
>>
>>
>> diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad
>> index 233f9b6af7c..ea842912ce9 100644
>> --- a/src/hotspot/cpu/aarch64/aarch64.ad
>> +++ b/src/hotspot/cpu/aarch64/aarch64.ad
>> @@ -5911,7 +5911,8 @@ operand indIndexN(iRegN reg, iRegL lreg)
>>
>> operand indOffIN(iRegN reg, immIOffset off)
>> %{
>> - predicate(CompressedOops::shift() == 0);
>> + predicate(CompressedOops::shift() == 0
>> + && Address::offset_ok_for_immed(n->in(3)->find_int_con(min_jint), exact_log2(sizeof(jint))));
>> constraint(ALLOC_IN_RC(ptr_reg));
>> match(AddP (DecodeN reg) off);
>> op_cost(0);
>> @@ -5926,7 +5927,8 @@ operand indOffIN(iRegN reg, immIOffset off)
>>
>> operand indOffLN(iRegN reg, immLoffset off)
>> %{
>> - predicate(CompressedOops::shift() == 0);
>> + predicate(CompressedOops::shift() == 0
>> + && Address::offset_ok_for_immed(n->in(3)->find_long_con(min_jint), exact_log2(sizeof(jlong))));
>> constraint(ALLOC_IN_RC(ptr_reg));
>> match(AddP (DecodeN reg) off);
>> op_cost(0);
>
> @theRealAph , your patch only works if when `indOffIN` is used in `memory4` and `indOffLN` is used in `memory8`, right?
> Introducing new operands like `indOffIN4` is consistent with how the code currently works with `indOffI4`. In fact I think the new `indOffIN<size>` could be folded into the existing `indOffI<size>` by using multiple `match` lines and a better predicate.
@dean-long thanks for your approval!
Thanks for your suggestions @eme64 @TobiHartmann. Updated with a new RFE :)
I'll integrate it.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16991#issuecomment-2291501106
More information about the hotspot-compiler-dev
mailing list