lightning
[Top][All Lists]
Advanced

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

Re: [Lightning] jit_movr broken on MIPS


From: Paulo César Pereira de Andrade
Subject: Re: [Lightning] jit_movr broken on MIPS
Date: Sat, 22 Nov 2014 23:27:44 -0200

2014-11-22 19:38 GMT-02:00 Paul Cercueil <address@hidden>:
> Hi,

  Hi,

> I have a problem when compiling for MIPS.
>
> Very rarely, one call to jit_movr() is optimized out even though the source
> and destination registers differ. This also happens with jit_retval_i() (as
> it calls jit_movr internally).
>
> As a result my generated code is wrong and fails at runtime. I currently
> work around that by patching the references to jit_movr(dest, src) with
> jit_orr(dest, _ZERO, src); then my program runs fine.

  I think you are relying on undefined behavior with this :(

> It is fully reproductible but it happens only once or twice in my
> disassembly log (which is ~6 MiB); I couldn't manage to create a simple test
> case which reproduces the issue.

  Please post the disassembly log (you may post it off list to me to
avoid a 6M+ mail, and I would reply with only what should matter).
Please also have in the log a call to jit_print, and edit the log to tell
where it was optimized out. If the jit_print call already removed the
jit_movr please annotate in the log where it was done.
  This should make it easier to understand what condition led
to the instruction being optimized out.

  Note that, unless you found a bug, it may optimize out a store
to a non callee save register under certain conditions, like before
a jit_ret* (non callee save register liveness reach epilog) or a
jit_jmpr, or a jit_jmpi patched to an absolute address; it treats
jit_jmpr and jit_jmpi to absolute address as a function call, as
otherwise it would need to consider all non callee save registers
live on a jump to an undefined target, and that would defeat the
register allocator.

> Did anybody run into a similar issue?
> Any pointers to what could be the cause?
>
> Thanks,
> Paul

Thanks,
Paulo



reply via email to

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