RFR: 8248404: AArch64: Remove uses of long and unsigned long [v4]
Coleen Phillimore
coleenp at openjdk.java.net
Tue Jan 11 16:55:26 UTC 2022
On Tue, 11 Jan 2022 16:22:06 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> src/hotspot/cpu/aarch64/universalUpcallHandler_aarch64.cpp line 74:
>>
>>> 72: // Capture prev stack pointer (stack arguments base)
>>> 73: __ add(rscratch1, rfp, 16); // Skip saved FP and LR
>>> 74: __ str(rscratch1, Address(sp, checked_cast<int>(layout.stack_args))); // x86 casts to int also
>>
>> Suggestion:
>>
>> __ Address slot = __ legitimize_address(Address(sp, checked_cast<int>(layout.stack_args)), wordSize, rscratch2);
>> __ str(rscratch1, slot); // x86 casts to int also
>>
>> I think this is a real bug: the range of a stack arg from SP can exceed that of the maximum offset of a STR instruction!
>> Wherever there's a dubious cast there's probably a bug...
>
> All of this may seem tedious and pedantic, but we have had failures in production caused by stack pointer offsets exceeding the 12-bit range of a STR instruction.
Yes, I agree and didn't really know how to fix it so it would compile (if it actually compiles now) and not be UB. I'm close to giving up! Thanks for the code change.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7023
More information about the hotspot-dev
mailing list