[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: jit_jmpi() to absolute address
From: |
Paulo César Pereira de Andrade |
Subject: |
Re: jit_jmpi() to absolute address |
Date: |
Mon, 5 Sep 2022 14:13:58 -0300 |
Em sáb., 3 de set. de 2022 às 10:58, Paul Cercueil
<paul@crapouillou.net> escreveu:
>
> Hi Paulo,
>
> Somewhere in my code I do:
>
> jit_patch_abs(jit_jmpi(), code);
>
> On PowerPC at least, this unconditionally resolves to a movi_p() +
> jmpr(), which isn't ideal - it could totally be a PC-relative branch
> instead.
>
> Is there a valid reason why this isn't converted to a PC-relative
> branch, or is it a bug?
A pc relative jump is used only if it is a backward jump to a
node. If it is a raw address it will still do a jmpr.
But indeed, most if no all other ports do a relative jump if
possible, to a raw address if it is in range.
Please share a jit_print() of the generated code so I can
check if it is triggering some bug or if for some reason it is
some expected condition.
Likely it will work if you replace:
(void)jmpi_p(node->u.w);
with:
(void)jmpi(node->u.w);
in jit_ppc.c:_emit_code()
it will work, but might be hiding a bug. If the displacement
returns false in:
# define can_sign_extend_jump_p(im) ((im) >= -33554432 && (im) <= 33554431)
it will still use a temporary register.
> Cheers,
> -Paul
Thanks,
Paulo