[Top][All Lists]

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

Re: [Tinycc-devel] make tcc reentrant

From: Daniel Glöckner
Subject: Re: [Tinycc-devel] make tcc reentrant
Date: Sat, 7 Dec 2019 12:51:31 +0100
User-agent: Mutt/1.5.20 (2009-06-14)


On Sat, Dec 07, 2019 at 11:34:11AM +0100, Ulrich Schmidt wrote:
> - The in scenario1 unloved 1 function parameter can be ignored and the
> values stored locally:
>   #define LIBPARAM1
>   #define VALUE(v) v
>   ..
>   somereturn somefunc(LIBPARAM1 ...) {
>     VALUE(count) = 0;
>     ...
> - in scenario 2 we define the 2 macros different:
>   #define LIBPARAM1 TCCState *s1,
>   #define VALUE(v) s1->v

We need a macro

#if scenario == 1
#define PASSPARAM1
#define PASSPARAM1 s1,

Grouping all globals in the TCCState structure might be beneficial
even if we don't switch to those macros, because of the cache locality
Christian wrote about. The VALUE macro in scenario 1 would then be
#define VALUE(v) global_state.v

Btw, has anyone thought about handling TCCState like the context is
handled in the OpenGL API? It has one function to select the context
to use for following operations and the operations themselves don't
have a parameter for the context. If the pointer to the TCCState is
stored in a normal or in a TLS variable is up to us and might even
be a compile time option (that is set to "normal" for compilation
with tcc as long as tcc doesn't know how to generate TLS variables).

Best regards,


reply via email to

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