How is Tail Call Optimization optimized in DrScheme?

I heard that a trampoline is an inefficient way to implement TCO. How does DrScheme do it (PLAI Scheme, technically)? Does he do this in the β€œright” way (i.e., produces an assembly code that directly goes into the tail call, instead of going through the stack and the springboard)?

+3
source share
3 answers

PLT Scheme developers are pretty active in their Google group , where you can get a quick response from people who write code,

I'm not sure if they read SO though, so your best bet is probably to ask there.

+2
source

Matthew Flatt, lead developer of MzScheme (now PLT Scheme), told me in June 2008 that they were compiled to virtual machine code at one time, and in this case it is easy to write a virtual machine that makes the right tail calls. Now, however, the system is mature enough that on x86 they use a simple JIT. In any case, there are no trampolines - the guys at PLT Scheme know their business.

+4
source

Baguettes are used in implementations that translate the schema code into the target language X (C, Java, etc.), which does not support proper tail calls. PLT Scheme uses JIT compilation - and therefore trampolines are not needed. For a specific implementation strategy, ask a question on the PLT mailing list.

PS: You can learn more about trampolines in the various "Compile Scheme" documents available on ReadScheme.org .

+1
source

All Articles