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: Paulo César Pereira de Andrade
Subject: Re: [Lightning] Feature Request: Allow patching of st(x)i and ld(x)i
Date: Mon, 2 Sep 2019 13:31:48 -0300

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.

> --
>
> Marc

Thanks,
Paulo

Attachment: jit_patch_abs.patch
Description: Text Data


reply via email to

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