Title
Using the heap to eliminate stack accesses
Abstract
The value of a variable is often given by a field of a heap cell, and frequently the program will pick up the values of several variables from different fields of the same heap cell. By keeping some of these variables out of the stack frame, and accessing them in their original locations on the heap instead, we can reduce the number of loads from and stores to the stack at the cost of introducing a smaller number of loads from the heap. We present an algorithm that finds the optimal set of variables to access via a heap cell instead of a stack slot, and transforms the code of the program accordingly. We have implemented this optimization in the Mercury compiler, and our measurements show that it can reduce program runtimes by up to 12% while at the same time reducing program size. The optimization is straightforward to apply to Mercury and to other languages with immutable data structures; its adaptation to languages with destructive assignment would require the compiler to perform mutability analysis.
Year
DOI
Venue
2002
10.1145/571157.571170
PPDP
Keywords
Field
DocType
smaller number,program size,mutability analysis,destructive assignment,program runtimes,original location,heap cell,mercury compiler,immutable data structure,different field,maximal matching,data structure
Computer science,Parallel computing,Min-max heap,Heap overflow,Stack trace,Heap (data structure),Binary heap,Binomial heap,d-ary heap,Double-ended priority queue
Conference
ISBN
Citations 
PageRank 
1-58113-528-9
0
0.34
References 
Authors
2
2
Name
Order
Citations
PageRank
Zoltan Somogyi1571141.85
Peter J. Stuckey24368457.58