tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Making tinycc fully reentrant


From: Domingo Alvarez Duarte
Subject: Re: [Tinycc-devel] Making tinycc fully reentrant
Date: Mon, 25 Oct 2021 13:18:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

Hello grischka !

Thanks for pointing out the problem !

After reviewing again I found several other remaining globals/static that I now fixed.

I also added a script to invoke gdb on the generate cross compilers to show global variables (after changing the build flags to add debug info), here is the relevant outuput for one of then:

globals-i386-tcc.txt

=====

All defined variables:

File i386-asm.c:
222:    static const ASMInstr asm_instrs[303];
242:    static const uint16_t op0_codes[95];
166:    static const uint8_t reg_to_size[9];
213:    static const uint8_t segment_prefixes[6];
180:    static const uint8_t test_bits[30];

File i386-gen.c:
370:    static const uint8_t fastcall_regs[3];
371:    static const uint8_t fastcallw_regs[2];

File libtcc.c:
1661:    static const FlagDef options_W[7];
1671:    static const FlagDef options_f[8];
1682:    static const FlagDef options_m[2];
1581:    static const TCCOption tcc_options[56];

File tcc.c:
27:    static const char help[2088];
86:    static const char help2[2551];
153:    static const char version[55];

File tcc.h:
1795:    static const int reg_classes[5];
1794:    static const char * const target_machine_defs;

File tccgen.c:
86:    static const struct {
    int type;
    const char *name;
} default_debug[27];

File tccpp.c:
3139:    static const char ab_month_name[12][4];
3635:    static const char * const target_os_defs;
31:    static const char tcc_keywords[6211];

38:    static const unsigned char tok_two_chars[67];

=====

With respect to "any tinycc practical project exists" I consider libtcc the main project and tcc and all cross compiler variants as usage examples of it.

Again any feedback pull request is welcome !

Cheers !

On 25/10/21 0:25, grischka wrote:
Domingo Alvarez Duarte wrote:
Hello again grischka !

I finally managed to get a github workflow to build my reentrant fork of
tinycc on linux, osx and windows.

Actually there is two builds:

- one with CONFIG_TCC_SEMLOCK set to ONE here
https://github.com/mingodad/tinycc/actions/runs/1378248438

- and another with CONFIG_TCC_SEMLOCK set to ZERO here
https://github.com/mingodad/tinycc/actions/runs/1378259299 and it seems
that in both all tests pass.

Obs: You can clcik on individual builds to see the build/test output.

Please if anyone is willing to test it and give any feedback I'll
appreciate.

Sorry, forgot to mention i386-windows.  The problem seen obviously
was caused by the 2 static globals still present in i385-gen.c.

So with that corrected I can report that the 3rd test of
libtcc_test_mt
    "running tcc.c in threads to run fib"
actually runs faster with your version (here, with 2 CPU cores.
~1600ms, compared to ~2600ms with the semaphore lock).

Whether any practical project exists or ever will exist that would
benefit from that is another question.  One could think of a tcc
able to compile several files in parallel for example, but maybe
people will more likely stick to make -j instead.

--- grischka



reply via email to

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