3 ms·
Indeed, they use stack as fast bump allocator. That's really smart but probably fairly inefficient, since all the return addresses, stack frames and saved regis
by zde 10y ago
Indeed, they use stack as fast bump allocator. That's really smart but probably fairly inefficient, since all the return addresses, stack frames and saved registers are just write-only junk.
- qwertyuiop924 10y ago...But that's the part that allows for cheap first class continuations, because in Scheme, those stack frames can be part of a datastructure. Sort of. Continuations are confusing.
- gpderetta 10y agoThat's a problem when compiling via C (which admittedly is one of the major selling point of the technique), when targeting a lower level intermediate language or even assembly, custom calling conventions are an option.
- KMag 10y agoGCC at least has an annotation that can be used to tell the compiler that a function call never returns. I don't have the details, but I presume it causes the compiler to omit any save/restore code, though I would guess that the return address is still pushed (x86 call instead of jmp) so that you get decent stack traces. 16-byte stack alignment across calls means that the average cost of pushing the return pointer is 8 bytes. It's not free, but it's cheap.