lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: jit_jmpi() to absolute address


From: Paul Cercueil
Subject: Re: jit_jmpi() to absolute address
Date: Mon, 05 Sep 2022 21:17:17 +0100

Hi Paulo,

Le lun., sept. 5 2022 at 14:13:58 -0300, Paulo César Pereira de Andrade <paulo.cesar.pereira.de.andrade@gmail.com> a écrit :
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);

It does work. Thanks for the tip.

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.

But that's not a bug, is it? If a direct jump cannot be used I expect a temporary register to be used.

Cheers,
-Paul





reply via email to

[Prev in Thread] Current Thread [Next in Thread]