Abstract
Previous Schemes for implementing full tail-recursion when compiling into C have required some form of "trampoline" to pop the stack. We propose solving the tail-recursion problem in the same manner as Standard ML of New Jersey, by allocating all frames in the (garbage-collected) heap. The Scheme program is translated into continuation-passing style, so the target C functions never return. The C stack pointer then becomes the allocation pointer for a Cheney-style copying garbage collection scheme. Our Scheme can use C function calls, C arguments, C variable-arity functions, and separate compilation without requiring complex block-compilation of entire programs. Our C version of the "Boyer" benchmark is available at ftp://ftp.netcom.com/pub/hb/hbaker/cboyer13.c.
- Appel, A.W. "Garbage collection can be faster than stack allocation". Info. Proc. Letts. 25, 4 (1987), 275-279. Google Scholar
Digital Library
- Appel, A.W. "Simple Generational Garbage Collection and Fast Allocation". SW Prac. & Exper. 19, 2 (1989), 171+. Google Scholar
Digital Library
- Appel, A.W. "A Runtime System". Lisp & Symbolic Comput. 3, 4 (Nov. 1990), 343-380. Google Scholar
Digital Library
- Appel, A.W., and MacQueen, D.B. "Standard ML of New Jersey". In Wirsing, M., ed. Third Int'l Symp on Progr Lang Implementation and Logic Progr., Springer, August 1991.Google Scholar
Cross Ref
- Baker, H.G. "List Processing in Real Time on a Serial Computer". CACM 21, 4 (April 1978), 280-294. Google Scholar
Digital Library
- Baker, H.G. "CONS Should Not CONS Its Arguments, or, a Lazy alloc is a Smart alloc". Sigplan Not. 27, 3 (Mar. 1992), 24-34. Google Scholar
Digital Library
- Bartlett, J. "Scheme¿C: A portable Scheme-to-C compiler". Tech. Rept., DEC West. Res. Lab., 1989.Google Scholar
- Berry, D.M. "Block Structure: Retention vs. Deletion". Proc. 3rd Sigact Symp. Th. of Comp. Shaker Hgts., 1971. Google Scholar
Digital Library
- Cheney, C.J. "A nonrecursive list compacting algorithm". CACM 13, 11 (Nov. 1970), 677-678. Google Scholar
Digital Library
- Clinger, W., Hartheimer, A., and Ost, E. "Implementation strategies for continuations". Proc. LFP, 1988, 124-131. Google Scholar
Digital Library
- Danvy, O. "Memory Allocation and Higher-Order Functions". Proc. Sigplan '87 Symp. on Interp & Interp. Techs., ACM Sigplan Not. 22, 7 (July 1987), 241-252. Google Scholar
Digital Library
- Fairbairn, J., and Wray, S.C. "TIM: a simple abstract machine to execute supercombinators". Proc. 1987 FPCA. Google Scholar
Digital Library
- Fischer, M.J. "Lambda Calculus Schemata". ACM Conf. Proving Asserts. re Progs., Sigplan Not. 7, 1 (Jan. 1972). Google Scholar
Digital Library
- Friedman, D.P., and Wise, D.S. "CONS Should Not Evaluate Its Arguments". In Michaelson, S., and Milner, R., eds. Automata, Languages and Programming, Edinburgh U. Press, 1976, 257-284.Google Scholar
- Hanson, C. "Efficient stack allocation for tail-recursive languages". Proc. LFP, June 1990. Google Scholar
Digital Library
- IEEE. IEEE Standard for the Scheme Programming Language. IEEE-1178-1990, IEEE, NY, Dec. 1990. Google Scholar
Digital Library
- Peyton Jones, S.L. The Implementation of Functional Programming Languages. Prentice-Hall, New York, 1987. Google Scholar
Digital Library
- Stallman, R.M. "Phantom Stacks: If you look too hard, they aren't there". AI Memo 556, MIT AI Lab., July 1980.Google Scholar
- Stallman, R.M. Using and Porting GNU CC. Free Software Foundation, Inc. February, 1990.Google Scholar
- Steiner, J., and Hawkes, B. "The M.T.A." On the album The Kingston Trio At Large, released June 8, 1959, reached number 15 on June 15, 1959. Copyright Atlantic Music 1956-57.Google Scholar
- Tarditi, D., & Lee, P. "No assembly required: Compiling standard ML to C". ACM LOPLAS 1, 2 (1992), 161-177. Google Scholar
Digital Library
Index Terms
CONS should not CONS its arguments, part II: Cheney on the M.T.A.
Recommendations
CONS should not CONS its arguments, or, a lazy alloc is a smart alloc
Lazy allocation is a model for allocating objects on the execution stack of a high-level language which does not create dangling references. Our model provides safe transportation into the heap for objects that may survive the deallocation of the ...
Da capo con scala: design and analysis of a scala benchmark suite for the java virtual machine
Originally conceived as the target platform for Java alone, the Java Virtual Machine (JVM) has since been targeted by other languages, one of which is Scala. This trend, however, is not yet reflected by the benchmark suites commonly used in JVM ...
Da capo con scala: design and analysis of a scala benchmark suite for the java virtual machine
Originally conceived as the target platform for Java alone, the Java Virtual Machine (JVM) has since been targeted by other languages, one of which is Scala. This trend, however, is not yet reflected by the benchmark suites commonly used in JVM ...





Comments