[lworld] RFR: 8371993: [lworld] Aarch64: save bad values instead of rfp and lr above the extension space [v2]
Marc Chevalier
mchevalier at openjdk.org
Fri Nov 28 14:15:02 UTC 2025
On Fri, 28 Nov 2025 12:26:50 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:
>> I agree it's busy, but I like explicit braces, rust-style. Especially with `#ifdef` in the middle, it looks easy to do something wrong with un-braced blocks. I'm not so shocked by the current style but another option I see would be
>>
>> if (DEBUG_ONLY(save_fake_rfp_lr) NOT_DEBUG(false)) {
>> mov_immediate64(rscratch1, ((uint64_t)badRegWordVal) << 32 | (uint64_t)badRegWordVal);
>> stp(rscratch1, rscratch1, Address(sp, framesize - 2 * wordSize));
>> } else {
>> stp(rfp, lr, Address(sp, framesize - 2 * wordSize));
>> }
>>
>> I am very confident gcc will remove the branch entirely in non-debug.
>
> Regarding Manuel's proposal: I don't think omitting brackets is a good idea. Alternative:
>
> } else
> #endif
> {
> stp ...
> }
I've done what I proposed. I think it looks nice. Does anyone strongly prefer
#ifdef ASSERT
if (save_fake_rfp_lr) {
mov_immediate64(rscratch1, ((uint64_t)badRegWordVal) << 32 | (uint64_t)badRegWordVal);
stp(rscratch1, rscratch1, Address(sp, framesize - 2 * wordSize));
} else
#endif
{
stp(rfp, lr, Address(sp, framesize - 2 * wordSize));
}
?
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1764#discussion_r2571799515
More information about the valhalla-dev
mailing list