3 ms·
tcc is blazingly fast, at least last time i used it. it's honestly fast enough that you could probably use it as an c interpreter
by archimedespi 10y ago
tcc is blazingly fast, at least last time i used it.
it's honestly fast enough that you could probably use it as an c interpreter
- Hydraulix989 10y agoAny technical reasons in particular? I'm curious. How many passes is it doing? I suspect they aren't doing much optimization then? Maybe they patch in differences in the ASTs at the IR level and work from there?
- smitherfield 10y agoMy understanding is TCC does little to no optimization; it's intended to be used for bootstrapping.
- buserror 10y agoI do use it as interpreter on embedded boards! Preprocess/trim the headers you need, and add #!/bin/tcc -run at the top of your .C file, add a +x to it and it'll run just fine! I love tcc, in fact I added a firmware instruction translator to 'JIT' AVR code to simavr a few weeks ago. Takes a AVR binary, translates it to C, and compiles it on the fly with libtcc to run it :-) https://github.com/buserror/simavr/tree/jit-wip https://github.com/buserror/simavr/tree/jit-wip
- juliangoldsmith 10y ago>I love tcc, in fact I added a firmware instruction translator to 'JIT' AVR code to simavr a few weeks ago. Takes a AVR binary, translates it to C, and compiles it on the fly with libtcc to run it :-) That is unholy, and glorious.
- buserror 10y agoAhah, thanks for that -- I thought it was pretty clever, but it's hard to explain why to someone :-) If you look closer, you can see I've actually repurposed the main interpreter core, and uses a GNU awk (of all thing) to extract each opcode emulation 'meat', converts it to a string to and that string is used by the translator to generate the C for tcc...