tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] make tcc reentrant


From: Michael Matz
Subject: Re: [Tinycc-devel] make tcc reentrant
Date: Mon, 9 Dec 2019 15:16:17 +0000 (UTC)
User-agent: Alpine 2.21 (LSU 202 2017-01-01)

Hi,

On Sat, 7 Dec 2019, Daniel Glöckner wrote:

> We need a macro
> 
> #if scenario == 1
> #define PASSPARAM1
> #else
> #define PASSPARAM1 s1,
> #endif
> 
> 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.

That's a red herring.  All global data is also packed together, as it's 
all placed next to each other in .data, same as it would be when placed 
into one structure.  (Of course you have more control over the specific 
layout, and that might matter sometimes, but just placing everything 
into a large struct doesn't change the properties of locality).

> 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).

The library API already takes a TCCState object (which is why it gives the 
impression that you actually can use multiple ones), so I don't think the 
public API should change to be OpenGL like.  For the internal API ... 
yeah, maybe, though of course the state switching also adds clutter 
source-wise.


Ciao,
Michael.

reply via email to

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