windelbouwman / ppci

A compiler for ARM, X86, MSP430, xtensa and more implemented in pure Python
https://ppci.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
337 stars 36 forks source link

Compiling and running a simple GC #125

Open darleybarreto opened 3 years ago

darleybarreto commented 3 years ago

A while ago I've found a simple gc to use on a simple LISP implementation to be compiled with ppci-cc. What is lacking on master is __builtin_frame_address(0) and set/longjmp. Do you think this gc would be an interesting example to place inside tools? I have fixes for these two (x86_64). Instead of using a builtin __builtin_frame_address, I've made changes in the inline asm to allow something like this:

long ret;
asm("mov %0, rbp": "=r"(ret) ::);
void *tos = (void*) ret;