[Top][All Lists]

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

Re: [Tinycc-devel] make tcc reentrant

From: grischka
Subject: Re: [Tinycc-devel] make tcc reentrant
Date: Mon, 16 Dec 2019 11:10:55 +0100
User-agent: Thunderbird (Windows/20090812)

Michael Matz wrote:
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.

The (C-) symbols aren't 'per state' either. I forgot to mention. ;)

Basically in the current situation both table_ident and sym_pools
as well as all the other related globals can be seen as kind of
temporary scratch area in global memory that is reserved for the
sole usage of tcc_compile(),  and is opaque to all of the rest.

tcc_compile() expects this area to be empty at its entrance and will
leave it empty again when the translation unit is finished and all
symbols including pp-defines have gone out of scope.

Of course you could record the symbols in the state, but no currently
existing API function would know what to do with them.

To look at symbols and tokens as 'temporary variables' may appear
unusual seen how important they are for the compiler, but you could
in fact put them on the local stack of tcc_compile(), and this sort
of 'proves' that TLS can work just as well except for recursion
which won't happen in this case (except one wanted to compile files
from within a TCCErrorFunc callback ;)


--- grischka

reply via email to

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