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: Ulrich Schmidt
Subject: Re: [Tinycc-devel] make tcc reentrant
Date: Sat, 7 Dec 2019 11:34:11 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

Hello.

After reading all your posts. I see there are 2 scenarios/goals in the
comunity.

scenario 1:
I want a tiny and fast c compiler (tcc/tcc.exe).
In this case the TCCSTate struct is not needed at all and dereferencing
TCCState fields slows down execution. Making TCCStruct fields local
would speed things up. libtcc.c needs to become compiled statically into
tcc.exe. You can execute tcc many times parallel without trouble and it
is fast as it can be.

scenario 2:
I want to use libtcc in my own application(libtcc.so/libtcc.so).
This library HAS to be reentrant and we need the TCCStruct and all
compiling state related values needs to be stored inside this struct.

These 2 scenarios result in different decisions about TCCState. Many
years ago (more than 6) someone decited to make tcc functionality
useable from other apps, put all relevant conde into libbtcc.c, defined
a api,created this TCCStruct and started the transition process. (you
can still find the comments //XXX: in the sources) this process never
finished.

The question is, how we deal with the situation. Right now i would not
provide a separate libtcc until the transition process came to a end.
Right now libtcc needs to be compiled statically into tcc.

So how can we comply with scenario 1 AND 2 at the same time? (just a
quick thought)
- make the state values local or struct fields by using defines and
macros...

- 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

Right now tcc does not fit scenario 1 nor 2.

Ulrich.




reply via email to

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