Skip to main content

2015 | OriginalPaper | Buchkapitel

Memory-Efficient Tail Calls in the JVM with Imperative Functional Objects

verfasst von : Tomáš Tauber, Xuan Bi, Zhiyuan Shi, Weixin Zhang, Huang Li, Zhenrui Zhang, Bruno C. D. S. Oliveira

Erschienen in: Programming Languages and Systems

Verlag: Springer International Publishing

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

Abstract

This paper presents FCore: a JVM implementation of System F with support for full tail-call elimination (TCE). Our compilation technique for FCore is innovative in two respects: it uses a new representation for first-class functions called imperative functional objects; and it provides a way to do TCE on the JVM using constant space.
Unlike conventional TCE techniques on the JVM, allocated function objects are reused in chains of tail calls. Thus, programs written in FCore can use idiomatic functional programming styles, relying on TCE, and perform well without worrying about the JVM limitations. Our empirical results show that programs which use tail calls can run in constant space and with low execution time overhead when compiled with FCore.

Sie haben noch keine Lizenz? Dann Informieren Sie sich jetzt über unsere Produkte:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Fußnoten
Literatur
1.
Zurück zum Zitat Abelson, H., Dybvig, R., Haynes, C., Rozas, G., Adams, N.I.I., Friedman, D., Kohlbecker, E., Steele, G.L., Bartley, D., Halstead, R., Oxley, D., Sussman, G., Brooks, G., Hanson, C., Pitman, K., Wand, M.: Revised\(^{5}\) report on the algorithmic language scheme. High.-Order Symbolic Comput. 11(1), 7–105 (1998)CrossRefMATH Abelson, H., Dybvig, R., Haynes, C., Rozas, G., Adams, N.I.I., Friedman, D., Kohlbecker, E., Steele, G.L., Bartley, D., Halstead, R., Oxley, D., Sussman, G., Brooks, G., Hanson, C., Pitman, K., Wand, M.: Revised\(^{5}\) report on the algorithmic language scheme. High.-Order Symbolic Comput. 11(1), 7–105 (1998)CrossRefMATH
2.
Zurück zum Zitat Armstrong, J.: Programming Erlang: Software for a Concurrent World, p. 536. Pragmatic Bookshelf, Raleigh (2007) Armstrong, J.: Programming Erlang: Software for a Concurrent World, p. 536. Pragmatic Bookshelf, Raleigh (2007)
3.
Zurück zum Zitat Baker, H.G.: CONS should not CONS its arguments, part II. ACM SIGPLAN Not. 30(9), 17–20 (1995)CrossRef Baker, H.G.: CONS should not CONS its arguments, part II. ACM SIGPLAN Not. 30(9), 17–20 (1995)CrossRef
4.
Zurück zum Zitat Benton, N., Kennedy, A., Russell, G.: Compiling Standard ML to Java Bytecodes. In: Proceedings of the 3rd ACM SIGPLAN International Conference on Functional Programming (1998) Benton, N., Kennedy, A., Russell, G.: Compiling Standard ML to Java Bytecodes. In: Proceedings of the 3rd ACM SIGPLAN International Conference on Functional Programming (1998)
5.
Zurück zum Zitat Bogdanas, D., Roşu, G.: K-Java: a complete semantics of Java. In: Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 445–456. POPL 2015, ACM, New York, NY, USA (2015) Bogdanas, D., Roşu, G.: K-Java: a complete semantics of Java. In: Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 445–456. POPL 2015, ACM, New York, NY, USA (2015)
6.
Zurück zum Zitat Choi, K., Lim, H., Han, T.: Compiling lazy functional programs based on the spineless tagless G-machine for the java virtual machine. In: Kuchen, H., Ueda, K. (eds.) FLOPS 2001. LNCS, vol. 2024, pp. 92–107. Springer, Heidelberg (2001) CrossRef Choi, K., Lim, H., Han, T.: Compiling lazy functional programs based on the spineless tagless G-machine for the java virtual machine. In: Kuchen, H., Ueda, K. (eds.) FLOPS 2001. LNCS, vol. 2024, pp. 92–107. Springer, Heidelberg (2001) CrossRef
7.
Zurück zum Zitat Clements, J., Felleisen, M.: A tail-recursive machine with stack inspection. ACM Transactions on Programming Languages and Systems 26(6), 1029–1052 (2004)CrossRef Clements, J., Felleisen, M.: A tail-recursive machine with stack inspection. ACM Transactions on Programming Languages and Systems 26(6), 1029–1052 (2004)CrossRef
9.
Zurück zum Zitat Girard, J.Y.: Interprétation fonctionnelle et élimination des coupures de l’arithmétique d’ordre supérieur. Ph.D. thesis, Université Paris VII (1972) Girard, J.Y.: Interprétation fonctionnelle et élimination des coupures de l’arithmétique d’ordre supérieur. Ph.D. thesis, Université Paris VII (1972)
10.
Zurück zum Zitat Hickey, R.: The Clojure programming language. In: Proceedings of the 2008 Symposium on Dynamic Languages (2008) Hickey, R.: The Clojure programming language. In: Proceedings of the 2008 Symposium on Dynamic Languages (2008)
12.
Zurück zum Zitat Kennedy, A., Syme, D.: Transposing F to C#: expressivity of parametric polymorphism in an object-oriented language. Concurrency Comput. Pract. Experience 16(7), 707–733 (2004)CrossRef Kennedy, A., Syme, D.: Transposing F to C#: expressivity of parametric polymorphism in an object-oriented language. Concurrency Comput. Pract. Experience 16(7), 707–733 (2004)CrossRef
13.
Zurück zum Zitat Krishnamurthi, S.: Educational pearl: automata via macros. J. Funct. Program. 16(3), 253–267 (2006)CrossRefMATH Krishnamurthi, S.: Educational pearl: automata via macros. J. Funct. Program. 16(3), 253–267 (2006)CrossRefMATH
14.
Zurück zum Zitat League, C., Trifonov, V., Shao, Z.: Functional java bytecode. Proceedings 5th World Conference on Systemics, Cybernetics, and Informatics (2001) League, C., Trifonov, V., Shao, Z.: Functional java bytecode. Proceedings 5th World Conference on Systemics, Cybernetics, and Informatics (2001)
15.
Zurück zum Zitat Minamide, Y.: Selective tail call elimination. In: Proceedings of the 10th International Conference on Static Analysis (2003) Minamide, Y.: Selective tail call elimination. In: Proceedings of the 10th International Conference on Static Analysis (2003)
16.
Zurück zum Zitat Odersky, M.: The scala language specification, Version 2.9. École Polytechnique Fédérale de Lausanne (2014) Odersky, M.: The scala language specification, Version 2.9. École Polytechnique Fédérale de Lausanne (2014)
17.
Zurück zum Zitat O’Hair, K.: HPROF: a Heap/CPU profiling tool in J2SE 5.0. Sun Developer Network, Developer Technical Articles & Tips (2004) O’Hair, K.: HPROF: a Heap/CPU profiling tool in J2SE 5.0. Sun Developer Network, Developer Technical Articles & Tips (2004)
18.
Zurück zum Zitat Reynolds, J.C.: Towards a theory of type structure. In: Symposium on Programming (1974) Reynolds, J.C.: Towards a theory of type structure. In: Symposium on Programming (1974)
19.
Zurück zum Zitat Schinz, M., Odersky, M.: Tail call elimination on the Java Virtual Machine. Electron. Notes Theor. Comput. Sci. 59(1), 158–171 (2001)CrossRef Schinz, M., Odersky, M.: Tail call elimination on the Java Virtual Machine. Electron. Notes Theor. Comput. Sci. 59(1), 158–171 (2001)CrossRef
20.
Zurück zum Zitat Schwaighofer, A.: Tail Call Optimization in the Java HotSpot™VM, master Thesis, Johannes Kepler Universität Linz (2009) Schwaighofer, A.: Tail Call Optimization in the Java HotSpot™VM, master Thesis, Johannes Kepler Universität Linz (2009)
21.
Zurück zum Zitat Shao, Z., Appel, A.W.: Space-efficient closure representations. ACM SIGPLAN Lisp Pointers 7(3), 150–161 (1994)CrossRef Shao, Z., Appel, A.W.: Space-efficient closure representations. ACM SIGPLAN Lisp Pointers 7(3), 150–161 (1994)CrossRef
22.
Zurück zum Zitat Steele, G.L.: Debunking the “Expensive Procedure Call” myth or, procedure call implementations considered harmful or, LAMDBA: the ultimate GOTO. In: Proceedings of the 1977 Annual Conference (1977) Steele, G.L.: Debunking the “Expensive Procedure Call” myth or, procedure call implementations considered harmful or, LAMDBA: the ultimate GOTO. In: Proceedings of the 1977 Annual Conference (1977)
23.
Zurück zum Zitat Steele, G.L.: Rabbit: a compiler for scheme. Technical report, Massachusetts Institute of Technology (1978) Steele, G.L.: Rabbit: a compiler for scheme. Technical report, Massachusetts Institute of Technology (1978)
24.
Zurück zum Zitat Tismer, C.: Continuations and stackless Python. In: Proceedings of the 8th International Python Conference, vol. 1 (2000) Tismer, C.: Continuations and stackless Python. In: Proceedings of the 8th International Python Conference, vol. 1 (2000)
25.
Zurück zum Zitat Tullsen, M.: Compiling Haskell to Java. Technical Report YALEU/DCS/RR-1204, Yale University (1996) Tullsen, M.: Compiling Haskell to Java. Technical Report YALEU/DCS/RR-1204, Yale University (1996)
26.
Zurück zum Zitat Wadsworth, C.: Semantics and Pragmatics of the Lambda-Calculus. Ph.D. thesis, University of Oxford (1971) Wadsworth, C.: Semantics and Pragmatics of the Lambda-Calculus. Ph.D. thesis, University of Oxford (1971)
27.
Zurück zum Zitat Wakeling, D.: Compiling lazy functional programs for the Java Virtual Machine. J. Funct. Program. 9(6), 579–603 (1999)CrossRefMATH Wakeling, D.: Compiling lazy functional programs for the Java Virtual Machine. J. Funct. Program. 9(6), 579–603 (1999)CrossRefMATH
29.
Zurück zum Zitat Würthinger, T., Wimmer, C., Wöß, A., Stadler, L., Duboscq, G., Humer, C., Richards, G., Simon, D., Wolczko, M.: One VM to rule them all. In: Proceedings of the 2013 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software (2013) Würthinger, T., Wimmer, C., Wöß, A., Stadler, L., Duboscq, G., Humer, C., Richards, G., Simon, D., Wolczko, M.: One VM to rule them all. In: Proceedings of the 2013 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software (2013)
Metadaten
Titel
Memory-Efficient Tail Calls in the JVM with Imperative Functional Objects
verfasst von
Tomáš Tauber
Xuan Bi
Zhiyuan Shi
Weixin Zhang
Huang Li
Zhenrui Zhang
Bruno C. D. S. Oliveira
Copyright-Jahr
2015
DOI
https://doi.org/10.1007/978-3-319-26529-2_2