| ▲ | RealityVoid 2 days ago | |
I believe it's possible to do what you've described, but I am not aware of any compiler that does this. What do you get by doing it like this? Also, in your described structure, how do you handle nested function calls? I'm sure there exists a convoluted scheme that does this, but not sure with the current call assumptions. You also lose ABI compatibility with a bunch of stuff. And regardless, I mostly program in Risc-v and ARM -most compiles like to pass arguments on the registers, but use the stack anyway for local context. | ||
| ▲ | jcalvinowens 2 days ago | parent [-] | |
You can do it on x86 too, just use jmp instead of call and invent your own arbitrary register scheme for it. This x86 program has no stack: https://github.com/jcalvinowens/asmhttpd I don't think it's too hard to imagine a compiler that does that, although it would obviously be very limited in functionality (nesting would be disallowed as you note, or I guess limited to the number of registers you're willing to waste on it...). | ||