lightning
[Top][All Lists]
Advanced

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

Re: [Lightning] Weird bug?


From: Paulo César Pereira de Andrade
Subject: Re: [Lightning] Weird bug?
Date: Fri, 7 Mar 2014 09:01:33 -0300

2014-03-05 16:01 GMT-03:00 Paulo César Pereira de Andrade
<address@hidden>:
> 2014-03-05 12:40 GMT-03:00 Bruno Loff <address@hidden>:
>>
>> Hello,
>
>   Hi,

  Some emails ended up not in the archives, to summarise, the problem Bruno
had was that he was computing the address of the jump only with calls to
jit_address(), using jit_note() return values as arguments. His example was
basically:

---%<---
start = note
    prolog
    $add = arg
    getarg %v0 $add        // start of code address
    ...
    $ref = beqi %r1 0
    ldi %r0 &dsp        // displacement
    addr %r0 %r0 %v0
    jmpr %r0
    patch $ref
    ...
target = note
    ...

    jit_emit();
    dsp = jit_address(target) - jit_address(start)
    void (*call)(long);
    call(jit_address(start));
---%<---

 This is not a good idea because lightning 2.x has some basic optimizations
and an internal register allocator, so, it needs to know where a jump may
land, and it does not consider calls to jit_note() a hint of that, neither
calls to jit_label() that are not the target of any jump. So, I explained to him
how to write a simple hack to not need the latest git code, but also added
a new interface, jit_indirect(), that returns a jit_node_t* that works as a
normal label as well as being a valid argument to jit_address. The commit
implementing it is:

http://git.savannah.gnu.org/cgit/lightning.git/commit/?id=a9433b5a2c8dd811e812cc42fb7ea8451da3342b

Thanks,
Paulo



reply via email to

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