lightning
[Top][All Lists]
Advanced

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

Re: [Lightning] Feature Request: Allow patching of st(x)i and ld(x)i


From: Marc Nieper-Wißkirchen
Subject: Re: [Lightning] Feature Request: Allow patching of st(x)i and ld(x)i
Date: Tue, 3 Sep 2019 17:31:48 +0200

Am Mo., 2. Sept. 2019 um 18:32 Uhr schrieb Paulo César Pereira de
Andrade <address@hidden>:
>
> Em seg, 2 de set de 2019 às 12:17, Marc Nieper-Wißkirchen
> <address@hidden> escreveu:
>
>   Hi Marc,
>
> > >   Patches for ldi* and sti* are mostly pointless, because it would mean 
> > > the
> > > address is not known while generating jit, but before calling jit_emit().
> >
> > This is exactly the case here. My code generator, which calls GNU
> > lightning, handles literals (of the source language) by storing their
> > addresses in a table, which is malloc'd. The size of the table is not
> > known until all code has been generated (that is, just before the call
> > to jit_emit). Therefore, the table cannot be malloc'd before and its
> > absolute address is not known before. However, needs to reference
> > entries in the table, so I have to patch it when the table has been
> > malloc'd.
> >
> > Currently, I do something like:
> >
> > lbl = jit_movi (JIT_R0, 0);
> > jit_ldr (JIT_R1, JIT_R0);
> > ...
> > jit_patch_abs (lbl, table_pointer + offset);
> > jit_emit ();
> >
> > What I want to do is:
> >
> > lbl = jit_ldi (JIT_R1, 0);
> > ...
> > jit_patch_abs (lbl, table_pointer + offset);
> > jit_emit ();
>
>   Ok. This is a trivial patch. Still untested, but very unlikely to
> have issues. Please give some feedback on the attached patch.

I have tried the patch and it works here (x86_64).

Thanks a lot!

Marc

>
> > --
> >
> > Marc
>
> Thanks,
> Paulo



reply via email to

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