Next: , Previous: , Up: GNU lightning  

5 Re-entrant usage of GNU lightning

GNU lightning uses the special _jit identifier. To be able to be able to use multiple jit generation states at the same time, it is required to used code similar to:

    struct jit_state lightning;
    #define lightning _jit

This will cause the symbol defined to _jit to be passed as the first argument to the underlying GNU lightning implementation, that is usually a function with an _ (underscode) prefix and with an argument named _jit, in the pattern:

    static void _jit_mnemonic(jit_state_t *, jit_gpr_t, jit_gpr_t);
    #define jit_mnemonic(u, v) _jit_mnemonic(_jit, u, v);

The reason for this is to use the same syntax as the initial lightning implementation and to avoid needing the user to keep adding an extra argument to every call, as multiple jit states generating code in paralell should be very uncommon.