Re:Hand-optimizing the TCC code generator
by ratboy666 on Thursday April 07, 2022 @11:14AM
(#30945527)
Sure -- the compiler is small enough to include -- and fast enough.
Bellard did an experiment where TCC was used to compile the Linux kernel
on boot. Remarkable.
Yes, the source may be verbose. But, the API exposed would be C, and most systems have a C FFI.
Instead of TCC, you may wish to consider Quick JS (Bellard's Javascript interpreter).
The reason I use TCC is to validate C code. TCC evaluates arguments left to right, whereas GCC does right to left...
Re:Hand-optimizing the TCC code generator
by melissalobos on Thursday April 07, 2022 @11:03AM
(#30945361)
Really GCC -O1 is usually plenty fast if you are just precompiling things at startup that your main executable would dynamically load. The bigger question is, would you really want to be using a language with manual memory management for writing extensions to a program? Maybe including the boehm gc with it would not be terrible.
Not really sure if it's a good idea or if it's practical.
I want to believe that it is, but it might quite verbose to use.