2 ms·
I'm a HUGE fan of TCC -- I've recently added a pretty cool feature to simavr: a way to translate the whole AVR core into 'C' and JIT compile it using libtcc (th
by buserror 10y ago
I'm a HUGE fan of TCC -- I've recently added a pretty cool feature to simavr: a way to translate the whole AVR core into 'C' and JIT compile it using libtcc (the backend of tcc).
Result is amazing speed for emulation!
https://github.com/buserror/simavr/tree/jit-wip https://github.com/buserror/simavr/tree/jit-wip
- marktangotango 10y agoThat's awesome, can you give a quick rundown here, or have you blogged about it? One question I have is around symbol resolution. Can the in memory piece of tcc compiled code see all the symbols in your program (ie the host exe) for example?
- buserror 10y agoI haven't posted about it yet, as I wanted to clean up the branch before I do, and I ran out of time; work to catch up and so on :-) libtcc is /massively/ clever, it will 'link back' to your (exported) ELF symbols automatically. Basically it links the piece of code to your current running process, with all it's libs etc. So if you have a function blob(int); in your main program, just call it from the C you generate, and it'll Just Works. For my own purpose, I decided to trim down the headers I would have to include in the generated C and made some sort of simpler 'trampoline', but it's not strictly necessary.
- ww520 10y agoThat's an ingenious way of doing JIT. TCC sounds like an amazing project, a complete performant compiler framework and runtime in a small package.