[Top][All Lists]

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

Re: Lightning register liveliness

From: Paul Cercueil
Subject: Re: Lightning register liveliness
Date: Sun, 26 Jan 2020 11:15:07 -0300

Hi Paulo,

Thanks for the quick fix.

It fixes most of the instances of the bug but in some corner cases the workaround with jit_live() is still needed; I will try to get a new testcase to reproduce it.


Le mer., janv. 22, 2020 at 17:16, Paulo César Pereira de Andrade <address@hidden> a écrit :
Em qua., 22 de jan. de 2020 às 15:23, Paulo César Pereira de Andrade
<address@hidden> escreveu:

 Em qui., 9 de jan. de 2020 às 00:26, Paul Cercueil
 <address@hidden> escreveu:
 > Hi Paulo,

   Hi Paul,

   Sorry for the delay. Just found this message I previously missed.

 > I am facing a problem related to register liveliness. I could only
 > reproduce it on MinGW, I never faced it on Linux x86_64 or MIPS.
> Here is an example code to reproduce the issue (sorry for the length). > It is not important to understand what the code does; what is important > to see, is that my JIT_V0 (== rbx), which is set at the very beginning > of the code and read back at the last opcode (provided that the node2
 > beqi branch is taken), is overwritten by the call to jit_ltr_u.
> I know that Lightning assumes that the caller-saved registers are dead
 > after a function call, but there's no function call here.
> Could you give me some light in why Lightning uses my registers? Do I
 > have to use jit_live() somewhere here?

I understand what is happening. It is a bug in the logic of live registers, that does not mark JIT_V0 live, and then it is used in the ltr_u translation, when it needs a special kind of register. Due to the way it handles the live state, it thinks it is dead in 'jit_movi(JIT_V0, 0x80065ff8);' and does not properly follow the previous branch in 'node2 = jit_beqi(JIT_V1, 0);'. I will work on a patch, and let you know about it when it is ready.

An ugly hack, for a temporary solution would be to add a jit_live as below:

    jit_subi(CYCLE_REG, CYCLE_REG, 0x14);
 +  jit_live(JIT_V0);
   node2 = jit_beqi(JIT_V1, 0);

  A patch was now pushed. This code should be revisited, but
the added patch should correct any variant of the problem you

 > Thanks,
 > -Paul


reply via email to

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