[Top][All Lists]

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

Re: [Lightning] Re: Proof of concept work on inline functions

From: Paulo César Pereira de Andrade
Subject: Re: [Lightning] Re: Proof of concept work on inline functions
Date: Sun, 12 Sep 2010 11:38:12 -0300

2010/9/11 Paolo Bonzini <address@hidden>:

>>  I think this argument is good enough to change as soon as possible
>> to use the other approach suggested, that is to have a "hidden" extra
>> argument, so that one can have several jit generators in parallel and in
>> the same thread, if one per thread, could use a tls global.
> You could add the argument to the inline function, and then define a
> same-named macro like
> #define jit_addi_i(a,b,c) jit_add_i(_jit,a,b,c)

  This will not work. Macro expansion stops when it would become
infinitely recursive, so, it will fail telling that jit_add_i was
called with 4 parameters, but requires only 3.

  Either way, I do not like the idea of too much obfuscated logic. But
before doing some major search&replace, any feedback is welcome :-)

  My next idea is to convert all references to "_jit." to "_jit->", and
define jit_state as something like:

typedef struct { ... } jit_state_t[1];

and declare a global:

static jit_state_t _jit;

and have macros/functions in a format like:

#define jit_addi_i(a, b, c)   __jit_addi_i(_jit, a, b, c)
__jit_inline void __jit_addi_i(jit_state_t _jit, type a, type b, type c) {

  Now, if code outside of lightning is dereferencing _jit fields it
still would have issues (s/\./->/), otherwise, this should be close
to, or the better possible approach in source compatibility.

> Paolo


reply via email to

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