An Efficient Staging Algorithm for Binding-Time Analysis

Takuma Murakami,Zhenjiang Hu,Kazuhiko Kakehi,Masato Takeichi
DOI: https://doi.org/10.1007/978-3-540-25938-1_9
2003-01-01
Abstract:Binding-Time Analysis (BTA) is one of the compile time program analyses which is a general framework for program optimization and program generation [1]. BTA divides a whole program into static and dynamic parts from a binding-time specification so that partial evaluators can perform static computations in compile time [2]. A binding-time specification gives information about availabil-ity of data: static data are available at compile time while dynamic data are available at run time. From a binding-time specification of the input BTA de-termines which computation can be done statically by propagating information on static data. Partial evaluators specialize the program for the static data by using the information from BTA to generate a more e±cient program than the original one. By now several algorithms for BTA such as abstract interpretation [3], type inference [4], constraint solving [5] or type based search [6] have been developed. Looking at the type directed searching approach proposed by Tim Sheard and Nathan Linger [6], we found two unclear points. First, it is not obvious how the algorithm can cut ofi the searching space, and the precise running time is left unestimated. The second point is the accuracy of the solution. The result obtained by the algorithm is good, but may not be best. These two kinds of uncertain are due to the existence of heuristics. We make use of the established method of program transformation, the optimization theorem for the maximum marking problem [7] [8]. It transforms a naive algorithm to an e±cient one by means of dynamic programming. Because it formally gives the estimation of computation complexity and guarantees of optimality of solutions with respect to given weight functions, we get a clear algorithm. The main contribution of our algorithm is to avoid iterations in BTA. Because of the finiteness of binding-time, we are able to compute all possible binding-time annotations by only one traversal over the given program. The naive algorithm in this approach obviously requires a large table to memoize intermediate results but we address the problem by applying the optimization theorem. The theorem
What problem does this paper attempt to address?