Abstract
Tail calls are expected not to consume stack space in most functional languages. However, there is no support for tail calls in some environments. Even in such environments, proper tail calls can be implemented with a technique called a trampoline. To reduce the overhead of trampolining while preserving stack space asymptotically we propose selective tail call elimination based on an effect system. The effect system infers the number of successive tail calls generated by the execution of an expression, and trampolines are introduced only when they are necessary.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
H. Baker. Cons should not cons its arguments, part II: Cheney on the M.T.A. SIGPLAN Notices, 30(9):17–20, 1995.
N. Benton, A. Kennedy, and G. Russell. Compiling Standard ML to Java bytecodes. In Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming (ICFP’ 98), pages 129–140, 1998.
P. Bothner. Kawa-Compiling dynamic languages to the Java VM. In Proceedings of the USENIX 1998 Technical Conference, 1998.
M. M. T. Chakravarty and G. Keller. More types for nested data parallel programming. In Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, pages 94–105, 1999.
W. D. Clinger. Proper tail recursion and space efficiency. In Proceedings of the ACM SIGPLAN’98 Conference on Programming Language Design and Implementation, pages 174–185. ACM Press, 1998.
V. Dornic, P. Jouvelot, and D. K. Gifford. Polymorphic time systems for estimating program complexity. ACM Letters on Programming Languages and Systems (LOPLAS), 1(1):33–45, 1992.
S. D. Ganz, D. P. Friedman, and M. Wand. Trampolined style. In Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming (ICFP’ 99), pages 18–22, 1999.
D. K. Gifford and J. M. Lucassen. Integrating functional and imperative programming. In Proceedings of the ACM Conference on Lisp and Functional Programming, pages 28–38, 1986.
J. Hughes, L. Pareto, and A. Sabry. Proving the correctness of reactive systems. In Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 410–423, 1996.
T. Lindholm and F. Yellin. The Java Virtual Machine Specification. Addison Wesley, 1999.
J. M. Lucassen and D. K. Gifford. Polymorphic effect systems. In Proceedings of the Fifteenth ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pages 47–57, 1988.
Y. Minamide. A new criterion for safe program transformations. In Proceedings of the Forth International Workshop on Higher Order Operational Techniques in Semantics (HOOTS), volume 41(3) of ENTCS, Montreal, 2000.
Y. Minamide. Selective tail call elimination. Technical Report ISE-TR-03-192, Institute of Information Sciences and Electronics, University of Tsukuba, 2003.
Y. Minamide and J. Garrigue. On the runtime complexity of type-directed unboxing. In Proceedings of the Third ACM SIGPLAN International conference on Functional Programming, pages 1–12, 1998.
B. Reistad and D. K. Gifford. Static dependent costs for estimating execution time. In Proceedings of the 1994 ACM Conference on LISP and Functional Programming, pages 65–78, 1994.
M. Schinz and M. Odersky. Tail call elimination on the Java virtual machine. In Proceedings of the First International Workshop on Multi-Language Infrastructure and Interoperability (BABEL), volume 59(1) of ENTCS, 2001.
B. Serpette and M. Serrano. Compiling Scheme to JVM bytecode: a performance study. In Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming, pages 259–270, 2002.
D. Tarditi, A. Acharya, and P. Lee. No assembly required: Compiling standard ML to C. ACM Letters on Programming Languages and Systems (LOPLAS), 1(2):161–177, 1992.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2003 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Minamide, Y. (2003). Selective Tail Call Elimination. In: Cousot, R. (eds) Static Analysis. SAS 2003. Lecture Notes in Computer Science, vol 2694. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-44898-5_9
Download citation
DOI: https://doi.org/10.1007/3-540-44898-5_9
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-40325-8
Online ISBN: 978-3-540-44898-3
eBook Packages: Springer Book Archive