Abstract
Considering the renewed interest in stack machines (in particular, the Java Virtual Machine), efficient execution of Algol-family languages on this class of hardware becomes increasingly important. Local variable accesses in the source language should be translated into stack accesses on the target machine (in analogy to register allocation on register machines).
In this paper we explore such stack allocation techniques for basic blocks. We present some improvements to Phil Koopman's stack scheduling, add an instruction scheduler and compare the result with an optimal stack allocation and instruction scheduling strategy. Stack scheduling in cooperation with depth first postorder instruction scheduling produces results close to the optimum. The optimizations discussed in this paper are profitable only for stack hardware where stack manipulation operations are faster than local variable accesses.
Chapter PDF
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman. Compilers. Principles, Techniques, and Tools. Addison-Wesley, Reading, 1986.
Preston Briggs, Keith D. Cooper, Linda Torczon, Improvements to Graph Coloring Register Allocation. ACM Transactions on Programming Languages and Systems (TOPLAS). Vol. 16, No. 3, May 1994. Rice University, Houston, 1992.
J. L. Bruno, T. Lassagne. The Generation of Optimal Code for Stack Machines. Journal of the ACM, Vol. 22, No. 3, July 1975.
Gregory J. Chaitin, Marc A. Auslander, Ashok K. Chandra, John Cocke, Martin E. Hopkins, Peter W. Markstein. Register Allocation Via Coloring. Computer Languages, Vol. 6, No. 1, 1981.
M. Anton Ertl. A New Approach to Forth Native Code Generation. Proceedings of the 1992 Euroforth Conference, Southampton, October 1992.
M. Anton Ertl. Stack Caching for Interpreters. Proceedings of the ACM SIGPLAN'95 Conference on Programming Language Design and Implementation (PLDI), La Jolla, June 1995.
Philip Koopman. Stack Computers: The New Wave. Ellis Horwood, Chichester, 1989.
Philip Koopman. A Preliminary Exploration of Optimized Stack Code Generation. Proceedings of the 1992 Rochester Forth Conference, Rochester, June 1992.
Philip Koopman. Usenet Nuggets: Why Stack Machines? Computer Architecture News, Vol. 21, No. 1, March 1993.
Martin Maierhofer. Erzeugung optimierten Codes für Stackmaschinen. Diploma thesis, Vienna University of Technology, Vienna, 1997.
Larry M. Masinter, L. Peter Deutsch. Local Optimization in a Compiler for Stack-based Lisp Machines. Conference Record of the 1980 LISP Conference, Stanford, 1980. Reprint New York, 1985.
Daniel L. Miller. Stack Machines and Compiler Design. Byte, April 1987.
Bhaskaram Prabhala, Ravi Sethi. Efficient Computation of Expressions with Common Subexpressions. Journal of the ACM, Vol. 27, No. 1, January 1980.
Mark Smotherman, Sanjay Krishnamurthy, P. S. Aravind, David Hunnicutt. Efficient DAG Construction and Heuristic Calculation for Instruction Scheduling. Proceedings of the 24th Annual International Symposium on Microarchitecture, Albuquerque, November 1991.
Sun Microsystems Computer Company. The Java Virtual Machine Specification,9 1995.
Andrew S. Tanenbaum, Hans van Staveren, Johan W. Stevenson. Using Peephole Optimization on Intermediate Code. ACM Transactions on Programming Languages and Systems, Vol. 4, No. 1, January 1982.
A. Winfield, S. Kelly. A C-to-Forth Translator. EuroFORML'88 Conference Proceedings, Southampton, September 1988.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1998 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Maierhofer, M., Ertl, M.A. (1998). Local stack allocation. In: Koskimies, K. (eds) Compiler Construction. CC 1998. Lecture Notes in Computer Science, vol 1383. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0026432
Download citation
DOI: https://doi.org/10.1007/BFb0026432
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-64304-3
Online ISBN: 978-3-540-69724-4
eBook Packages: Springer Book Archive