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: Sat, 14 Dec 2019 23:57:20 +0100 (CET)
User-agent: Alpine 2.21 (LSU 202 2017-01-01)

Hi,

On Thu, 12 Dec 2019, grischka wrote:

I assume Michael wrote that under the impression that there is still
global data with lifetime beyond the tcc_compile function call, which
was the case for example for the tokens and token hash table.

I have to admit that I did remove that feature,

Luckily you did not. For instance, there's a relation between sym->v and table_ident[sym->v]->str (e.g. via put_extern_sym). The former is (now) per state, the latter is global. If the latter would be made thread-local (but not per state) you'd have to record within the TCCState to which of the table_idents the sym->v entries are supposed to be relative to. And in order to benefit from thread-local-ness of table_ident (i.e. to not have to write locking code around accesses to table_ident) you also would now have to make sure that the TCCState in question is only accessed from the thread in which it was created (which basically is the association of TCCState and table_ident above).

So, while that all would work out fine from a data race perspective, it doesn't seem to make much sense to me; you can then also move all still global data to TCCState (instead of making it thread-local) and even get a bit better code out of that (thread local data is slow to access).

But the current solution is IMHO even better, a nice core, and some glue code to support multiple states. Everybody wins :)


Ciao,
Michael.



reply via email to

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