Skip to main content
Article thumbnail
Location of Repository

Stack Size Reduction of Recursive Programs

By Stefan Schaeckeler and Weijia Shang

Abstract

For memory constrained environments like embedded systems, optimization for program size is often as important, if not more important, as optimization for execution speed. Commonly, compilers try to reduce the code segment and neglect the stack segment, although the stack can significantly grow during the execution of recursive functions as a separate activation record is required for each recursive call. An activation record holds administrative data like the return address and the frame pointer but also the function’s formal parameter list and local variables. If a formal parameter or local variable is dead at all recursive calls, then it can be declared globally so that only one instance exists independent of the call depth. We found that in 70 % of popular recursive algorithms and in all our real world benchmarks, it is possible to reduce the stack size by declaring formal parameters and local variables globally. Architectures might impose a penalty in code size for accessing global data. On IA32, this stack size reduction starts to materialize for our benchmarks no later than in the fifth recursion

Topics: Languages, Performance, Experimentation Keywords Embedded systems
Year: 2014
OAI identifier: oai:CiteSeerX.psu:10.1.1.413.3953
Provided by: CiteSeerX
Download PDF:
Sorry, we are unable to provide the full text but you may find it at the following location(s):
  • http://citeseerx.ist.psu.edu/v... (external link)
  • http://www.cecs.uci.edu/~paper... (external link)
  • Suggested articles


    To submit an update or takedown request for this paper, please submit an Update/Correction/Removal Request.